Skip to content

Commit

Permalink
Clean things up
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoberger committed Dec 22, 2017
1 parent 4667d86 commit 9ecd670
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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();
};

Expand Down
2 changes: 1 addition & 1 deletion config/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cli": "rdme",
"host": {
"url": "http://readme.local:3000"
"url": "https://dash.readme.io"
}
}
8 changes: 4 additions & 4 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <command> [swagger url]");
console.log(`Usage: ${config.cli} <command> [swagger url]`);
var files = glob.sync(path.join(__dirname, "*"));

var categories = {
Expand All @@ -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,
});
}
Expand All @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions lib/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"microservice",
"documentation"
],
"version": "0.6.7",
"version": "0.6.9",
"repository": {
"type": "git",
"url": "git://github.com/readmeio/rdme.git"
Expand Down

0 comments on commit 9ecd670

Please sign in to comment.