Permalink
Browse files

split the config into production/development versions

  • Loading branch information...
nolanlawson committed Nov 13, 2013
1 parent 457791a commit fbd5e7c7081f0e6ef277eab9f6ca73d78bba3966
Showing with 50 additions and 14 deletions.
  1. +2 −1 .jshintrc
  2. +23 −4 Gruntfile.js
  3. +20 −0 app-config.json
  4. +3 −0 app/index.jade
  5. +2 −7 app/scripts/services/constants.js
  6. +0 −2 app/scripts/services/pouch.js
@@ -21,6 +21,7 @@
"globals": {
"angular" : false,
"_" : true,
"PouchDB" : true
"PouchDB" : true,
"AppConfig" : true
}
}
@@ -22,7 +22,26 @@ module.exports = function (grunt) {
options: {
pretty: true,
data : {
pkg : require('./package.json')
pkg : require('./package.json'),
config : require('./app-config.json').production
}
},
files: [
{
expand: true,
cwd: '<%= yeoman.app %>',
dest: '.tmp',
src: '{,*/}*.jade',
ext: '.html'
}
]
},
server: {
options: {
pretty: true,
data : {
pkg : require('./package.json'),
config : require('./app-config.json').development
}
},
files: [
@@ -55,7 +74,7 @@ module.exports = function (grunt) {
},
jade: {
files: ['<%= yeoman.app %>/{,*/}*.jade', '<%= yeoman.app %>/views/{,*/}*.jade'],
tasks: ['jade']
tasks: ['jade:server']
},
livereload: {
options: {
@@ -314,7 +333,7 @@ module.exports = function (grunt) {
},
concurrent: {
server: [
'jade',
'jade:server',
'coffee:dist',
'compass:server',
'copy:styles'
@@ -391,7 +410,7 @@ module.exports = function (grunt) {

grunt.registerTask('build', [
'clean:dist',
'jade',
'jade:dist',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
@@ -0,0 +1,20 @@
{
"development": {
"couchdb": {
"blocks_url" : "http://localhost:5984/block_summaries2",
"related_url" : "http://localhost:5984/related_blocks2",
"hints_url" : "http://localhost:5984/block_hints2",
"users_db_url" : "http://koholint-wired:5985"
},
"solr_url" : "http://localhost:8983/solr"
},
"production": {
"couchdb": {
"blocks_url" : "couchdb/block_summaries",
"related_url" : "couchdb/related_blocks",
"hints_url" : "couchdb/block_hints",
"users_db_url" : "couchdb"
},
"solr_url" : "solr"
}
}
@@ -68,7 +68,10 @@ html.no-js
script(src='bower_components/angular-sanitize/angular-sanitize.js')
script(src='bower_components/angular-strap/dist/angular-strap.js')
// endbuild
script.
var AppConfig = !{JSON.stringify(config)};
// build:js({.tmp,app}) scripts/scripts.js
script(src='scripts/app.js')
script(src='scripts/services/constants.js')
script(src='scripts/services/blocks.js')
@@ -8,18 +8,13 @@
*/
function ConstantsService() {

this.couchdb = {
blocks_url : 'http://localhost:5984/block_summaries2',
related_url : 'http://localhost:5984/related_blocks2',
hints_url : 'http://localhost:5984/block_hints2',
users_db_url : 'http://koholint-wired:5985'
};
this.solr_url = 'http://localhost:8983/solr';
this.maxNumRelated = 5;
this.pageSize = 10;
this.numColors = 16;
this.pouchRefreshInterval = 20000;
this.searchPageSize = 5;

_.extend(this, AppConfig);
}

angular.module('ultimate-crossword').service('constants', [ConstantsService]);
@@ -14,8 +14,6 @@ function PouchService(constants, $rootScope, $window) {
self.lastDocFromDb = {guesses : {}};
self.$rootScope = $rootScope;

console.log($window);

$window.onbeforeunload = function() {
if (self.isDirty()) {
self.updateGuesses();

0 comments on commit fbd5e7c

Please sign in to comment.