apiaryio 0.15.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d82d5213c6cf1b9ec2f14c30c6668d0477de794338df8387087805bbe1fa966
4
- data.tar.gz: f3302452ee5dea3f53b70cfba39d94aab3eb99ae2c554c7e822ec7f6351e6e8c
3
+ metadata.gz: a3f826ea9db9773c47de22a91b8627ab015c4aaab3356453e15d9e7c9a7a6c2f
4
+ data.tar.gz: d325cd4be26355139c01e2e1f8cb62ff49a148e7740042ad5cfb8933e9aec3ed
5
5
  SHA512:
6
- metadata.gz: ad32626008932bf5e4b756d226e2cb393960de6972a41b320fa587374d54859091886732a0dfddb5d1b55a82c50b5c139d8f54b53a124c17fc298aaf888afc19
7
- data.tar.gz: 995a9747c582fba4207bbd18b48319d9fc12a25973fc55b39daadbc04be364b1f893b40e496013ed4d4ab4328e870dc5924b7cb9f4b85a1d643956207c9f0c37
6
+ metadata.gz: 908a8d90749ab666fb1427ab8f2950badb74ac91dde5c54faf7a6c2b3372015f12c9066df6a622590090d59af6fdea9a96749e4b68b862ae307c1e8ebc23920a
7
+ data.tar.gz: 5cb3e36dfbd29a7cd81056ccf9273b665dc2a780a18404b226e70b7a8e8697aad359b638bd4f3dfacdf06fe521cab4161edd931bd1539ab07f06593288538242
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 docker
12
- uses: azure/docker-login@v1
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/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.4-alpine
1
+ FROM ruby:2.7-alpine
2
2
  RUN apk add --update build-base && rm /var/cache/apk/*
3
3
  RUN gem install apiaryio
4
4
  ENTRYPOINT ["apiary"]
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,9 +212,12 @@ 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
- $ rake release
215
+ $ git tag $VERSION
216
+ $ git push --tags
202
217
  ```
203
218
 
219
+ - if release is stuck you need use `$ rake release --trace` to get OTP prompt.
220
+
204
221
 
205
222
  ## License
206
223
 
data/apiary.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |gem|
30
30
  gem.add_runtime_dependency 'launchy', '~> 2.4'
31
31
  gem.add_runtime_dependency 'listen', '~> 3.0'
32
32
 
33
- gem.add_development_dependency 'bundler', '~> 2.0'
33
+ gem.add_development_dependency 'bundler', '>= 2.2.11'
34
34
  gem.add_development_dependency 'rake', '>= 12.3.3'
35
35
  gem.add_development_dependency 'rspec', '~> 3.4'
36
36
  gem.add_development_dependency 'webmock', '>= 2.2.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
@@ -1,3 +1,3 @@
1
1
  module Apiary
2
- VERSION = '0.15.0'.freeze
2
+ VERSION = '0.16.1'.freeze
3
3
  end
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.15.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apiary Ltd.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '2.0'
103
+ version: 2.2.11
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '2.0'
110
+ version: 2.2.11
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  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
@@ -260,7 +262,7 @@ homepage: https://apiary.io
260
262
  licenses:
261
263
  - MIT
262
264
  metadata: {}
263
- post_install_message:
265
+ post_install_message:
264
266
  rdoc_options: []
265
267
  require_paths:
266
268
  - lib
@@ -275,8 +277,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
277
  - !ruby/object:Gem::Version
276
278
  version: '0'
277
279
  requirements: []
278
- rubygems_version: 3.0.3
279
- signing_key:
280
+ rubygems_version: 3.1.2
281
+ signing_key:
280
282
  specification_version: 4
281
283
  summary: Apiary.io CLI
282
284
  test_files: