Skip to content

Commit fef363c

Browse files
Initial commit
0 parents  commit fef363c

14 files changed

+425
-0
lines changed

.editorconfig

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# This EditorConfig overrides any parent EditorConfigs
4+
root = true
5+
6+
# Default rules applied to all file types
7+
[*]
8+
9+
# No trailing spaces, newline at EOF
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
# 2 space indentation
15+
indent_style = space
16+
indent_size = 2
17+
18+
# JavaScript-specific settings
19+
[*.js]
20+
quote_type = single
21+
continuation_indent_size = 2
22+
curly_bracket_next_line = false
23+
indent_brace_style = BSD
24+
spaces_around_operators = true
25+
spaces_around_brackets = none

.gitattributes

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Convert all line endings to CRLF, so they work with Windows programs
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.txt text
7+
*.html text
8+
*.md text
9+
*.css text
10+
*.scss text
11+
*.min text
12+
*.js text
13+
*.json text
14+
*.config text
15+
*.xml text
16+
*.njsproj text
17+
*.java text
18+
*.sql text
19+
*.iml text
20+
*.svg text
21+
22+
# Declare files that will always have CRLF line endings on checkout.
23+
*.sln text eol=crlf
24+
25+
# Denote all files that are truly binary and should not be modified.
26+
*.png binary
27+
*.jpg binary
28+
*.jpeg binary
29+
30+
# Omit specific test files from being modified
31+
/tests/files/good/text.txt binary

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/*~
2+
**/._*
3+
**/.DS_Store
4+
npm-debug.log
5+
/.idea
6+
/coverage
7+
/node_modules

.jscsrc

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"excludeFiles": [
3+
"coverage/**",
4+
"node_modules/**"
5+
],
6+
"requireCurlyBraces": [
7+
"if",
8+
"else",
9+
"for",
10+
"while",
11+
"do",
12+
"try",
13+
"catch"
14+
],
15+
"requireOperatorBeforeLineBreak": true,
16+
"requireCamelCaseOrUpperCaseIdentifiers": true,
17+
"maximumLineLength": {
18+
"value": 120,
19+
"allowComments": true,
20+
"allowRegex": true
21+
},
22+
"validateIndentation": 2,
23+
"validateQuoteMarks": "'",
24+
25+
"disallowMultipleLineStrings": true,
26+
"disallowMixedSpacesAndTabs": true,
27+
"disallowTrailingWhitespace": true,
28+
"disallowSpaceAfterPrefixUnaryOperators": true,
29+
"disallowMultipleVarDecl": null,
30+
"disallowKeywordsOnNewLine": [],
31+
32+
"requireSpaceAfterKeywords": [
33+
"if",
34+
"else",
35+
"for",
36+
"while",
37+
"do",
38+
"switch",
39+
"return",
40+
"try",
41+
"catch"
42+
],
43+
"requireSpaceBeforeBinaryOperators": [
44+
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
45+
"&=", "|=", "^=", "+=",
46+
47+
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
48+
"|", "^", "&&", "||", "===", "==", ">=",
49+
"<=", "<", ">", "!=", "!=="
50+
],
51+
"requireSpaceAfterBinaryOperators": true,
52+
"requireSpacesInConditionalExpression": true,
53+
"requireSpaceBeforeBlockStatements": true,
54+
"requireSpacesInForStatement": true,
55+
"requireLineFeedAtFileEnd": true,
56+
"requireSpacesInFunctionExpression": {
57+
"beforeOpeningCurlyBrace": true
58+
},
59+
"disallowSpacesInAnonymousFunctionExpression": {
60+
"beforeOpeningRoundBrace": true
61+
},
62+
"disallowSpacesInsideObjectBrackets": "all",
63+
"disallowSpacesInsideArrayBrackets": "all",
64+
"disallowSpacesInsideParentheses": true,
65+
66+
"disallowMultipleLineBreaks": true,
67+
"disallowNewlineBeforeBlockStatements": true
68+
}

.jshintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/coverage
2+
/node_modules
3+
/tests

