-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
35 lines (30 loc) · 900 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* jshint node: true */
'use strict';
var parseVersion = require('./lib/parse-version');
var mergeOptions = require('./lib/merge-options');
var buildMetaTag = require('./lib/build-meta-tag');
module.exports = {
name: 'ember-cli-build-info',
/**
* Store Application options, merged with defaults.
*/
included: function(app, parentAddon) {
var target = (parentAddon || app);
this.ops = mergeOptions(target);
this._super.included.apply(this, arguments);
},
/**
* Expose the build info on the APP object.
*/
config: function(env, config) {
config.APP.buildInfo = parseVersion(config.APP.version || require('git-repo-version')());
},
/**
* Inject a <meta> tag with the build info as the content.
*/
contentFor: function(type, config) {
if (type === 'head') {
return buildMetaTag(config.APP.buildInfo, this.ops.metaTemplate);
}
}
};