diff --git a/lib/cmd.js b/lib/cmd.js index d59c3f1e..c78c2642 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -191,17 +191,17 @@ class Cmd { upload() { program - .command('upload [environment]') + .command('upload [environment]') .option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') .option('--locale [locale]', __('language to use (default: en)')) .description(__('Upload your dapp to a decentralized storage') + ' (e.g embark upload ipfs).') - .action(function (platform, env, _options) { + .action(function (env, _options) { i18n.setOrDetectLocale(_options.locale); _options.env = env || 'development'; _options.logFile = _options.logfile; // fix casing _options.logLevel = _options.loglevel; // fix casing - embark.upload(platform, _options); + embark.upload(_options); }); } diff --git a/lib/i18n/locales/en.json b/lib/i18n/locales/en.json index da47b60b..921a6592 100644 --- a/lib/i18n/locales/en.json +++ b/lib/i18n/locales/en.json @@ -3,6 +3,7 @@ "Contract Name": "Contract Name", "New Application": "New Application", "create a barebones project meant only for contract development": "create a barebones project meant only for contract development", + "language to use (default: en)": "language to use (default: en)", "create a working dapp with a SimpleStorage contract": "create a working dapp with a SimpleStorage contract", "filename to output logs (default: none)": "filename to output logs (default: none)", "level of logging to display": "level of logging to display", @@ -25,6 +26,9 @@ "custom gas limit (default: %s)": "custom gas limit (default: %s)", "run tests": "run tests", "resets embarks state on this dapp including clearing cache": "resets embarks state on this dapp including clearing cache", + "Graph will not include undeployed contracts": "Graph will not include undeployed contracts", + "Graph will not include functions": "Graph will not include functions", + "Graph will not include events": "Graph will not include events", "generates documentation based on the smart contracts configured": "generates documentation based on the smart contracts configured", "Upload your dapp to a decentralized storage": "Upload your dapp to a decentralized storage", "output the version number": "output the version number", @@ -38,7 +42,12 @@ "dashboard start": "dashboard start", "loaded plugins": "loaded plugins", "loading solc compiler": "loading solc compiler", + "Cannot upload: {{platform}} node is not running on {{url}}.": "Cannot upload: {{platform}} node is not running on {{url}}.", + "http:// Cannot upload: {{platform}} node is not running on {{url}}.": "http:// Cannot upload: {{platform}} node is not running on {{url}}.", + "Cannot upload:": "Cannot upload:", + "node is not running on": "node is not running on", "compiling solidity contracts": "compiling solidity contracts", + "Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.": "Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.", "%s doesn't have a compatible contract compiler. Maybe a plugin exists for it.": "%s doesn't have a compatible contract compiler. Maybe a plugin exists for it.", "assuming %s to be an interface": "assuming %s to be an interface", "{{className}}: couldn't find instanceOf contract {{parentContractName}}": "{{className}}: couldn't find instanceOf contract {{parentContractName}}", @@ -70,15 +79,15 @@ "to immediatly exit (alias: exit)": "to immediatly exit (alias: exit)", "The web3 object and the interfaces for the deployed contracts and their methods are also available": "The web3 object and the interfaces for the deployed contracts and their methods are also available", "versions in use": "versions in use", - "language to use (default: en)": "language to use (default: en)", "executing": "executing", + "finished deploying": "finished deploying", "writing file": "writing file", "errors found while generating": "errors found while generating", + "deploying to swarm!": "deploying to swarm!", + "adding %s to swarm": "adding %s to swarm", + "error uploading to swarm": "error uploading to swarm", "Looking for documentation? You can find it at": "Looking for documentation? You can find it at", "Ready": "Ready", - "Graph will not include undeployed contracts": "Graph will not include undeployed contracts", - "Graph will not include functions": "Graph will not include functions", - "Graph will not include events": "Graph will not include events", "Embark Blockchain Using: %s": "Embark Blockchain Using: %s", "running: %s": "running: %s", "Initializing Embark Template....": "Initializing Embark Template....", @@ -96,7 +105,7 @@ "help": "help", "quit": "quit", "Error Compiling/Building contracts: ": "Error Compiling/Building contracts: ", - "file not found, creating it...": "file not found, creating it..." + "file not found, creating it...": "file not found, creating it...", "{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}": "{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}", "downloading {{packageName}} {{version}}....": "downloading {{packageName}} {{version}}....", "Swarm node is offline...": "Swarm node is offline...", diff --git a/lib/index.js b/lib/index.js index 3ee5d90f..1a38757e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -288,7 +288,7 @@ class Embark { resetCmd(); } - upload(platform, options) { + upload(options) { this.context = options.context || [constants.contexts.upload, constants.contexts.build]; @@ -307,6 +307,8 @@ class Embark { }); engine.init(); + let platform = engine.config.storageConfig.provider; + let cmdPlugin; async.waterfall([ @@ -334,7 +336,7 @@ class Embark { } checkFn.fn(function (serviceCheckResult) { if (!serviceCheckResult.status || serviceCheckResult.status === 'off') { - return callback({message: __('Cannot upload: {{platform}} node is not running on {{url}}.', {platform: platform, url: `http://${engine.config.storageConfig.host}:${engine.config.storageConfig.port}`})}); + return callback({message: __('Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.', {platform: platform, protocol: engine.config.storageConfig.protocol, host: engine.config.storageConfig.host, port: engine.config.storageConfig.port})}); } callback(); });