.jshintrc

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
// JSHint Configuration File
3+
// See http://jshint.com/docs/ for more details
4+
5+
"maxerr" : 500, // {int} Maximum error before stopping
6+
7+
// Enforcing
8+
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
9+
"camelcase" : true, // true: Identifiers must be in camelCase
10+
"curly" : true, // true: Require {} for every new block or scope
11+
"eqeqeq" : true, // true: Require triple equals (===) for comparison
12+
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
13+
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
14+
"indent" : 2, // {int} Number of spaces to use for indentation
15+
"latedef" : "nofunc", // true: Require variables/functions to be defined before being used
16+
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
17+
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
18+
"noempty" : true, // true: Prohibit use of empty blocks
19+
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
20+
"plusplus" : false, // true: Prohibit use of `++` & `--`
21+
"quotmark" : "single", // Quotation mark consistency:
22+
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
23+
"unused" : "vars", // true: Require all defined variables be used
24+
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
25+
"trailing" : true, // true: Prohibit trailing whitespaces
26+
"maxparams" : false, // {int} Max number of formal params allowed per function
27+
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
28+
"maxstatements" : false, // {int} Max number statements per function
29+
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
30+
"maxlen" : false, // {int} Max number of characters per line
31+
32+
// Relaxing
33+
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
34+
"boss" : true, // true: Tolerate assignments where comparisons would be expected
35+
"debug" : true, // true: Allow debugger statements e.g. browser breakpoints.
36+
"eqnull" : false, // true: Tolerate use of `== null`
37+
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
38+
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
39+
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
40+
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
41+
"expr" : true, // true: Tolerate `ExpressionStatement` as Programs
42+
"funcscope" : false, // true: Tolerate defining variables inside control statements"
43+
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
44+
"iterator" : false, // true: Tolerate using the `__iterator__` property
45+
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
46+
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
47+
"laxcomma" : false, // true: Tolerate comma-first style coding
48+
"loopfunc" : false, // true: Tolerate functions being defined in loops
49+
"multistr" : false, // true: Tolerate multi-line strings
50+
"proto" : false, // true: Tolerate using the `__proto__` property
51+
"scripturl" : false, // true: Tolerate script-targeted URLs
52+
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
53+
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
54+
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
55+
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
56+
"validthis" : false, // true: Tolerate using this in a non-constructor function
57+
58+
// Environments
59+
"browser" : false, // Web Browser (window, document, etc)
60+
"couch" : false, // CouchDB
61+
"devel" : false, // Development/debugging (alert, confirm, etc)
62+
"dojo" : false, // Dojo Toolkit
63+
"jquery" : false, // jQuery
64+
"mocha" : true, // Mocha
65+
"mootools" : false, // MooTools
66+
"node" : true, // Node.js
67+
"nonstandard" : true, // Widely adopted globals (escape, unescape, etc)
68+
"prototypejs" : false, // Prototype and Scriptaculous
69+
"rhino" : false, // Rhino
70+
"worker" : false, // Web Workers
71+
"wsh" : false, // Windows Scripting Host
72+
"yui" : false, // Yahoo User Interface
73+
74+
// Legacy
75+
"nomen" : false, // true: Prohibit dangling `_` in variables
76+
"onevar" : false, // true: Allow only one `var` statement per function
77+
"passfail" : false, // true: Stop on first error
78+
"white" : false, // true: Check against strict whitespace and indentation rules
79+
80+
// Custom Globals
81+
"globals": {
82+
"expect" : false, // Chai
83+
"sinon" : false // Sinon
84+
}
85+
86+
} // test

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/tests
2+
/.*

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Travis CI config
2+
# http://docs.travis-ci.com/user/languages/javascript-with-nodejs/
3+
sudo: false
4+
language: node_js
5+
node_js:
6+
- 'iojs'
7+
- '0.10'
8+
- '0.11'
9+
- '0.12'
10+
after_success:
11+
- cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js

