diff --git a/api.js b/api.js index c2965a0e2..62d5d3469 100644 --- a/api.js +++ b/api.js @@ -16,7 +16,7 @@ exports.api = function(args, opts) { var config = utils.config(opts.env); // a file name will always have a "." - if (action.indexOf('.') >= 0) { + if (action && action.indexOf('.') >= 0) { action = 'push'; opts['in'] = args[0]; } @@ -115,7 +115,7 @@ exports.load = function(action) { } console.log('Action not found.'.red); - console.log('Type ' + 'oas help'.yellow + ' to see all commands'); + console.log('Type ' + `${config.cli} help`.yellow + ' to see all commands'); process.exit(); }; diff --git a/config/config.json b/config/config.json index c4d638d97..4ab5d758b 100644 --- a/config/config.json +++ b/config/config.json @@ -1,6 +1,6 @@ { "cli": "rdme", "host": { - "url": "http://readme.local:3000" + "url": "https://dash.readme.io" } } diff --git a/lib/help.js b/lib/help.js index cf2905bdc..8fc0d37cc 100644 --- a/lib/help.js +++ b/lib/help.js @@ -5,12 +5,12 @@ var _ = require('lodash'); exports.swagger = false; exports.login = false; exports.category = "basic"; -exports.desc = "Learn what you can do with oas"; +exports.desc = 'Learn what you can do with this tool'; exports.weight = 2; exports.run = function(config, info) { console.log(""); - console.log("Usage: oas [swagger url]"); + console.log(`Usage: ${config.cli} [swagger url]`); var files = glob.sync(path.join(__dirname, "*")); var categories = { @@ -35,7 +35,7 @@ exports.run = function(config, info) { if(f.category) { categories[f.category].commands.push({ - text: " $".grey + pad(" oas " + action) + " " + info.grey, + text: " $".grey + pad(` ${config.cli} ${action}`) + " " + info.grey, weight: f.weight, }); } @@ -51,7 +51,7 @@ exports.run = function(config, info) { console.log(""); console.log("Just getting started?".green); - console.log("Run " + "oas init".yellow + " to create your Swagger file."); + console.log("Run " + `${config.cli} init`.yellow + " to create your Swagger file."); console.log(""); process.exit(); diff --git a/lib/push.js b/lib/push.js index 8c482b8f9..b8da0fcc3 100644 --- a/lib/push.js +++ b/lib/push.js @@ -9,19 +9,22 @@ exports.category = "services"; exports.run = function(config, info) { var form = { token: info.opts.token, - swagger: info.swagger, + swagger: JSON.stringify(info.swagger), }; - console.log(info.opts.token); request.post(`${config.host.url}/cli/swagger`, { json: true, form: form }, function(a, b, data) { if (data.success) { console.log(""); - console.log("Success! ".green + "You can now access your Swagger from the following publicly sharable URL:"); + console.log("Success! ".green); + // TODO: Link to the docs here + /* console.log(""); console.log(" " + info.swaggerUrl); console.log(""); console.log("You can also use .yaml to get the YAML representation.".grey); + */ } else { - console.log("NO"); + console.log(data) + console.error("There was an error uploading!".red); } process.exit(); diff --git a/lib/start.js b/lib/start.js index 1548e56ba..be1cd1b6a 100644 --- a/lib/start.js +++ b/lib/start.js @@ -7,7 +7,7 @@ exports.weight = 2; exports.run = function(config, info) { console.log('Welcome to the OpenAPI/Swagger uploader for ReadMe!'); console.log(''); - console.log('Have a Swagger file? ' + `${config.cli} push [project] [swagger file]`.yellow); + console.log('Have a Swagger file? ' + `${config.cli} swagger.json --token=[token]`.yellow); console.log('Need a Swagger file? ' + `${config.cli} init`.yellow); process.exit(); }; diff --git a/package.json b/package.json index 35890b4a9..eb78bb496 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "microservice", "documentation" ], - "version": "0.6.7", + "version": "0.6.9", "repository": { "type": "git", "url": "git://github.com/readmeio/rdme.git"