Permalink
Browse files

Added 'generatedByVersion' property to environment config for new apps

  • Loading branch information...
1 parent f4fbfbb commit 3af891922339ddd0e980215e37c5a29222fc0e5b @mde mde committed Jan 26, 2014
View
@@ -1,9 +0,0 @@
-var config = {
- /*
- metrics: {
- port: 4001
- }
- */
-};
-
-module.exports = config;
@@ -1,5 +1,5 @@
var config = {
- realtime: true
+ generatedByVersion: '<%= version; %>'
};
module.exports = config;
@@ -0,0 +1,6 @@
+var config = {
+ generatedByVersion: '<%= version; %>'
+, realtime: true
+};
+
+module.exports = config;
View
@@ -133,6 +133,7 @@ namespace('gen', function () {
// Creates a new Geddy app scaffold
task('app', function (name, engine, realtime) {
var basePath = path.join(genDirname, 'base')
+ , envPath
, mkdirs
, cps
, text
@@ -165,7 +166,7 @@ namespace('gen', function () {
, ['public', '']
, ['router.js', 'config']
, ['init.js', 'config']
- , (realtime) ? ['realtime/environment.js', 'config'] : ['environment.js', 'config']
+ //, (realtime) ? ['realtime/environment.js', 'config'] : ['environment.js', 'config']
, ['development.js', 'config']
, ['production.js', 'config']
, ['secrets.json', 'config']
@@ -182,6 +183,13 @@ namespace('gen', function () {
jake.cpR(path.join(basePath, cp[0]), path.join(name, cp[1]), {silent: true});
});
+ // Compile base environment.js
+ envPath = realtime ? 'realtime/environment.js.ejs' : 'environment.js.ejs';
+ text = fs.readFileSync(path.join(basePath, envPath), 'utf8').toString();
+ adapter = new Adapter({engine: 'ejs', template: text});
+ fs.writeFileSync(path.join(name, 'config', 'environment.js'),
+ adapter.render({version: geddy.version}), 'utf8');
+
// Compile Jakefile
text = fs.readFileSync(path.join(basePath, 'Jakefile.ejs'), 'utf8').toString();
adapter = new Adapter({engine: 'ejs', template: text});

0 comments on commit 3af8919

Please sign in to comment.