Merge pull request #157 from resin-io/jviotti/feature/settings-projects-dir

Make use of `projectsDirectory` SDK setting in Quickstart
This commit is contained in:
Juan Cruz Viotti 2015-08-17 09:20:30 -04:00
commit 713664d103
3 changed files with 12 additions and 18 deletions

View File

@ -1,5 +1,5 @@
(function() { (function() {
var Promise, _, async, capitano, form, mkdirp, path, resin, userHome, visuals; var Promise, _, async, capitano, form, mkdirp, resin, visuals;
_ = require('lodash'); _ = require('lodash');
@ -7,12 +7,8 @@
capitano = Promise.promisifyAll(require('capitano')); capitano = Promise.promisifyAll(require('capitano'));
path = require('path');
mkdirp = require('mkdirp'); mkdirp = require('mkdirp');
userHome = require('user-home');
visuals = require('resin-cli-visuals'); visuals = require('resin-cli-visuals');
async = require('async'); async = require('async');
@ -86,10 +82,12 @@
return capitano.run("device " + params.uuid, callback); return capitano.run("device " + params.uuid, callback);
}, function(callback) { }, function(callback) {
console.log('Your device is ready, lets start pushing some code!'); console.log('Your device is ready, lets start pushing some code!');
return form.ask({ return resin.settings.get('projectsDirectory').then(function(projectsDirectory) {
message: 'Please choose a directory for your code', return form.ask({
type: 'input', message: 'Please choose a directory for your code',
"default": path.join(userHome, 'ResinProjects', params.name) type: 'input',
"default": projectsDirectory
});
}).nodeify(callback); }).nodeify(callback);
}, function(directoryName, callback) { }, function(directoryName, callback) {
params.directory = directoryName; params.directory = directoryName;

View File

@ -1,9 +1,7 @@
_ = require('lodash') _ = require('lodash')
Promise = require('bluebird') Promise = require('bluebird')
capitano = Promise.promisifyAll(require('capitano')) capitano = Promise.promisifyAll(require('capitano'))
path = require('path')
mkdirp = require('mkdirp') mkdirp = require('mkdirp')
userHome = require('user-home')
visuals = require('resin-cli-visuals') visuals = require('resin-cli-visuals')
async = require('async') async = require('async')
resin = require('resin-sdk') resin = require('resin-sdk')
@ -97,12 +95,11 @@ exports.wizard =
(callback) -> (callback) ->
console.log('Your device is ready, lets start pushing some code!') console.log('Your device is ready, lets start pushing some code!')
form.ask resin.settings.get('projectsDirectory').then (projectsDirectory) ->
message: 'Please choose a directory for your code' form.ask
type: 'input' message: 'Please choose a directory for your code'
type: 'input'
# TODO: Move this to resin-settings-client. default: projectsDirectory
default: path.join(userHome, 'ResinProjects', params.name)
.nodeify(callback) .nodeify(callback)
(directoryName, callback) -> (directoryName, callback) ->

View File

@ -62,7 +62,6 @@
"resin-vcs": "^2.0.0", "resin-vcs": "^2.0.0",
"selfupdate": "^1.1.0", "selfupdate": "^1.1.0",
"underscore.string": "^3.1.1", "underscore.string": "^3.1.1",
"user-home": "^2.0.0",
"valid-email": "0.0.2" "valid-email": "0.0.2"
} }
} }