From d6cf7efa3ce5ab8f0360e41d2123b6de154f0d68 Mon Sep 17 00:00:00 2001 From: jelhan Date: Sat, 20 Jun 2015 19:04:19 +0200 Subject: [PATCH] add version information to * build (as html meta tag) * stored polls and users Closes #65 --- Brocfile.js | 4 ++++ app/controllers/poll.js | 3 ++- app/models/poll.js | 4 +++- app/models/user.js | 6 ++++-- app/routes/create.js | 3 ++- package.json | 1 + 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Brocfile.js b/Brocfile.js index 9c2b06f..7e5a562 100644 --- a/Brocfile.js +++ b/Brocfile.js @@ -5,6 +5,10 @@ var pickFiles = require('broccoli-static-compiler'); var trees = []; var app = new EmberApp({ + buildInfoOptions: { + metaTemplate: 'version={VERSION}-{COMMIT}' + }, + // do not fingerprint webshim fingerprint: { exclude: ['assets/shims'] diff --git a/app/controllers/poll.js b/app/controllers/poll.js index fd31a01..d64ea1e 100644 --- a/app/controllers/poll.js +++ b/app/controllers/poll.js @@ -50,7 +50,8 @@ export default Ember.ObjectController.extend(EmberValidations.Mixin, { name: user.name, creationDate: new Date(), poll: this.get('model'), - selections: user.selections + selections: user.selections, + version: this.buildInfo.version + '-' + this.buildInfo.commit }); // save new user diff --git a/app/models/poll.js b/app/models/poll.js index 9fc4e4e..e8f5076 100644 --- a/app/models/poll.js +++ b/app/models/poll.js @@ -38,6 +38,8 @@ export default DS.Model.extend({ encryptedTimezoneOffset : DS.attr('string'), timezoneOffset : Ember.computed.encrypted('encryptedTimezoneOffset', 'number'), + + version : DS.attr('string'), // computed properties isFindADate: function() { @@ -51,4 +53,4 @@ export default DS.Model.extend({ isMakeAPoll: function() { return this.get('pollType') === 'MakeAPoll'; }.property('pollType') -}); \ No newline at end of file +}); diff --git a/app/models/user.js b/app/models/user.js index 6a66bf3..d8e844e 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -13,5 +13,7 @@ export default DS.Model.extend({ selections : Ember.computed.encrypted('encryptedSelections', 'array'), encryptedCreationDate : DS.attr('string'), - creationDate : Ember.computed.encrypted('encryptedCreationDate', 'date') -}); \ No newline at end of file + creationDate : Ember.computed.encrypted('encryptedCreationDate', 'date'), + + version : DS.attr('string') +}); diff --git a/app/routes/create.js b/app/routes/create.js index ce5e1b5..d818941 100644 --- a/app/routes/create.js +++ b/app/routes/create.js @@ -17,7 +17,8 @@ export default Ember.Route.extend({ anonymousUser: false, datetime: false, datetimesInputFields: 2, - timezoneOffset: new Date().getTimezoneOffset() + timezoneOffset: new Date().getTimezoneOffset(), + version: this.buildInfo.version + '-' + this.buildInfo.commit }); } }); diff --git a/package.json b/package.json index a8d0687..c901832 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "ember-cli-app-version": "0.3.3", "ember-cli-babel": "^4.0.0", "ember-cli-bootstrap-datepicker": "git://github.com/soulim/ember-cli-bootstrap-datepicker.git#5cc3fdf114cece954cbb4af60c5584e362c1cdc3", + "ember-cli-build-info": "^0.1.0", "ember-cli-content-security-policy": "0.4.0", "ember-cli-dependency-checker": "0.0.8", "ember-cli-htmlbars": "0.7.4",