Skip to content

Commit

Permalink
Dynamically populate meta data in dummy app from package.json informa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Jeremy Brown committed Dec 29, 2014
1 parent dbf285d commit 22f9523
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
26 changes: 20 additions & 6 deletions Brocfile.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* jshint node: true */
/* global require, module */

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'),
isProduction = ( process.env.EMBER_ENV || 'development' ) === 'production';

app = new EmberAddon();

var EmberAddon = require( 'ember-cli/lib/broccoli/ember-addon' ),
replace = require( 'broccoli-string-replace' ),
isProduction = ( process.env.EMBER_ENV || 'development' ) === 'production',
app = new EmberAddon(),
tree;

// Use `app.import` to add additional libraries to the generated
// output files.
Expand All @@ -26,4 +26,18 @@ if ( !isProduction ) {
app.import( app.bowerDirectory + '/sinon-qunit/lib/sinon-qunit.js', { type: 'test' } );
}

module.exports = app.toTree();
tree = replace( app.toTree(), {
files: [ 'index.html' ],
patterns: [
{
match: /REPLACE_META_DESCRIPTION/g,
replacement: require('./package.json')['description']
},
{
match: /REPLACE_META_KEYWORDS/g,
replacement: require('./package.json')['keywords'].join( ', ' ) + ', ember, ember cli'
}
]
});

module.exports = tree;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"express": "^4.8.5",
"glob": "^4.0.5",
"morgan": "^1.5.0",
"ember-cli-es5-shim": "~0.1.0"
"ember-cli-es5-shim": "~0.1.0",
"broccoli-string-replace": "0.0.2"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>sl-ember-store Demo Application and Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="ember-addon, model, data, ember, ember cli">
<meta name="description" content="Ember CLI Addon - Data Model">
<meta name="keywords" content="REPLACE_META_KEYWORDS">
<meta name="description" content="REPLACE_META_DESCRIPTION">
<meta name="author" content="SoftLayer, an IBM Company">

{{content-for 'head'}}
Expand Down

0 comments on commit 22f9523

Please sign in to comment.