apiaryio 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,81 +1,170 @@
1
- apiaryio
2
- =============
1
+ Apiary CLI Client
2
+ =================
3
3
 
4
- Apiary.io CLI
4
+ [Apiary](https://apiary.io) CLI client, `apiary`.
5
5
 
6
6
  [![Build Status](https://travis-ci.org/apiaryio/apiary-client.png?branch=master)](https://travis-ci.org/apiaryio/apiary-client) [![Build status](https://ci.appveyor.com/api/projects/status/0hmkivbnhf9p3f8d/branch/master?svg=true)](https://ci.appveyor.com/project/Apiary/apiary-client/branch/master)
7
7
 
8
+ ## Description
9
+
10
+ The Apiary CLI Client gem is a command line tool for developing and previewing
11
+ [API Blueprint](http://apiblueprint.org) documents locally. It can also be
12
+ used for pushing updated documents to and fetching existing documents from
13
+ [Apiary](http://apiary.io).
14
+
15
+
16
+ Please see the `apiary help` command and the [full documentation](http://client.apiary.io) for an in-depth look in how to use this tool.
17
+
18
+ For instructions on making your own changes, see [Hacking Apiary CLI Client](#hacking-apiary-cli-client), below.
19
+
20
+ ## Installation
8
21
 
9
- ## Install
22
+ ### Install as a Ruby gem
10
23
 
11
- **install gem** (required)
12
- ``` bash
24
+ ``` sh
13
25
  gem install apiaryio
14
26
  ```
15
27
 
16
- **setup APIARY.io credentials** (required for publish and fetch command only)
28
+ ### Setup Apiary credentials
17
29
 
18
- 1. Retrieve APIKEY on `https://login.apiary.io/tokens`
19
- 2. Save it to your environment variables :
30
+ *Required only for publish and fetch commands.*
20
31
 
21
- ```bash
22
- export APIARY_API_KEY=<your_token_retrieved_on_step_1>
32
+
33
+ 1. Make sure you are a registered user of [Apiary](http://apiary.io).
34
+ 2. Retrieve API key (token) on [this page](https://login.apiary.io/tokens).
35
+ 3. Export it as an environment variable:
36
+
37
+ ```sh
38
+ export APIARY_API_KEY=<your_token>
23
39
  ```
40
+ ## Command-line Usage
24
41
 
25
- ## Description
42
+ ```
43
+ $ apiary help
44
+ Commands:
45
+ apiary fetch --api-name=API_NAME # Fetch apiary.apib from API_NAME.apiary.io
46
+ apiary help [COMMAND] # Describe available commands or one specific command
47
+ apiary preview # Show API documentation in default browser
48
+ apiary publish --api-name=API_NAME # Publish apiary.apib on docs.API_NAME.apiary.io
49
+ apiary version # Show version
26
50
 
27
- The Apiary CLI gem is a command line tool for developing and previewing
28
- API Blueprint documents locally. It can also be used for pushing
29
- updated documents to and fetching existing documents from Apiary.io.
51
+ ```
30
52
 
31
- Please see the [full documentation](http://client.apiary.io) for an in-depth
32
- look in how to use this tool.
53
+ ### Details
33
54
 
34
- ## Usage
55
+ #### fetch
35
56
 
36
- $ apiary help
57
+ ```
58
+ $ apiary help fetch
59
+ Usage:
60
+ apiary fetch --api-name=API_NAME
37
61
 
38
- Usage: apiary command [options]
39
- Try 'apiary help' for more information.
62
+ Options:
63
+ --api-name=API_NAME
64
+ [--api-host=HOST] # Specify apiary host
65
+ [--output=FILE] # Write apiary.apib into specified file
40
66
 
41
- Currently available apiary commands are:
67
+ Fetch apiary.apib from API_NAME.apiary.io
68
+ ```
69
+
70
+ #### preview
42
71
 
43
- preview Show API documentation in default browser
44
- preview --browser [chrome|safari|firefox] Show API documentation in specified browser
45
- preview --output [FILE] Write generated HTML into specified file
46
- preview --path [PATH] Specify path to blueprint file
47
- preview --api_host [HOST] Specify apiary host
48
- preview --server Start standalone web server on port 8080
49
- preview --server --port [PORT] Start standalone web server on specified port
50
- publish --api-name [API_NAME] Publish apiary.apib on docs.API_NAME.apiary.io
51
- publish --api-name [API_NAME] \
52
- --message [COMMIT_MESSAGE] Publish with custom commit message
53
- fetch --api-name [API_NAME] Fetch apiary.apib from API_NAME.apiary.io
54
- --output [FILE] Write apiary.apib into specified file
55
- help Show this help
56
- version Show version
72
+ ```
73
+ $ apiary help preview
74
+ Usage:
75
+ apiary preview
76
+
77
+ Options:
78
+ [--browser=chrome|safari|firefox] # Show API documentation in specified browser
79
+ # Possible values: chrome, safari, firefox
80
+ [--output=FILE] # Write generated HTML into specified file
81
+ [--path=PATH] # Specify path to blueprint file
82
+ # Default: apiary.apib
83
+ [--api-host=HOST] # Specify apiary host
84
+ [--server], [--no-server] # Start standalone web server on port 8080
85
+ [--port=PORT] # Set port for --server option
86
+
87
+ Show API documentation in default browser
88
+ ```
57
89
 
58
- ## Copyright
90
+ #### publish
59
91
 
60
- Copyright 2012-15 (c) Apiary Ltd.
92
+ ```
93
+ $ apiary help publish
94
+ Usage:
95
+ apiary publish --api-name=API_NAME
96
+
97
+ Options:
98
+ [--message=COMMIT_MESSAGE] # Publish with custom commit message
99
+ [--path=PATH] # Specify path to blueprint file
100
+ # Default: apiary.apib
101
+ [--api-host=HOST] # Specify apiary host
102
+ --api-name=API_NAME
103
+
104
+ Publish apiary.apib on docs.API_NAME.apiary.io
105
+ ```
106
+
107
+ #### version
108
+
109
+ ```
110
+ $ apiary help version
111
+ Usage:
112
+ apiary version
113
+
114
+ Options:
115
+ [--{:aliases=>"-v"}={:ALIASES=>"-V"}]
116
+
117
+ Show version
118
+ ```
119
+
120
+ ## Hacking Apiary CLI Client
121
+
122
+ ### Build
123
+
124
+ 1. If needed, install bundler:
125
+
126
+ ```sh
127
+ $ gem install bundler
128
+ ```
129
+
130
+ 2. Clone the repo:
131
+
132
+ ```sh
133
+ $ git clone git@github.com:apiaryio/apiary-client.git
134
+ $ cd apiary-client
135
+ ```
136
+
137
+ 3. Install dependencies:
138
+
139
+ ```sh
140
+ $ bundle install
141
+ ```
142
+
143
+ ### Test
144
+
145
+ Inside the `apiary-client` repository directory run:
146
+
147
+ ```sh
148
+ $ bundle exec rake test
149
+ $ bundle exec rake features
150
+ ```
151
+
152
+
153
+ ### Release
154
+
155
+ Use `bundle install` to install your changes locally, for manual and ad-hock testing.
156
+
157
+ Only gem owners `gem owner apiaryio` can publish new gem into [RubyGems](https://rubygems.org/gems/apiaryio).
158
+
159
+ ```sh
160
+ $ rake release
161
+ ```
61
162
 
62
- ## Contributors
63
-
64
- - Jakub Nešetřil
65
- - James Charles Russell [botanicus]
66
- - Lukáš Linhart [Almad]
67
- - Emili Parreño
68
- - Peter Grilli [Tu1ly]
69
- - Ladislav Prskavec
70
- - Honza Javorek
71
- - Matthew Rudy Jacobs
72
- - Adam Kliment
73
- - Jack Repenning
74
- - Peter Strapp
75
- - Pierre Merlin
76
- - František Hába
77
- - Benjamin Arthur Lupton
78
163
 
79
164
  ## License
80
165
 
81
- Released under MIT license. See LICENSE file for further details.
166
+ Copyright 2012-15 (c) Apiary Ltd.
167
+
168
+ Released under MIT license.
169
+ See [LICENSE](https://raw.githubusercontent.com/apiaryio/apiary-client/master/LICENSE) file for further details.
170
+
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.version = Apiary::VERSION
18
18
 
19
19
  gem.add_dependency "rest-client", "~> 1.8"
20
- gem.add_dependency "rack", "~> 1.6"
20
+ gem.add_dependency "rack", "~> 1.6.4"
21
21
  gem.add_dependency "rake", "~> 10.4"
22
22
  gem.add_dependency "thor", "~> 0.19.1"
23
23
 
@@ -1,7 +1,8 @@
1
1
  Feature: Fetch apiary.apib from API_NAME.apiary.io
2
2
 
3
3
  # This is integration testing you have to set APIARY_API_KEY
4
+ @needs_apiary_api_key
4
5
  Scenario: Fetch apiary.apib from API_NAME.apiary.io
5
6
 
6
- When I run `apiary fetch --api-name apiaryclienttest`
7
+ When I run `apiary fetch --api-name testingapiaryclitestingapiarycli`
7
8
  Then the output should contain the content of file "apiary.apib"
@@ -1,6 +1,7 @@
1
1
  Feature: Show API documentation in specified browser
2
2
 
3
3
  # This is integration testing you have to set APIARY_API_KEY
4
+ @needs_apiary_api_key
4
5
  Scenario: Write generated HTML into specified file
5
6
 
6
7
  When I run `apiary preview --path apiary.apib --output=test.html`
@@ -1,7 +1,9 @@
1
1
  Feature: Publish apiary.apib on docs.API_NAME.apiary.io
2
2
 
3
3
  # This is integration testing you have to set APIARY_API_KEY
4
+ @needs_apiary_api_key
4
5
  Scenario: Publish apiary.apib on docs.API_NAME.apiary.io
5
6
 
7
+ # expected to fail
6
8
  When I run `apiary publish --path=apiary.apib --api-name 1111apiaryclienttest`
7
9
  Then the exit status should be 1
@@ -4,4 +4,19 @@ require 'fileutils'
4
4
  Before do
5
5
  @dirs << "../../features/fixtures"
6
6
  ENV['PATH'] = "./bin#{File::PATH_SEPARATOR}#{ENV['PATH']}"
7
- end
7
+ end
8
+
9
+ Around('@needs_apiary_api_key') do |scenario, block|
10
+ # DEBUG puts "Scenario #{scenario.name} wants APIARY_API_KEY."
11
+ original_value = ENV.delete("APIARY_API_KEY");
12
+ ENV["APIARY_API_KEY"] = "340bda135034529ab2abf341295c3aa2" # XXX
13
+ block.call
14
+ ENV["APIARY_API_KEY"] = original_value
15
+ end
16
+
17
+ Around('@doesnt_need_apiary_api_key') do |scenario, block|
18
+ # DEBUG puts "Scenario #{scenario.name} doesn't want APIARY_API_KEY."
19
+ original_value = ENV.delete("APIARY_API_KEY");
20
+ block.call
21
+ ENV["APIARY_API_KEY"] = original_value
22
+ end
@@ -1 +1,5 @@
1
1
  require 'aruba/cucumber'
2
+
3
+ Before('@needs_apiary_api_key') do
4
+ @aruba_timeout_seconds = 45
5
+ end
@@ -1,5 +1,6 @@
1
1
  Feature: Version of Apiary client
2
2
 
3
+ @doesnt_need_apiary_api_key
3
4
  Scenario: Print the semantic version of Apiary client
4
5
 
5
6
  # Note the output should be a semantic version (semver.org)
@@ -1,3 +1,3 @@
1
1
  module Apiary
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -2,8 +2,40 @@ require 'spec_helper'
2
2
 
3
3
  describe Apiary::CLI do
4
4
 
5
- it 'pass the test' do
6
- expect(true).to be_truthy
5
+ # Don't let Thor fold or truncate lines
6
+ ENV['THOR_COLUMNS'] = '1000'
7
+
8
+ # The documentation that ought to match the code
9
+ READMETEXT = open("README.md") {|f| f.read}
10
+
11
+ it 'has help' do
12
+ help = open('|ruby bin/apiary help') {|f| f.read}
13
+ expect(help).to include("Commands:")
14
+ expect(help.lines.count).to be >= 5
7
15
  end
8
16
 
17
+ it 'has README.md' do
18
+ expect(READMETEXT).to include("apiary help")
19
+ expect(READMETEXT.lines.count).to be >= 5
20
+ end
21
+
22
+ # Confirm that all subcommands are documented, verbatim
23
+ ([""] + (open('|ruby bin/apiary help', 'r') {|f| f.readlines}
24
+ .map {|l| /^ +apiary /.match(l)?l:nil}
25
+ .map {|l| /^ *apiary help/.match(l)?nil:l}
26
+ .compact
27
+ .map {|l| /^ *apiary ([^ ]*)/.match(l)[1] + " " }
28
+ )
29
+ ).each do |cmd|
30
+
31
+ it "includes help #{cmd}in README.md" do
32
+ helptext = open("|ruby bin/apiary help #{cmd}") {|f| f.read}
33
+
34
+ expect(helptext).to include("apiary #{cmd.strip}")
35
+ expect(READMETEXT).to include("apiary #{cmd.strip}")
36
+ expect(READMETEXT).to include(helptext)
37
+
38
+ end
39
+ end
9
40
  end
41
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiaryio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-04 00:00:00.000000000 Z
12
+ date: 2015-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '1.6'
37
+ version: 1.6.4
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '1.6'
45
+ version: 1.6.4
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rake
48
48
  requirement: !ruby/object:Gem::Requirement