diff --git a/README.md b/README.md index 174b362a0..087f6d0fc 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,28 @@ -oai +oas === -Creating Swagger / Open API Initiative files is hard. This makes it easier. +Creating Swagger / Open API Spec files is hard. This makes it easier. [![](https://cl.ly/1h271F1M1e2T/Untitled-2.png)](http://readme.io) Installation ------------ - npm install oai -g + npm install oas -g Usage ----- Go to a directory with your API, and type: - oai init + oas init It will walk you through how to document your API with Open API Initiave. Swagger Inline -------------- -Rather than trying to juggle one gigantic repo, `oai` uses something called +Rather than trying to juggle one gigantic repo, `oas` uses something called [swagger-inline](https://github.com/readmeio/swagger-inline). It lets you include a little swagger snippet in a comment above your code, and collects them all together into one Swagger file: @@ -54,7 +54,7 @@ Host your Swagger file Hosting Swagger files is hard! So, we have an online component that hosts your Swagger file for you. Just type the following to get a URL: - oai host + oas host This will upload your Swagger file and give you a URL you can use. diff --git a/api.js b/api.js index 844b4030c..aa739e168 100644 --- a/api.js +++ b/api.js @@ -31,7 +31,7 @@ exports.api = function(args, opts) { info.token = login.token; } catch(e) { console.log('You need to log in to do this!'.red); - console.log('Run ' + 'oai login'.yellow); + console.log('Run ' + 'oas login'.yellow); return process.exit(); } } @@ -110,7 +110,7 @@ exports.load = function(action) { } console.log('Action not found.'.red); - console.log('Type ' + 'oai help'.yellow + ' to see all commands'); + console.log('Type ' + 'oas help'.yellow + ' to see all commands'); process.exit(); }; diff --git a/lib/docs.js b/lib/docs.js new file mode 100644 index 000000000..fc22eb418 --- /dev/null +++ b/lib/docs.js @@ -0,0 +1,20 @@ +var utils = require('../utils'); + +exports.swagger = true; +exports.swaggerUrl = true; +exports.login = true; +exports.desc = "Host your docs on ReadMe"; +exports.category = "services"; + +exports.run = function(config, info) { + console.log(""); + console.log("Success! ".green + "You can now access your Swagger from the following publicly sharable URL:"); + console.log(""); + console.log(" " + info.swaggerUrl + "?docs"); + console.log(""); + console.log("To use in ReadMe for documentation, follow the URL for setup information."); + + utils.open(info.swaggerUrl + "?docs", info); + + process.exit(); +}; diff --git a/lib/help.js b/lib/help.js index 22dbc0676..cf2905bdc 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 oai"; +exports.desc = "Learn what you can do with oas"; exports.weight = 2; exports.run = function(config, info) { console.log(""); - console.log("Usage: oai [swagger url]"); + console.log("Usage: oas [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(" oai " + action) + " " + info.grey, + text: " $".grey + pad(" oas " + 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 " + "oai init".yellow + " to create your Swagger file."); + console.log("Run " + "oas init".yellow + " to create your Swagger file."); console.log(""); process.exit(); diff --git a/lib/init.js b/lib/init.js index 16b373d09..70ad7162c 100644 --- a/lib/init.js +++ b/lib/init.js @@ -151,9 +151,9 @@ exports.run = function(config, info) { console.log(''); console.log('For more information on this syntax, see https://github.com/readmeio/swagger-inline'); console.log(''); - console.log('To see what you can do with your API, type ' + 'oai help'.yellow + '.'); + console.log('To see what you can do with your API, type ' + 'oas help'.yellow + '.'); console.log(''); - console.log('To publish your OAI file, type ' + 'oai host'.yellow + '!'); + console.log('To publish your OAS file, type ' + 'oas host'.yellow + '!'); console.log(''); process.exit(); diff --git a/lib/manage.js b/lib/manage.js index 675345710..12be44d81 100644 --- a/lib/manage.js +++ b/lib/manage.js @@ -12,7 +12,7 @@ exports.run = function(config, info) { console.log("GRANT PUSH ACCESS".cyan); console.log("Run the following command to add them (must match their GitHub email):"); console.log(""); - console.log(" $ oai add user@email.com".grey); + console.log(" $ oas add user@email.com".grey); console.log(""); console.log(""); diff --git a/package.json b/package.json index fafd8b7db..8afe189b8 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,29 @@ { "author": "ReadMe (http://readme.io)", - "name": "oai", + "name": "oas", "description": "A collection of Open API Initiative (Swagger) tools", "bin": { - "oai": "index.js" + "oas": "index.js" }, "tags": [ "api", "apis", "swagger", "open api initiative", + "open api spec", "oai", + "oas", "apidoc", "microservice", "documentation" ], - "version": "0.6.1", + "version": "0.6.2", "repository": { "type": "git", - "url": "git://github.com/readmeio/oai.git" + "url": "git://github.com/readmeio/oas.git" }, "bugs": { - "url": "https://github.com/readmeio/oai/issues" + "url": "https://github.com/readmeio/oas/issues" }, "main": "index.js", "dependencies": { diff --git a/utils.js b/utils.js index 5608bf9ca..f89504902 100644 --- a/utils.js +++ b/utils.js @@ -33,7 +33,7 @@ exports.findSwagger = function(cb, opts) { if(!generatedSwagger['x-si-base']) { console.log("We couldn't find a Swagger file.".red); - console.log("Run " + "oai init".yellow + " to get started."); + console.log("Don't worry, it's easy to get started! Run " + "oas init".yellow + " to get started."); process.exit(); }