From d4737d655baf0b63858e5ff064b0565105b462e2 Mon Sep 17 00:00:00 2001 From: Will White Date: Wed, 21 Dec 2011 21:54:42 -0500 Subject: [PATCH] Move config to a json file inside .tilemill directory. --- _posts/0100-01-01-CHANGELOG.md | 2 +- _posts/docs/0201-01-01-upgrade.md | 2 +- _posts/docs/manual/0202-02-01-usage.md | 4 ++-- commands/start.bones | 6 ++++++ index.js | 2 +- models/Config.server.bones | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/_posts/0100-01-01-CHANGELOG.md b/_posts/0100-01-01-CHANGELOG.md index bc677994e..e0b7bdcd7 100644 --- a/_posts/0100-01-01-CHANGELOG.md +++ b/_posts/0100-01-01-CHANGELOG.md @@ -23,7 +23,7 @@ releases: - Centerpoint is included in exports if it is valid. - More resonable default zoom settings for new projects. - Added option to update to development builds. - - Moved preferences to `~/.tilemill.json`. + - Moved preferences to `~/.tilemill/config.json`. - Changed default server port to 20009. - Better logging/error reporting from export command. diff --git a/_posts/docs/0201-01-01-upgrade.md b/_posts/docs/0201-01-01-upgrade.md index b62a63580..98b0d7346 100644 --- a/_posts/docs/0201-01-01-upgrade.md +++ b/_posts/docs/0201-01-01-upgrade.md @@ -10,7 +10,7 @@ permalink: /docs/upgrade ### Location of preferences -TileMill settings are now located at `~/.tilemill.json`. If you are running TileMill as an Ubuntu service, this file will be located at `/usr/share/mapbox/.tilemill.json`. You must manually copy any customized settings to this location before starting TileMill. +TileMill settings are now located at `~/.tilemill/config.json`. If you are running TileMill as an Ubuntu service, this file will be located at `/usr/share/mapbox/.tilemill/config.json`. You must manually copy any customized settings to this location before starting TileMill. ### Port change diff --git a/_posts/docs/manual/0202-02-01-usage.md b/_posts/docs/manual/0202-02-01-usage.md index 41ef40fc5..d7d597d7f 100644 --- a/_posts/docs/manual/0202-02-01-usage.md +++ b/_posts/docs/manual/0202-02-01-usage.md @@ -17,7 +17,7 @@ TileMill for Mac OS X is meant to be run as a desktop-style application. - **Files** used by TileMill are in your user account's `Documents/MapBox` folder - **Logs** are viewable by choosing `Console` from the app's `Window` menu - **Preferences** are available from the application's main screen -- **Advanced preferences** can be changed by editing `~/.tilemill.json` +- **Advanced preferences** can be changed by editing `~/.tilemill/config.json` ## Ubuntu @@ -26,7 +26,7 @@ TileMill for Mac OS X is meant to be run as a desktop-style application. - **Files** used by TileMill are in your user account's `Documents/MapBox` folder - **Logs** are written to `~/.tilemill.log` - **Preferences** are available from the application's main screen -- **Advanced preferences** can be changed by editing `~/.tilemill.json` +- **Advanced preferences** can be changed by editing `~/.tilemill/config.json` ## Advanced preferences diff --git a/commands/start.bones b/commands/start.bones index a51cd23bf..7eb994f9e 100644 --- a/commands/start.bones +++ b/commands/start.bones @@ -38,6 +38,12 @@ commands['start'].prototype.bootstrap = function(plugin, callback) { var settings = Bones.plugin.config; settings.files = path.resolve(settings.files); + var configDir = path.join(process.env.HOME, '.tilemill'); + if (!path.existsSync(configDir)) { + console.warn('Creating configuration dir %s', configDir); + fsutil.mkdirpSync(configDir, 0755); + } + if (!path.existsSync(settings.files)) { console.warn('Creating files dir %s', settings.files); fsutil.mkdirpSync(settings.files, 0755); diff --git a/index.js b/index.js index eee4cf6a7..15f1aa9fc 100755 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ process.argv[0] = 'node'; // @TODO find a more elegant way to set a default for this value // upstream in bones. var path = require('path'); -var config = path.join(process.env.HOME, '.tilemill.json'); +var config = path.join(process.env.HOME, '.tilemill/config.json'); if (path.existsSync(config)) { var argv = require('bones/node_modules/optimist').argv; argv.config = argv.config || config; diff --git a/models/Config.server.bones b/models/Config.server.bones index b5b52b371..0f3e0131d 100644 --- a/models/Config.server.bones +++ b/models/Config.server.bones @@ -2,7 +2,7 @@ var fs = require('fs'); var path = require('path'); var Step = require('step'); var paths = { - user: path.join(process.env.HOME, '.tilemill.json'), + user: path.join(process.env.HOME, '.tilemill/config.json'), vendor: path.resolve(__dirname + '/../lib/config.defaults.json') };