Created
September 6, 2012 21:49
-
-
Save springmeyer/3660613 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/commands/global.bones b/commands/global.bones | |
index b411ea2..bb56b3b 100644 | |
--- a/commands/global.bones | |
+++ b/commands/global.bones | |
@@ -32,5 +32,11 @@ Bones.Command.options['syncAccessToken'] = { | |
'default': defaults.syncAccessToken || '' | |
}; | |
+Bones.Command.options['verbose'] = { | |
+ 'title': 'verbose=on|off', | |
+ 'description': 'verbose logging', | |
+ 'default': defaults.verbose | |
+}; | |
+ | |
// Host option is unused. | |
delete Bones.Command.options.host; | |
diff --git a/commands/start.bones b/commands/start.bones | |
index 2e80f8b..e0addcd 100644 | |
--- a/commands/start.bones | |
+++ b/commands/start.bones | |
@@ -40,6 +40,12 @@ command.prototype.initialize = function(plugin, callback) { | |
// Set proxy env variable before spawning children | |
if (plugin.config.httpProxy) process.env.HTTP_PROXY = plugin.config.httpProxy; | |
+ console.log('verbose:' + plugin.config.verbose); | |
+ console.log(plugin.config); | |
+ if (plugin.config.verbose == 'on') process.env.NODE_ENV = 'development'; | |
+ else process.env.NODE_ENV = 'production'; | |
+ console.log(process.env.NODE_ENV) | |
+ | |
Bones.plugin.command = this; | |
Bones.plugin.children = {}; | |
process.title = 'tilemill'; | |
diff --git a/lib/config.defaults.json b/lib/config.defaults.json | |
index ffb7386..a8ebf55 100644 | |
--- a/lib/config.defaults.json | |
+++ b/lib/config.defaults.json | |
@@ -8,5 +8,6 @@ | |
"listenHost": "127.0.0.1", | |
"syncAPI": "http://api.tiles.mapbox.com", | |
"syncURL": "https://tiles.mapbox.com", | |
- "server": false | |
+ "server": false, | |
+ "verbose": "on" | |
} | |
diff --git a/models/Config.bones b/models/Config.bones | |
index fce5cbe..ed1b847 100644 | |
--- a/models/Config.bones | |
+++ b/models/Config.bones | |
@@ -14,6 +14,10 @@ model.prototype.schema = { | |
}, | |
'httpProxy': { | |
'type': 'string' | |
+ }, | |
+ 'verbose': { | |
+ 'type': 'string', | |
+ 'enum': ['on', 'off'], | |
} | |
} | |
}; | |
diff --git a/models/Config.server.bones b/models/Config.server.bones | |
index b338d2c..efe9e73 100644 | |
--- a/models/Config.server.bones | |
+++ b/models/Config.server.bones | |
@@ -19,6 +19,8 @@ models.Config.prototype.sync = function(method, model, success, error) { | |
break; | |
case 'read': | |
var data = _(Bones.plugin.config).clone(); | |
+ console.log('data read'); | |
+ console.log(data); | |
if (data.files.indexOf(process.env.HOME) === 0) | |
data.files = data.files.replace(process.env.HOME, '~'); | |
return success(data); | |
@@ -35,7 +37,8 @@ models.Config.prototype.sync = function(method, model, success, error) { | |
'updatesVersion', | |
'profile', | |
'guid', | |
- 'httpProxy' | |
+ 'httpProxy', | |
+ 'verbose' | |
]; | |
var data = _(model.toJSON()).reduce(function(memo, val, key) { | |
if (key === 'files') val = val.replace(/^~/, process.env.HOME); | |
@@ -52,6 +55,8 @@ models.Config.prototype.sync = function(method, model, success, error) { | |
// Catch & blow away invalid user JSON. | |
try { current = JSON.parse(current); } | |
catch (e) { current = {}; } | |
+ console.log('current :') | |
+ console.log(current); | |
data = _(current).extend(data); | |
fs.writeFile(paths.user, JSON.stringify(data, null, 2), this); | |
diff --git a/templates/Config._ b/templates/Config._ | |
index b156994..af78a6c 100644 | |
--- a/templates/Config._ | |
+++ b/templates/Config._ | |
@@ -64,6 +64,13 @@ | |
<% } %> | |
</li> | |
<% } %> | |
+ <li> | |
+ <label for='verbose'>Logging</label> | |
+ <input type='checkbox' name='verbose' <% if (get('verbose') == 'on') %>checked='checked'<% ; %> /> Use verbose logging | |
+ <div class='description'> | |
+ Check this to see more output in your logs about what TileMill processes are doing | |
+ </div> | |
+ </li> | |
<li class='buttons'> | |
<input type='submit' value='Saved' class='disabled' /> | |
</li> | |
diff --git a/views/Config.bones b/views/Config.bones | |
index b1ac118..9a98421 100644 | |
--- a/views/Config.bones | |
+++ b/views/Config.bones | |
@@ -3,6 +3,7 @@ view = Backbone.View.extend(); | |
view.prototype.events = { | |
'change input[name=updates]': 'updates', | |
'change input[name=profile]': 'profile', | |
+ 'change input[name=verbose]': 'verbose', | |
'change input[name=httpProxy]': 'proxy', | |
'keyup input[name=httpProxy]': 'proxy', | |
'keyup input[name=files]': 'files', | |
@@ -22,11 +23,13 @@ view.prototype.initialize = function(options) { | |
'disable', | |
'save', | |
'restart', | |
- 'proxy' | |
+ 'proxy', | |
+ 'verbose' | |
); | |
this.model.bind('change', this.changed); | |
this.model.bind('change:files', this.restart); | |
this.model.bind('change:httpProxy', this.restart); | |
+ this.model.bind('change:verbose', this.restart); | |
this.render(); | |
}; | |
@@ -64,6 +67,11 @@ view.prototype.profile = function(ev) { | |
this.model.set({profile: $(ev.currentTarget).is(':checked')}); | |
}; | |
+view.prototype.verbose = function(ev) { | |
+ var value = $(ev.currentTarget).is(':checked') ? 'on' : 'off'; | |
+ this.model.set({verbose: value}); | |
+}; | |
+ | |
view.prototype.disable = function(ev) { | |
this.model.set({ | |
'syncAccount': '', |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment