apiaryio 0.15.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +15 -0
- data/.github/workflows/release.yml +12 -2
- data/CHANGELOG.md +6 -0
- data/README.md +16 -1
- data/apiary.gemspec +1 -1
- data/lib/apiary/cli.rb +11 -0
- data/lib/apiary/command/archive.rb +76 -0
- data/lib/apiary/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11fd537095ac5adda62367672def3244dce2d84c72c6d7b03b7682c9d28ddc2f
|
4
|
+
data.tar.gz: e5baae75069ef7ea100d6a33dcd9b6de804cb743a74f311bd6b2680af52e4f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec91c6a3188c45d14cc7359947f3e7a677198f1020285247f770d2bee1015f5d08469ef6d4e2478a98800d13f1bfe3307b9951a178eab6ec134884ab21a2678b
|
7
|
+
data.tar.gz: b6f106d656d4a5551c2a710c7ec40540ab80b6e16c55d165a9aec57991b3f89b5c7682ce0e1a0679277a3c62effda744f8412ee5214b1fc967e59050cbc0cadb
|
data/.editorconfig
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
; EditorConfig file: http://EditorConfig.org
|
2
|
+
; Install the "EditorConfig" plugin into your editor to use
|
3
|
+
|
4
|
+
root = true
|
5
|
+
|
6
|
+
[*]
|
7
|
+
charset = utf-8
|
8
|
+
insert_final_newline = true
|
9
|
+
indent_style = space
|
10
|
+
indent_size = 2
|
11
|
+
trim_trailing_whitespace = true
|
12
|
+
|
13
|
+
[README.md]
|
14
|
+
trim_trailing_whitespace = false
|
15
|
+
insert_final_newline = false
|
@@ -8,8 +8,8 @@ jobs:
|
|
8
8
|
steps:
|
9
9
|
- name: Checkout
|
10
10
|
uses: actions/checkout@v2
|
11
|
-
- name: Login to
|
12
|
-
uses:
|
11
|
+
- name: Login to Docker Hub
|
12
|
+
uses: docker/login-action@v1
|
13
13
|
with:
|
14
14
|
username: ${{ secrets.DOCKER_USERNAME }}
|
15
15
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
@@ -22,3 +22,13 @@ jobs:
|
|
22
22
|
docker tag apiaryio/client apiaryio/client:${{ steps.version.outputs.VERSION }}
|
23
23
|
docker push apiaryio/client
|
24
24
|
docker push apiaryio/client:${{ steps.version.outputs.VERSION }}
|
25
|
+
- name: Publish to RubyGems
|
26
|
+
run: |
|
27
|
+
mkdir -p $HOME/.gem
|
28
|
+
touch $HOME/.gem/credentials
|
29
|
+
chmod 0600 $HOME/.gem/credentials
|
30
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
31
|
+
gem build *.gemspec
|
32
|
+
gem push *.gem
|
33
|
+
env:
|
34
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.16.1
|
4
|
+
|
5
|
+
* add option for exclude team API projects
|
6
|
+
## 0.16.0
|
7
|
+
|
8
|
+
* add archive command to get all your API projects
|
3
9
|
## 0.15.0
|
4
10
|
* fix: change domain from docs.<subdomain>.apiary.io to <subdomain>.docs.apiary.io
|
5
11
|
* fix(security): [CVE-2020-10663](https://www.ruby-lang.org/en/news/2020/03/19/json-dos-cve-2020-10663/) and [CVE-2020-8184](https://nvd.nist.gov/vuln/detail/CVE-2020-8184)
|
data/README.md
CHANGED
@@ -57,6 +57,7 @@ export APIARY_API_KEY=<your_token>
|
|
57
57
|
```
|
58
58
|
$ apiary help
|
59
59
|
Commands:
|
60
|
+
apiary archive # Archive All Your API Description Documents from apiary.io to local files named following [api-project-subdomain.apib] pattern.
|
60
61
|
apiary fetch --api-name=API_NAME # Fetch API Description Document from API_NAME.docs.apiary.io
|
61
62
|
apiary help [COMMAND] # Describe available commands or one specific command
|
62
63
|
apiary preview # Show API documentation in browser or write it to file
|
@@ -68,6 +69,19 @@ Commands:
|
|
68
69
|
|
69
70
|
### Details
|
70
71
|
|
72
|
+
#### archive
|
73
|
+
|
74
|
+
```
|
75
|
+
$ apiary help archive
|
76
|
+
Usage:
|
77
|
+
apiary archive
|
78
|
+
|
79
|
+
Options:
|
80
|
+
[--exclude-team-projects], [--no-exclude-team-projects] # Skip team projects
|
81
|
+
|
82
|
+
Archive All Your API Description Documents from apiary.io to local files named following [api-project-subdomain.apib] pattern.
|
83
|
+
```
|
84
|
+
|
71
85
|
#### fetch
|
72
86
|
|
73
87
|
```
|
@@ -198,7 +212,8 @@ Only gem owners `gem owner apiaryio` can publish new gem into [RubyGems](https:/
|
|
198
212
|
4. make gem release:
|
199
213
|
|
200
214
|
```sh
|
201
|
-
$
|
215
|
+
$ git tag $VERSION
|
216
|
+
$ git push --tags
|
202
217
|
```
|
203
218
|
|
204
219
|
- if release is stuck you need use `$ rake release --trace` to get OTP prompt.
|
data/apiary.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
|
|
25
25
|
|
26
26
|
gem.add_runtime_dependency 'rest-client', '~> 2.0'
|
27
27
|
gem.add_runtime_dependency 'rack', '>= 2.2.3'
|
28
|
-
gem.add_runtime_dependency 'thor', '~>
|
28
|
+
gem.add_runtime_dependency 'thor', '~> 1.1.0'
|
29
29
|
gem.add_runtime_dependency 'json', '>= 2.3.0'
|
30
30
|
gem.add_runtime_dependency 'launchy', '~> 2.4'
|
31
31
|
gem.add_runtime_dependency 'listen', '~> 3.0'
|
data/lib/apiary/cli.rb
CHANGED
@@ -2,12 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'thor'
|
4
4
|
require 'apiary/command/fetch'
|
5
|
+
require 'apiary/command/archive'
|
5
6
|
require 'apiary/command/preview'
|
6
7
|
require 'apiary/command/publish'
|
7
8
|
require 'apiary/command/styleguide'
|
8
9
|
|
9
10
|
module Apiary
|
10
11
|
class CLI < Thor
|
12
|
+
|
13
|
+
desc 'archive', 'Archive All Your API Description Documents from apiary.io to local files named following [api-project-subdomain.apib] pattern.'
|
14
|
+
method_option :api_host, type: :string, banner: 'HOST', desc: 'Specify apiary host', hide: true
|
15
|
+
method_option :exclude_team_projects, type: :boolean, default: false, desc: 'Skip team projects'
|
16
|
+
|
17
|
+
def archive
|
18
|
+
cmd = Apiary::Command::Archive.new options
|
19
|
+
cmd.execute
|
20
|
+
end
|
21
|
+
|
11
22
|
desc 'fetch', 'Fetch API Description Document from API_NAME.docs.apiary.io'
|
12
23
|
method_option :api_name, type: :string, required: true
|
13
24
|
method_option :api_host, type: :string, banner: 'HOST', desc: 'Specify apiary host', hide: true
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require 'apiary/agent'
|
7
|
+
|
8
|
+
module Apiary::Command
|
9
|
+
# Retrieve blueprint from apiary
|
10
|
+
class Archive
|
11
|
+
def initialize(opts)
|
12
|
+
@options = OpenStruct.new(opts)
|
13
|
+
@options.api_host ||= 'api.apiary.io'
|
14
|
+
@options.api_key ||= ENV['APIARY_API_KEY']
|
15
|
+
@options.proxy ||= ENV['http_proxy']
|
16
|
+
@options.headers ||= {
|
17
|
+
accept: 'application/json',
|
18
|
+
content_type: 'application/json',
|
19
|
+
authorization: "Bearer #{@options.api_key}",
|
20
|
+
user_agent: Apiary.user_agent
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def execute
|
25
|
+
response = apilist_from_apiary
|
26
|
+
|
27
|
+
return unless response.instance_of? String
|
28
|
+
|
29
|
+
puts response
|
30
|
+
end
|
31
|
+
|
32
|
+
def apilist_from_apiary
|
33
|
+
unless @options.api_key
|
34
|
+
abort 'API key must be provided through environment variable APIARY_API_KEY. Please go to https://login.apiary.io/tokens to obtain it.'
|
35
|
+
end
|
36
|
+
|
37
|
+
response = query_apiary
|
38
|
+
|
39
|
+
response['apis'].each do |api|
|
40
|
+
if api['apiIsTeam'] == true && @options.exclude_team_projects == true
|
41
|
+
puts "#{api['apiSubdomain']}... Team API skipping"
|
42
|
+
next
|
43
|
+
end
|
44
|
+
puts api['apiSubdomain']
|
45
|
+
|
46
|
+
@options = OpenStruct.new
|
47
|
+
@options.api_host ||= 'api.apiary.io'
|
48
|
+
@options.api_name ||= api['apiSubdomain']
|
49
|
+
@options.api_key ||= ENV['APIARY_API_KEY']
|
50
|
+
@options.proxy ||= ENV['http_proxy']
|
51
|
+
@options.output ||= api['apiSubdomain'] + '.apib'
|
52
|
+
@options.headers ||= {
|
53
|
+
accept: 'text/html',
|
54
|
+
content_type: 'text/plain',
|
55
|
+
authentication: "Token #{@options.api_key}",
|
56
|
+
user_agent: Apiary.user_agent
|
57
|
+
}
|
58
|
+
cmd = Apiary::Command::Fetch.new(@options)
|
59
|
+
cmd.execute
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def query_apiary
|
64
|
+
url = "https://#{@options.api_host}/me/apis"
|
65
|
+
RestClient.proxy = @options.proxy
|
66
|
+
|
67
|
+
begin
|
68
|
+
response = RestClient.get url, @options.headers
|
69
|
+
rescue RestClient::Exception => e
|
70
|
+
abort "Apiary service responded with an error: #{e.message}"
|
71
|
+
end
|
72
|
+
JSON.parse response.body
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
data/lib/apiary/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiaryio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apiary Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,6 +201,7 @@ extensions: []
|
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
203
|
- ".circleci/config.yml"
|
204
|
+
- ".editorconfig"
|
204
205
|
- ".github/workflows/release.yml"
|
205
206
|
- ".github/workflows/test.yml"
|
206
207
|
- ".gitignore"
|
@@ -228,6 +229,7 @@ files:
|
|
228
229
|
- lib/apiary.rb
|
229
230
|
- lib/apiary/agent.rb
|
230
231
|
- lib/apiary/cli.rb
|
232
|
+
- lib/apiary/command/archive.rb
|
231
233
|
- lib/apiary/command/fetch.rb
|
232
234
|
- lib/apiary/command/preview.rb
|
233
235
|
- lib/apiary/command/publish.rb
|
@@ -275,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
277
|
- !ruby/object:Gem::Version
|
276
278
|
version: '0'
|
277
279
|
requirements: []
|
278
|
-
rubygems_version: 3.1.
|
280
|
+
rubygems_version: 3.1.2
|
279
281
|
signing_key:
|
280
282
|
specification_version: 4
|
281
283
|
summary: Apiary.io CLI
|