.yo-rc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@bigstickcarpet/generator-npm": {
3+
"githubUsername": "BigstickCarpet",
4+
"tests": true,
5+
"env": {
6+
"node": true,
7+
"browser": false
8+
}
9+
}
10+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 James Messinger
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Swagger CLI
2+
============================
3+
#### Command-line tool to parse, validate, and host Swagger-based REST APIs
4+
5+
[![Build Status](https://img.shields.io/travis/BigstickCarpet/swagger-cli.svg)](https://travis-ci.org/BigstickCarpet/swagger-cli)
6+
[![Coverage Status](https://img.shields.io/coveralls/BigstickCarpet/swagger-cli.svg)](https://coveralls.io/r/BigstickCarpet/swagger-cli)
7+
[![Code Climate Score](https://img.shields.io/codeclimate/github/BigstickCarpet/swagger-cli.svg)](https://codeclimate.com/github/BigstickCarpet/swagger-cli)
8+
[![Dependencies](https://img.shields.io/david/BigstickCarpet/swagger-cli.svg)](https://david-dm.org/BigstickCarpet/swagger-cli)
9+
[![Inline docs](http://inch-ci.org/github/BigstickCarpet/swagger-cli.svg?branch=master&style=shields)](http://inch-ci.org/github/BigstickCarpet/swagger-cli)
10+
[![Downloads](https://img.shields.io/npm/dm/swagger-cli.svg)](https://www.npmjs.com/package/swagger-cli)
11+
12+
[![npm](http://img.shields.io/npm/v/swagger-cli.svg)](https://www.npmjs.com/package/swagger-cli)
13+
[![License](https://img.shields.io/npm/l/swagger-cli.svg)](LICENSE)
14+
15+
16+
Features
17+
--------------------------
18+
* Parse and validate Swagger 2.0 APIs in __JSON or YAML__ format
19+
* Supports multi-file APIs via `$ref` pointers
20+
* Bundle multiple Swagger files into one combined Swagger file
21+
* Built-in __HTTP server__ to serve your REST API &mdash; great for testing!
22+
* __Fully-functional mocks__ for every operation in your API, including data persistence &mdash; great for POCs and demos!
23+
24+
25+
Installation
26+
--------------------------
27+
Install using [npm](https://docs.npmjs.com/getting-started/what-is-npm). Install it globally (using the `-g` flag) to run it from any terminal window.
28+
29+
```bash
30+
npm install -g swagger-cli
31+
```
32+
33+
34+
Usage
35+
--------------------------
36+
```bash
37+
swagger <command> [options] <filename>
38+
39+
Commands:
40+
validate Parses and validates a Swagger file
41+
42+
dereference Dereferences all $ref pointers in a Swagger file
43+
44+
bundle Bundles multiple Swagger files into a single file
45+
46+
serve Serves a Swagger file via a built-in HTTP REST server
47+
48+
Options:
49+
-h, --help Show help for any command
50+
-v, --version Output the CLI version number
51+
```
52+
53+
54+
Contributing
55+
--------------------------
56+
I welcome any contributions, enhancements, and bug-fixes. [File an issue](https://github.com/BigstickCarpet/swagger-cli/issues) on GitHub and [submit a pull request](https://github.com/BigstickCarpet/swagger-cli/pulls).
57+
58+
#### Building/Testing
59+
To build/test the project locally on your computer:
60+
61+
1. __Clone this repo__<br>
62+
`git clone https://github.com/BigstickCarpet/swagger-cli.git`
63+
64+
2. __Install dependencies__<br>
65+
`npm install`
66+
67+
3. __Run the build script__<br>
68+
`npm run build`
69+
70+
4. __Run the unit tests__<br>
71+
`npm run mocha` (just the tests)<br>
72+
`npm test` (tests + code coverage)
73+
74+
75+
License
76+
--------------------------
77+
Swagger CLI is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.

lib/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
module.exports.sayHello = function() {
4+
return 'hello, world!';
5+
};
6+
7+
module.exports.sayGoodbye = function() {
8+
return 'bye';
9+
};
10+

0 commit comments

Comments
 (0)