diff --git a/build/actions/app.js b/build/actions/app.js index ad26b6ad..ded7d71d 100644 --- a/build/actions/app.js +++ b/build/actions/app.js @@ -1,9 +1,5 @@ (function() { - var _, async, commandOptions, form, path, resin, vcs, visuals; - - path = require('path'); - - _ = require('lodash-contrib'); + var async, commandOptions, form, resin, vcs, visuals; async = require('async'); @@ -122,7 +118,7 @@ exports.associate = { signature: 'app associate ', description: 'associate a resin project', - help: 'Use this command to associate a project directory with a resin application.\n\nThis command adds a \'resin\' git remote to the directory and runs git init if necessary.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app associate MyApp\n $ resin app associate MyApp --project my/app/directory', + help: 'Use this command to associate a project directory with a resin application.\n\nThis command adds a \'resin\' git remote to the directory and runs git init if necessary.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app associate MyApp', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { @@ -166,39 +162,4 @@ } }; - exports.init = { - signature: 'init', - description: 'init an application', - help: 'Use this command to initialise a directory as a resin application.\n\nThis command performs the following steps:\n - Create a resin.io application.\n - Initialize the current directory as a git repository.\n - Add the corresponding git remote to the application.\n\nExamples:\n\n $ resin init\n $ resin init --project my/app/directory', - permission: 'user', - action: function(params, options, done) { - var currentDirectory; - currentDirectory = process.cwd(); - return async.waterfall([ - function(callback) { - var currentDirectoryBasename; - currentDirectoryBasename = path.basename(currentDirectory); - return form.ask({ - message: 'What is the name of your application?', - type: 'input', - "default": currentDirectoryBasename - }).nodeify(callback); - }, function(applicationName, callback) { - return exports.create.action({ - name: applicationName - }, options, function(error) { - if (error != null) { - return callback(error); - } - return callback(null, applicationName); - }); - }, function(applicationName, callback) { - return exports.associate.action({ - name: applicationName - }, options, callback); - } - ], done); - } - }; - }).call(this); diff --git a/build/actions/auth.js b/build/actions/auth.js index 15c3eaf8..4b3e6bb9 100644 --- a/build/actions/auth.js +++ b/build/actions/auth.js @@ -3,7 +3,7 @@ open = require('open'); - _ = require('lodash-contrib'); + _ = require('lodash'); url = require('url'); diff --git a/build/actions/device.js b/build/actions/device.js index 059bb2ab..4145dfe2 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -1,11 +1,9 @@ (function() { - var _, async, capitano, commandOptions, deviceConfig, drivelist, form, fse, htmlToText, image, inject, manager, os, path, pine, registerDevice, resin, tmp, vcs, visuals; - - fse = require('fs-extra'); + var _, async, capitano, commandOptions, deviceConfig, drivelist, form, htmlToText, image, inject, manager, os, path, pine, registerDevice, resin, vcs, visuals; capitano = require('capitano'); - _ = require('lodash-contrib'); + _ = require('lodash'); path = require('path'); @@ -27,8 +25,6 @@ pine = require('resin-pine'); - tmp = require('tmp'); - deviceConfig = require('resin-device-config'); form = require('resin-cli-form'); @@ -39,8 +35,6 @@ os = require('os'); - tmp.setGracefulCleanup(); - commandOptions = require('./command-options'); exports.list = { @@ -347,28 +341,6 @@ return resin.models.device.get(params.uuid).nodeify(callback); }, function(device, callback) { console.info("Device created: " + device.name); - return callback(null, device.name); - }, function(deviceName, callback) { - var instructions, osSpecificInstructions, platform, platformHash; - if (params.manifest.instructions == null) { - instructions = ''; - } - if (_.isArray(params.manifest.instructions)) { - instructions = htmlToText.fromString(params.manifest.instructions.join('\n')); - } - platformHash = { - darwin: 'osx', - linux: 'linux', - win32: 'windows' - }; - platform = platformHash[os.platform()]; - osSpecificInstructions = params.manifest.instructions[platform]; - if (osSpecificInstructions == null) { - instructions = ''; - } else { - instructions = htmlToText.fromString(osSpecificInstructions.join('\n')); - } - console.log('\n' + instructions); return callback(null, params.uuid); } ], done); diff --git a/build/actions/environment-variables.js b/build/actions/environment-variables.js index 343a4239..9ce944fd 100644 --- a/build/actions/environment-variables.js +++ b/build/actions/environment-variables.js @@ -3,7 +3,7 @@ async = require('async'); - _ = require('lodash-contrib'); + _ = require('lodash'); resin = require('resin-sdk'); diff --git a/build/actions/help.js b/build/actions/help.js index e5cd5ed2..99ffbad0 100644 --- a/build/actions/help.js +++ b/build/actions/help.js @@ -95,7 +95,9 @@ } console.log(getCommandHelp(command)); } - console.log('\nGlobal Options:\n'); + if (!_.isEmpty(capitano.state.globalOptions)) { + console.log('\nGlobal Options:\n'); + } options = _.map(capitano.state.globalOptions, function(option) { option.signature = buildOptionSignatureHelp(option); return option; diff --git a/build/actions/info.js b/build/actions/info.js index 2c36698e..f9512c7c 100644 --- a/build/actions/info.js +++ b/build/actions/info.js @@ -1,7 +1,5 @@ (function() { - var packageJSON, settings; - - settings = require('resin-settings-client'); + var packageJSON; packageJSON = require('../../package.json'); @@ -15,19 +13,4 @@ } }; - exports.config = { - signature: 'config', - description: 'see your current configuration', - help: 'See your current Resin CLI configuration.\n\nConfiguration lives in $HOME/.resin/config.', - action: function(params, options, done) { - var key, ref, value; - ref = settings.get(); - for (key in ref) { - value = ref[key]; - console.log(key + ": " + value); - } - return done(); - } - }; - }).call(this); diff --git a/build/actions/wizard.js b/build/actions/wizard.js index fd91fdff..cab755ff 100644 --- a/build/actions/wizard.js +++ b/build/actions/wizard.js @@ -1,7 +1,7 @@ (function() { var Promise, _, async, capitano, form, mkdirp, path, resin, userHome, visuals; - _ = require('lodash-contrib'); + _ = require('lodash'); Promise = require('bluebird'); @@ -97,7 +97,7 @@ }, function(made, callback) { console.log("Associating " + params.name + " with " + params.directory + "..."); process.chdir(params.directory); - return capitano.run("app associate " + params.name + " --project " + params.directory, callback); + return capitano.run("app associate " + params.name, callback); }, function(remoteUrl, callback) { console.log("Resin git remote added: " + remoteUrl); console.log('Please type "git push resin master" into your project directory now!'); diff --git a/build/app.js b/build/app.js index 9d6ec421..7c03c162 100644 --- a/build/app.js +++ b/build/app.js @@ -1,5 +1,5 @@ (function() { - var _, actions, async, capitano, changeProjectDirectory, errors, plugins, resin; + var _, actions, async, capitano, errors, plugins, resin; _ = require('lodash'); @@ -32,37 +32,8 @@ } }); - capitano.globalOption({ - signature: 'quiet', - description: 'quiet (no output)', - boolean: true, - alias: 'q' - }); - - capitano.globalOption({ - signature: 'project', - parameter: 'path', - description: 'project path', - alias: 'j' - }); - - capitano.globalOption({ - signature: 'version', - description: actions.info.version.description, - boolean: true, - alias: 'v' - }); - - capitano.globalOption({ - signature: 'no-color', - description: 'disable colour highlighting', - boolean: true - }); - capitano.command(actions.info.version); - capitano.command(actions.info.config); - capitano.command(actions.help.help); capitano.command(actions.wizard.wizard); @@ -85,8 +56,6 @@ capitano.command(actions.app.associate); - capitano.command(actions.app.init); - capitano.command(actions.app.info); capitano.command(actions.device.list); @@ -135,31 +104,13 @@ capitano.command(actions.plugin.remove); - changeProjectDirectory = function(directory) { - try { - return process.chdir(directory); - } catch (_error) { - return errors.handle(new Error("Invalid project: " + directory)); - } - }; - async.waterfall([ function(callback) { return plugins.register('resin-plugin-', callback); }, function(callback) { var cli; cli = capitano.parse(process.argv); - if (cli.global.quiet || !process.stdout.isTTY) { - console.info = _.noop; - } - if (cli.global.project != null) { - changeProjectDirectory(cli.global.project); - } - if (cli.global.version) { - return actions.info.version.action(null, null, callback); - } else { - return capitano.execute(cli, callback); - } + return capitano.execute(cli, callback); } ], errors.handle); diff --git a/doc/cli.markdown b/doc/cli.markdown index 2acf8aa2..7ca900f9 100644 --- a/doc/cli.markdown +++ b/doc/cli.markdown @@ -22,7 +22,6 @@ Now you have access to all the commands referenced below. - [app restart <name>](#app-restart-60-name-62-) - [app rm <name>](#app-rm-60-name-62-) - [app associate <name>](#app-associate-60-name-62-) - - [init](#init) - Authentication @@ -56,7 +55,6 @@ Now you have access to all the commands referenced below. - Information - [version](#version) - - [config](#config) - Keys @@ -165,7 +163,6 @@ You can avoid this by passing the `--yes` boolean option. Examples: $ resin app associate MyApp - $ resin app associate MyApp --project my/app/directory ### Options @@ -173,20 +170,6 @@ Examples: confirm non interactively -## init - -Use this command to initialise a directory as a resin application. - -This command performs the following steps: - - Create a resin.io application. - - Initialize the current directory as a git repository. - - Add the corresponding git remote to the application. - -Examples: - - $ resin init - $ resin init --project my/app/directory - # Authentication ## login [token] @@ -195,7 +178,7 @@ Use this command to login to your resin.io account. To login, you need your token, which is accesible from the preferences page: - https://dashboard.resin.io/preferences + https://dashboard.resinstaging.io/preferences Examples: @@ -517,12 +500,6 @@ Examples: Display the Resin CLI version. -## config - -See your current Resin CLI configuration. - -Configuration lives in $HOME/.resin/config. - # Keys ## keys diff --git a/lib/actions/app.coffee b/lib/actions/app.coffee index 9fa78e69..a0381dcc 100644 --- a/lib/actions/app.coffee +++ b/lib/actions/app.coffee @@ -1,5 +1,3 @@ -path = require('path') -_ = require('lodash-contrib') async = require('async') resin = require('resin-sdk') visuals = require('resin-cli-visuals') @@ -177,7 +175,6 @@ exports.associate = Examples: $ resin app associate MyApp - $ resin app associate MyApp --project my/app/directory ''' options: [ commandOptions.yes ] permission: 'user' @@ -217,47 +214,3 @@ exports.associate = return done(error) if error? console.info("git repository added: #{remoteUrl}") return done(null, remoteUrl) - -exports.init = - signature: 'init' - description: 'init an application' - help: ''' - Use this command to initialise a directory as a resin application. - - This command performs the following steps: - - Create a resin.io application. - - Initialize the current directory as a git repository. - - Add the corresponding git remote to the application. - - Examples: - - $ resin init - $ resin init --project my/app/directory - ''' - permission: 'user' - action: (params, options, done) -> - - currentDirectory = process.cwd() - - async.waterfall [ - - (callback) -> - currentDirectoryBasename = path.basename(currentDirectory) - form.ask - message: 'What is the name of your application?' - type: 'input' - default: currentDirectoryBasename - .nodeify(callback) - - (applicationName, callback) -> - - # TODO: Make resin.models.application.create return - # the whole application instead of just the id - exports.create.action name: applicationName, options, (error) -> - return callback(error) if error? - return callback(null, applicationName) - - (applicationName, callback) -> - exports.associate.action(name: applicationName, options, callback) - - ], done diff --git a/lib/actions/auth.coffee b/lib/actions/auth.coffee index dc82f3cf..d9b00ece 100644 --- a/lib/actions/auth.coffee +++ b/lib/actions/auth.coffee @@ -1,5 +1,5 @@ open = require('open') -_ = require('lodash-contrib') +_ = require('lodash') url = require('url') async = require('async') resin = require('resin-sdk') diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index a99947d5..af2de2f9 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -1,6 +1,5 @@ -fse = require('fs-extra') capitano = require('capitano') -_ = require('lodash-contrib') +_ = require('lodash') path = require('path') async = require('async') resin = require('resin-sdk') @@ -11,16 +10,12 @@ image = require('resin-image') inject = require('resin-config-inject') registerDevice = require('resin-register-device') pine = require('resin-pine') -tmp = require('tmp') deviceConfig = require('resin-device-config') form = require('resin-cli-form') drivelist = require('drivelist') htmlToText = require('html-to-text') os = require('os') -# Cleanup the temporary files even when an uncaught exception occurs -tmp.setGracefulCleanup() - commandOptions = require('./command-options') exports.list = @@ -423,28 +418,6 @@ exports.init = (device, callback) -> console.info("Device created: #{device.name}") - return callback(null, device.name) - - (deviceName, callback) -> - instructions = '' if not params.manifest.instructions? - - if _.isArray(params.manifest.instructions) - instructions = htmlToText.fromString(params.manifest.instructions.join('\n')) - - platformHash = - darwin: 'osx' - linux: 'linux' - win32: 'windows' - - platform = platformHash[os.platform()] - osSpecificInstructions = params.manifest.instructions[platform] - - if not osSpecificInstructions? - instructions = '' - else - instructions = htmlToText.fromString(osSpecificInstructions.join('\n')) - - console.log('\n' + instructions) return callback(null, params.uuid) ], done diff --git a/lib/actions/environment-variables.coffee b/lib/actions/environment-variables.coffee index 22a11e0e..c8d2a17b 100644 --- a/lib/actions/environment-variables.coffee +++ b/lib/actions/environment-variables.coffee @@ -1,5 +1,5 @@ async = require('async') -_ = require('lodash-contrib') +_ = require('lodash') resin = require('resin-sdk') visuals = require('resin-cli-visuals') commandOptions = require('./command-options') diff --git a/lib/actions/help.coffee b/lib/actions/help.coffee index 89bfb5f3..7c986249 100644 --- a/lib/actions/help.coffee +++ b/lib/actions/help.coffee @@ -67,7 +67,8 @@ general = -> continue if command.isWildcard() console.log(getCommandHelp(command)) - console.log('\nGlobal Options:\n') + if not _.isEmpty(capitano.state.globalOptions) + console.log('\nGlobal Options:\n') options = _.map capitano.state.globalOptions, (option) -> option.signature = buildOptionSignatureHelp(option) diff --git a/lib/actions/info.coffee b/lib/actions/info.coffee index 0df502fb..33fd61e2 100644 --- a/lib/actions/info.coffee +++ b/lib/actions/info.coffee @@ -1,4 +1,3 @@ -settings = require('resin-settings-client') packageJSON = require('../../package.json') exports.version = @@ -10,16 +9,3 @@ exports.version = action: (params, options, done) -> console.log(packageJSON.version) return done() - -exports.config = - signature: 'config' - description: 'see your current configuration' - help: ''' - See your current Resin CLI configuration. - - Configuration lives in $HOME/.resin/config. - ''' - action: (params, options, done) -> - for key, value of settings.get() - console.log("#{key}: #{value}") - return done() diff --git a/lib/actions/wizard.coffee b/lib/actions/wizard.coffee index 79af3ce9..a3c482bc 100644 --- a/lib/actions/wizard.coffee +++ b/lib/actions/wizard.coffee @@ -1,4 +1,4 @@ -_ = require('lodash-contrib') +_ = require('lodash') Promise = require('bluebird') capitano = Promise.promisifyAll(require('capitano')) path = require('path') @@ -112,7 +112,7 @@ exports.wizard = (made, callback) -> console.log("Associating #{params.name} with #{params.directory}...") process.chdir(params.directory) - capitano.run("app associate #{params.name} --project #{params.directory}", callback) + capitano.run("app associate #{params.name}", callback) (remoteUrl, callback) -> console.log("Resin git remote added: #{remoteUrl}") diff --git a/lib/app.coffee b/lib/app.coffee index c504ee2c..bc6f5f05 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -17,36 +17,8 @@ capitano.command action: -> capitano.execute(command: 'help') -# ---------- Options ---------- -capitano.globalOption - signature: 'quiet' - description: 'quiet (no output)' - boolean: true - alias: 'q' - -capitano.globalOption - signature: 'project' - parameter: 'path' - description: 'project path' - alias: 'j' - -capitano.globalOption - signature: 'version' - description: actions.info.version.description - boolean: true - alias: 'v' - -# We don't do anything in response to this options -# explicitly. We use InquirerJS to provide CLI widgets, -# and that module understands --no-color automatically. -capitano.globalOption - signature: 'no-color' - description: 'disable colour highlighting' - boolean: true - # ---------- Info Module ---------- capitano.command(actions.info.version) -capitano.command(actions.info.config) # ---------- Help Module ---------- capitano.command(actions.help.help) @@ -66,7 +38,6 @@ capitano.command(actions.app.list) capitano.command(actions.app.remove) capitano.command(actions.app.restart) capitano.command(actions.app.associate) -capitano.command(actions.app.init) capitano.command(actions.app.info) # ---------- Device Module ---------- @@ -106,12 +77,6 @@ capitano.command(actions.plugin.install) capitano.command(actions.plugin.update) capitano.command(actions.plugin.remove) -changeProjectDirectory = (directory) -> - try - process.chdir(directory) - catch - errors.handle(new Error("Invalid project: #{directory}")) - async.waterfall([ (callback) -> @@ -119,16 +84,6 @@ async.waterfall([ (callback) -> cli = capitano.parse(process.argv) - - if cli.global.quiet or not process.stdout.isTTY - console.info = _.noop - - if cli.global.project? - changeProjectDirectory(cli.global.project) - - if cli.global.version - actions.info.version.action(null, null, callback) - else - capitano.execute(cli, callback) + capitano.execute(cli, callback) ], errors.handle) diff --git a/package.json b/package.json index ff7e7515..cb22770f 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,9 @@ "bluebird": "^2.9.34", "capitano": "~1.6.1", "coffee-script": "^1.9.3", - "conf.js": "^0.1.1", "drivelist": "^1.2.2", - "fs-extra": "^0.22.1", "html-to-text": "^1.3.1", "lodash": "^3.10.0", - "lodash-contrib": "^393.0.1", "mkdirp": "~0.5.0", "nplugm": "^2.2.0", "npm": "^2.13.0", @@ -67,10 +64,7 @@ "resin-settings-client": "^1.4.0", "resin-vcs": "^2.0.0", "selfupdate": "^1.1.0", - "through2": "^2.0.0", - "tmp": "0.0.26", "underscore.string": "^3.1.1", - "update-notifier": "^0.3.1", "user-home": "^2.0.0" } }