Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
light it up
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo committed Mar 28, 2015
0 parents commit f8ed845
Show file tree
Hide file tree
Showing 40 changed files with 2,848 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# IDE files
.idea

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Users Environment Variables
.lock-wscript
24 changes: 24 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bitwise":true,
"curly":true,
"eqeqeq":true,
"forin":true,
"newcap":true,
"noarg":true,
"noempty":true,
"nonew":true,
"undef":true,
"strict":true,
"node":true,
"indent":2,
"expr":true,
"globals" : {
/* MOCHA */
"describe" : false,
"it" : false,
"before" : false,
"beforeEach" : false,
"after" : false,
"afterEach" : false
}
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "0.12"
- "0.10"
- "iojs"
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/****************************************************************************
The MIT License (MIT)

Copyright (c) 2014 Apigee Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
135 changes: 135 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# swagger-node reference

This is the installation guide and command reference for `swagger`, the command-line interface for swagger-node.

* Prerequisites
* Installation
* Commands

# Prerequisites

* [Node.js](http://nodejs.org/download/) (v0.10.24+)
* [npm](https://docs.npmjs.com/getting-started/installing-node) (v1.3.0+)

# Installation

You can install `swagger-node` either through npm or by cloning and linking the code from GitHub.
This document covers the installation details for installing from npm.

## Installation from npm

The `swagger-node` module and its dependencies are designed for Node.js and is available through npm.

### Linux / Mac from a Terminal Window:

sudo npm install -g swagger-node

NOTE: `sudo` may or may not be required with the `-g` option depending on your configuration. If you do not
use `-g`, you may need to add the `swagger-node/bin` directory to your PATH manually. On unix-based machines
the bin directory will often be found here: `/usr/local/lib/node_modules/swagger-node/bin`.

### Windows, from a Command Prompt:

npm install -g swagger-node

# Command reference

To print a list of valid commands, just run `swagger` with no options or -h:

$ swagger -h

Usage: swagger [options] [command]


Commands:

project <action> project actions
docs open Swagger documentation
help [cmd] display help for [cmd]

Options:

-h, --help output usage information
-V, --version output the version number

docs links:

* [project](#project)
* [docs](#docs)

## project

Create and manage swagger-node projects on your local machine.

$ swagger project -h

Usage: swagger-project [options] [command]

Commands:

create <name> Create a folder containing a Swagger project
start [options] [directory] Start the project in this or the specified directory
verify [options] [directory] Verify that the project is correct (swagger, config, etc.)
edit [options] [directory] open Swagger editor for this project
open [directory] open browser as client to the project
test [options] [directory_or_file] Run project tests

docs links:

* [create](#create)
* [start](#start)
* [verify](#verify)
* [edit](#edit)
* [open](#open)
* [test](#test)

### create

Create a new swagger-node project with the given name in a folder of the same name.

### start

Start the API server in the directory you are in - or, optionally, another directory. The server
will automatically restart when you make changes to the project.

$ swagger project start -h

Usage: start [options] [directory]

Start the project in this or the specified directory

Options:

-h, --help output usage information
-d, --debug <port> start in remote debug mode
-b, --debug-brk <port> start in remote debug mode, wait for debugger connect
-m, --mock start in mock mode
-o, --open open browser as client to the project

`-debug` and `-debug-brk` will start the project in debug mode so that you can connect to it via a debugger.

`-mock` will choose controllers from your mock directory instead of your controllers directory. If you have
no controller defined in the mock directory, the system will generate an appropriate response for you based on
the modules you have defined in your Swagger.

`-open` will start the app and then open a browser as a client to it.

### verify

Verify the project's swagger.

### edit

Open the project in the swagger-editor in your default browser.

### open

Open your default browser as a client of the project.

### test

Run the tests for your project using mocha.

## docs

Opens the Swagger 2.0 documentation web page in your default browser.
52 changes: 52 additions & 0 deletions bin/swagger
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env node
/****************************************************************************
The MIT License (MIT)
Copyright (c) 2015 Apigee Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
'use strict';

var app = require('commander');
var browser = require('../lib/util/browser');

app.version(require('../lib/util/cli').version());

app
.command('project <action>', 'project actions');

app
.command('docs')
.description('open Swagger documentation')
.action(function() {
browser.open('https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md', function() {
process.exit(0);
});
});

app.parse(process.argv);

if (!app.runningCommand) {
if (app.args.length > 0) {
console.log();
console.log('error: invalid command: ' + app.args[0]);
}
app.help();
}
72 changes: 72 additions & 0 deletions bin/swagger-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env node
/****************************************************************************
The MIT License (MIT)
Copyright (c) 2015 Apigee Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
'use strict';

var app = require('commander');
var project = require('../lib/commands/project/project');
var cli = require('../lib/util/cli');
var execute = cli.execute;

app
.command('create <name>')
.description('Create a folder containing a Swagger project')
.action(execute(project.create));

app
.command('start [directory]')
.description('Start the project in this or the specified directory')
.option('-d, --debug <port>', 'start in remote debug mode')
.option('-b, --debug-brk <port>', 'start in remote debug mode, wait for debugger connect')
.option('-m, --mock', 'start in mock mode')
.option('-o, --open', 'open browser as client to the project')
.action(execute(project.start));

app
.command('verify [directory]')
.description('Verify that the project is correct (swagger, config, etc)')
.option('-j, --json', 'output as JSON')
.action(execute(project.verify));

app
.command('edit [directory]')
.description('open Swagger editor for this project or the specified project directory')
.option('-s --silent', 'do not open the browser')
.action(execute(project.edit));

app
.command('open [directory]')
.description('open browser as client to the project')
.action(execute(project.open));

app
.command('test [directory_or_file]')
.description('Run project tests')
.option('-d, --debug [port]', 'start in remote debug mode')
.option('-b, --debug-brk [port]', 'start in remote debug mode, wait for debugger connect')
.option('-m, --mock', 'run in mock mode')
.action(execute(project.test));

app.parse(process.argv);
cli.validate(app);
10 changes: 10 additions & 0 deletions config/editor-branding/branding.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.a127 .branding.left {
float: left;
}
.a127 .branding.left .logo {
width: 75px;
padding: 5px;
}
.a127 .branding.right {
float: right;
}
5 changes: 5 additions & 0 deletions config/editor-branding/left.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="left branding">
<a href="http://a127.io" target="_blank">
<img class="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXMAAACRCAMAAAAGn6idAAAA7VBMVEX////v2tbX2NnY2Nnv2tbP0NHQ0NHoyMLHyMnIyMroyMK/wMLAwcLjurC3uLq4ubrfqqDfq6Dku7KvsLKwsbPjurDcnpGnqKqoqavbnZCfoaOgoaPfqqDfq6DZkILZkICXmZuYmZzXg3HXhXLcnpGPkZOQkZTbnZDWeGTXeWSHiYyIiYzXbljXcFjZkIKAgoXZkIDZZk7ZZU3bXkLbX0PXg3HXhXLfVzrfVjnjUjHkUTDWeGTXeWToSynpTCn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QaX/Ejpkl34Z6ydMx3NBJJXO/+7tFFaF3zfOFD5EZJ3+OVfJu8wZvCOqQAhUrJZelAJ2fGMcVt3kjjFpsHVwsyLjfbrL6Ls/v+lTNcZ/NIipTyXwgngOpMRzBoHPrh8gUC6me7CwTp/PaCGj82/av5z0qTqdMb4yjjxaJ1KIlMvpH5z8oWxcnB+s1tnv96l1RN9FHQjJCVsCma20DsTkhh94YRyniOMO1eG/kzA4T2wrmcQAAAAASUVORK5CYII=" alt="">
</a>
</div>
3 changes: 3 additions & 0 deletions config/editor-branding/right.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="right branding">

</div>
Loading

0 comments on commit f8ed845

Please sign in to comment.