r2-oas 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/r2-oas/deploy/client.rb +20 -5
  4. data/lib/r2-oas/tasks/tool.rake +9 -2
  5. data/lib/r2-oas/version.rb +1 -1
  6. data/r2-oas.gemspec +1 -1
  7. metadata +4 -50
  8. data/.github/ISSUE_TEMPLATE.md +0 -12
  9. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  10. data/bin/console +0 -12
  11. data/bin/setup +0 -8
  12. data/devscript/all_support_ruby.sh +0 -43
  13. data/devscript/bundle_for_all_support_ruby.sh +0 -31
  14. data/devscript/rspec_for_all_support_ruby.sh +0 -27
  15. data/docs/.nojekyll +0 -0
  16. data/docs/README.md +0 -173
  17. data/docs/_sidebar.md +0 -25
  18. data/docs/attention/if_clash.md +0 -17
  19. data/docs/index.html +0 -29
  20. data/docs/schema/3.0.0.md +0 -155
  21. data/docs/setting/COC.md +0 -14
  22. data/docs/setting/CORS.md +0 -22
  23. data/docs/setting/configure.md +0 -176
  24. data/docs/trableshouting/runtime_error.md +0 -44
  25. data/docs/usage/analyze_docs.md +0 -875
  26. data/docs/usage/clean_docs.md +0 -19
  27. data/docs/usage/deploy_docs.md +0 -839
  28. data/docs/usage/display_paths_list.md +0 -35
  29. data/docs/usage/display_paths_stats.md +0 -54
  30. data/docs/usage/edit_docs.md +0 -218
  31. data/docs/usage/generate_docs.md +0 -412
  32. data/docs/usage/monitor_docs.md +0 -219
  33. data/docs/usage/use_hook_methods.md +0 -236
  34. data/docs/usage/use_hook_to_generate_docs.md +0 -235
  35. data/docs/usage/use_schema_namespace.md +0 -181
  36. data/docs/usage/use_tag_namespace.md +0 -180
  37. data/docs/usage/view_docs.md +0 -262
  38. data/gemfiles/ruby_2.3.3.gemfile +0 -11
  39. data/gemfiles/ruby_2.4.2.gemfile +0 -11
  40. data/gemfiles/ruby_2.5.8.gemfile +0 -11
  41. data/gemfiles/ruby_2.6.6.gemfile +0 -11
  42. data/gemfiles/ruby_2.7.1.gemfile +0 -11
  43. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png +0 -0
  44. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png +0 -0
  45. data/lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html +0 -68
  46. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js +0 -134
  47. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map +0 -1
  48. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js +0 -22
  49. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map +0 -1
  50. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css +0 -4
  51. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map +0 -1
  52. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js +0 -9
  53. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 202a93f6e116bb378c723a0810746749dea8059e91d2c199727739850ca528e7
4
- data.tar.gz: 8061d7a71e56c7656065b20ac85f39755df665dd0d22031e01374e82a773114c
3
+ metadata.gz: 517376839248a5dd6de6e70b753490e02a23ac70c967129fc7a578ec89da596c
4
+ data.tar.gz: 7eedf1ebcd319c0b93ee1ac58556ce0e4788658e62b64eecbad825862770245f
5
5
  SHA512:
6
- metadata.gz: 0700ad89a7147febd6b7fabb6c2343403a0f0fc4fa2e244996e3a2fa24a9e951e6e5899335f4fb4e26858796c87b04e4af4984992ce06d3a0d6864fdd6f2659f
7
- data.tar.gz: 2bab390d140d5eeef3b12b7563ffe20e3b2179e129f38bf4c3c4483777d80f4b91e5f73f8d74ad7a8f7c9db81ff258915a6a57cda90b4b2edcf199eb26b2ec49
6
+ metadata.gz: 20b7b68bbf6c4e8ec2d963301855d7bd078b78c31a98e8a01d421197a9e080682e459fb2a2b5541ca07580b995003f3fe17f88b97b1ab5295bdcda793d255c81
7
+ data.tar.gz: 140b4b5c71b4e34ed9f7ef7796414699db821ac078d6ad0101530145d0e3084cfd3f4e7b0c85e6a6091a2213b91ce6f976d4a2ee44d20434ce75f4f848595bf1
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## v0.3.2
4
+
5
+ 2020-07-05
6
+
7
+ - [`Feature`] The file size at the time of gem install was reduced by about 10MB. ([dbdbce9 ](https://github.com/yukihirop/r2-oas/pull/138))
8
+
3
9
  ## v0.3.1
4
10
 
5
11
  2020-06-07
@@ -6,22 +6,33 @@ require 'fileutils'
6
6
  module R2OAS
7
7
  module Deploy
8
8
  class Client < Schema::Base
9
+ SWAGGER_UI_DIST_URL = 'https://github.com/swagger-api/swagger-ui/trunk/dist'
10
+
11
+ def initialize(options = {})
12
+ super(options)
13
+ @download_dir = "#{SecureRandom.uuid[0..7]}/dist"
14
+ @dist_path = File.expand_path(Rails.root.join(@download_dir), __FILE__)
15
+ end
16
+
17
+ def download_swagger_ui_dist
18
+ system("svn export #{SWAGGER_UI_DIST_URL} #{@dist_path}")
19
+ end
20
+
9
21
  def deploy
10
22
  copy_swagger_ui_dist
11
23
  copy_swagger_ui_index
12
24
  copy_oas_doc_file
25
+ ensure
26
+ remove_download_dist
13
27
  end
14
28
 
15
29
  private
16
30
 
17
31
  def copy_swagger_ui_dist
18
32
  docs_path = File.expand_path(Rails.root.join(deploy_dir_path), __FILE__)
19
- return if FileTest.exists?(docs_path)
20
-
21
33
  FileUtils.mkdir_p(docs_path) unless FileTest.exists?(docs_path)
22
-
23
- dist_path = File.expand_path('swagger-ui/dist', __dir__)
24
- FileUtils.cp_r(dist_path, docs_path)
34
+ FileUtils.mkdir_p(@dist_path) unless FileTest.exists?(@dist_path)
35
+ FileUtils.cp_r(@dist_path, docs_path)
25
36
  end
26
37
 
27
38
  def copy_swagger_ui_index
@@ -39,6 +50,10 @@ module R2OAS
39
50
  FileUtils.cp_r(oas_doc_file_path, swagger_file_path)
40
51
  end
41
52
 
53
+ def remove_download_dist
54
+ FileUtils.rm_rf(File.expand_path('..', @dist_path))
55
+ end
56
+
42
57
  # [ref]
43
58
  # https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/ErbNewArguments
44
59
  def make_index(template)
@@ -11,12 +11,19 @@ namespace :routes do
11
11
  desc 'Deploy OAS Document'
12
12
  task deploy: [:common] do
13
13
  start do
14
+ client_options = {}
15
+ client = R2OAS::Deploy::Client.new(client_options)
16
+
17
+ download_dist_th = Thread.new do
18
+ puts 'Download swagger-api/swagger-ui/dist ... (async)'
19
+ client.download_swagger_ui_dist
20
+ end
21
+
14
22
  builder_options = { unit_paths_file_path: unit_paths_file_path }
15
23
  builder = R2OAS::Schema::Builder.new(builder_options)
16
24
  builder.build_docs
17
25
 
18
- client_options = {}
19
- client = R2OAS::Deploy::Client.new(client_options)
26
+ download_dist_th.join
20
27
  client.deploy
21
28
  end
22
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module R2OAS
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  # Specify which files should be added to the gem when it is released.
26
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
27
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin|.github|devscript|docs|gemfiles)/}) }
29
29
  end
30
30
  spec.bindir = 'exe'
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r2-oas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yukihirop
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-06 00:00:00.000000000 Z
11
+ date: 2020-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -251,8 +251,6 @@ executables: []
251
251
  extensions: []
252
252
  extra_rdoc_files: []
253
253
  files:
254
- - ".github/ISSUE_TEMPLATE.md"
255
- - ".github/PULL_REQUEST_TEMPLATE.md"
256
254
  - ".gitignore"
257
255
  - ".rspec"
258
256
  - ".rubocop.yml"
@@ -267,39 +265,6 @@ files:
267
265
  - README.ja.md
268
266
  - README.md
269
267
  - Rakefile
270
- - bin/console
271
- - bin/setup
272
- - devscript/all_support_ruby.sh
273
- - devscript/bundle_for_all_support_ruby.sh
274
- - devscript/rspec_for_all_support_ruby.sh
275
- - docs/.nojekyll
276
- - docs/README.md
277
- - docs/_sidebar.md
278
- - docs/attention/if_clash.md
279
- - docs/index.html
280
- - docs/schema/3.0.0.md
281
- - docs/setting/COC.md
282
- - docs/setting/CORS.md
283
- - docs/setting/configure.md
284
- - docs/trableshouting/runtime_error.md
285
- - docs/usage/analyze_docs.md
286
- - docs/usage/clean_docs.md
287
- - docs/usage/deploy_docs.md
288
- - docs/usage/display_paths_list.md
289
- - docs/usage/display_paths_stats.md
290
- - docs/usage/edit_docs.md
291
- - docs/usage/generate_docs.md
292
- - docs/usage/monitor_docs.md
293
- - docs/usage/use_hook_methods.md
294
- - docs/usage/use_hook_to_generate_docs.md
295
- - docs/usage/use_schema_namespace.md
296
- - docs/usage/use_tag_namespace.md
297
- - docs/usage/view_docs.md
298
- - gemfiles/ruby_2.3.3.gemfile
299
- - gemfiles/ruby_2.4.2.gemfile
300
- - gemfiles/ruby_2.5.8.gemfile
301
- - gemfiles/ruby_2.6.6.gemfile
302
- - gemfiles/ruby_2.7.1.gemfile
303
268
  - lib/r2-oas.rb
304
269
  - lib/r2-oas/app_configuration.rb
305
270
  - lib/r2-oas/app_configuration/server.rb
@@ -312,17 +277,6 @@ files:
312
277
  - lib/r2-oas/configuration.rb
313
278
  - lib/r2-oas/configuration/paths_config.rb
314
279
  - lib/r2-oas/deploy/client.rb
315
- - lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png
316
- - lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png
317
- - lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html
318
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js
319
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map
320
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js
321
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map
322
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css
323
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map
324
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js
325
- - lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map
326
280
  - lib/r2-oas/deploy/swagger-ui/index.html.erb
327
281
  - lib/r2-oas/errors.rb
328
282
  - lib/r2-oas/hooks/global_hook.rb
@@ -418,9 +372,9 @@ licenses:
418
372
  - MIT
419
373
  metadata:
420
374
  bug_tracker_uri: https://github.com/yukihirop/r2-oas/issues
421
- changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.3.1/CHANGELOG.md
375
+ changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.3.2/CHANGELOG.md
422
376
  documentation_uri: https://yukihirop.github.io/r2-oas
423
- source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.3.1
377
+ source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.3.2
424
378
  post_install_message:
425
379
  rdoc_options: []
426
380
  require_paths:
@@ -1,12 +0,0 @@
1
- ### Steps to reproduce
2
-
3
- ### Expected behavior
4
- Tell us what should happen
5
-
6
- ### Actual behavior
7
- Tell us what happens instead
8
-
9
- ### System configuration
10
- **r2-oas version**:
11
-
12
- **Ruby version**:
@@ -1,12 +0,0 @@
1
- ### Summary
2
-
3
- ### Other Information
4
-
5
- If there's anything else that's important and relevant to your pull
6
- request, mention that information here. This could include
7
- benchmarks, or other information.
8
-
9
- If you are updating any of the CHANGELOG files or are asked to update the
10
- CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.
11
-
12
- Thanks for contributing to r2-oas!
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'r2-oas'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- require 'pry'
12
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,43 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- if [ $# -eq 0 ]; then
4
- echo "Please specify 'rspec' or 'bundle', 'list'"
5
- exit 1
6
- fi
7
-
8
- # Check if rbenv is installed
9
- which rbenv > /dev/null 2>&1 && if [ $? -ne 0 ]; then echo -e 'rbenv is need\nPlease install rbenv: https://github.com/rbenv/rbenv'; exit 1; fi
10
-
11
- declare -a all_support_ruby=(
12
- '2.3.3'
13
- '2.4.2'
14
- '2.5.8'
15
- '2.6.6'
16
- '2.7.1'
17
- )
18
-
19
- declare -a target_ruby
20
- declare -a versions=${@:2:$#}
21
- if [[ $# > 1 ]]; then
22
- target_ruby=("${versions[@]}")
23
- else
24
- target_ruby=("${all_support_ruby[@]}")
25
- fi
26
-
27
- command=$1
28
- case $command in
29
- "bundle")
30
- source "$(pwd)/devscript/bundle_for_all_support_ruby.sh" "${target_ruby[@]}";;
31
- "rspec")
32
- source "$(pwd)/devscript/rspec_for_all_support_ruby.sh" "${target_ruby[@]}";;
33
- "list")
34
- echo "===== Display All Support Ruby Version ====="
35
- for version in "${target_ruby[@]}"; do
36
- echo "${version}"
37
- done
38
- echo "============================================";;
39
- *)
40
- echo -n "Do not support command: ${command}\nPlease specify 'bundle' or 'rspec', 'list'"
41
- exit 1;;
42
- esac
43
-
@@ -1,31 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- # Bundle install each All Support Ruby
4
- declare -a report
5
- for version in $@; do
6
- echo "== Bundle install for Ruby Version: ${version} =="
7
-
8
- # Remove gemfile.lock
9
- lockfile="./gemfiles/ruby_${version}.gemfile.lock"
10
- if [[ -f $lockfile ]]; then rm $lockfile; fi
11
-
12
- # Change Ruby Version
13
- echo ${version} > ./.ruby-version && rbenv rehash
14
-
15
- # Bundle install
16
- if [[ $version == "2.3.3" ]]; then
17
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle _1.17.3_ install --path vendor/bundle && report+=("ruby-${version}: $?")
18
- else
19
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle install --path vendor/bundle && report+=("ruby-${version}: $?")
20
- fi
21
- if [ $? -ne 0 ]; then report+=("ruby-${version}: 1 (failed)");fi
22
-
23
- echo "== End for Ruby Version: ${version} =="
24
- done
25
-
26
- # Display report
27
- echo "===== Bundle install for All Support Ruby Result ====="
28
- for result in "${report[@]}"; do
29
- echo $result
30
- done
31
- echo "======================================================"
@@ -1,27 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- # Rspec each All Support Ruby
4
- declare -a report
5
- for version in $@; do
6
- echo "== Rspec for Ruby Version: ${version} =="
7
-
8
- # Change Ruby Version
9
- echo ${version} > ./.ruby-version && rbenv rehash
10
-
11
- # Rspec
12
- if [[ $version == "2.3.3" ]];then
13
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle _1.17.3_ exec rspec --format progress && report+=("ruby-${version}: $?")
14
- else
15
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle exec rspec --format progress && report+=("ruby-${version}: $?")
16
- fi
17
- if [ $? -ne 0 ]; then report+=("ruby-${version}: 1 (failed)");fi
18
-
19
- echo "== End for Ruby Version: ${version} =="
20
- done
21
-
22
- # Display report
23
- echo "===== Rspec for All Support Ruby Result ====="
24
- for result in "${report[@]}"; do
25
- echo $result
26
- done
27
- echo "============================================="
File without changes
@@ -1,173 +0,0 @@
1
- # R2-OAS
2
-
3
- [![Gem Version](https://badge.fury.io/rb/r2-oas.svg)](https://badge.fury.io/rb/r2-oas)
4
- [![Build Status](https://travis-ci.org/yukihirop/r2-oas.svg?branch=master)](https://travis-ci.org/yukihirop/r2-oas)
5
- [![Coverage Status](https://coveralls.io/repos/github/yukihirop/r2-oas/badge.svg)](https://coveralls.io/github/yukihirop/r2-oas)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/f8c3846f350bb412fd63/maintainability)](https://codeclimate.com/github/yukihirop/r2-oas/maintainability)
7
-
8
- Generate api docment(OpenAPI) side only from `Rails` routing.
9
-
10
- Provides a rake command to help `generate` , `view` , and `edit` OpenAPI documents.
11
-
12
- ```bash
13
- bundle exec rake routes:oas:docs # generate
14
- bundle exec rake routes:oas:ui # view
15
- bundle exec rake routes:oas:editor # edit
16
- bundle exec rake routes:oas:monitor # monitor
17
- bundle exec rake routes:oas:dist # distribute
18
- bundle exec rake routes:oas:clean # clean
19
- bundle exec rake routes:oas:analyze # analyze
20
- bundle exec rake routes:oas:deploy # deploy
21
- ```
22
-
23
- ## 💎 Installation
24
-
25
- Add this line to your application's Gemfile:
26
-
27
- ```ruby
28
- group :development do
29
- gem 'r2-oas'
30
- end
31
- ```
32
-
33
- And then execute:
34
-
35
- $ bundle
36
-
37
- Or install it yourself as:
38
-
39
- $ gem install r2-oas
40
-
41
- ## 🔦 Requirements
42
-
43
- If you want to view with `Swagger UI` or edit with `Swagger Editor`, This gem needs the following:
44
-
45
- - [`swaggerapi/swagger-ui:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-ui/)
46
- - [`swaggerapi/swagger-editor:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-editor/)
47
- - [`chromedriver`](http://chromedriver.chromium.org/downloads)
48
-
49
- If you do not have it download as below.
50
-
51
- ```
52
- $ docker pull swaggerapi/swagger-editor:latest
53
- $ docker pull swaggerapi/swagger-ui:latest
54
- $ brew cask install chromedriver
55
- ```
56
-
57
- ## 🚀 Tutorial
58
-
59
- After requiring a gem,
60
-
61
- ```bash
62
- bundle exec routes:oas:docs
63
- bundle exec routes:oas:editor
64
- ```
65
-
66
- #### Generate docs
67
-
68
- ![oas_docs](https://user-images.githubusercontent.com/11146767/80856236-0b839a80-8c83-11ea-888f-d0e659e0c251.gif)
69
-
70
-
71
- #### Edit docs
72
-
73
- ![oas_editor](https://user-images.githubusercontent.com/11146767/80856240-15a59900-8c83-11ea-9dbd-4382528944f2.gif)
74
-
75
- ## 📖 Usage
76
-
77
-
78
- You can execute the following command in the root directory of rails.
79
-
80
- ```bash
81
- $ # Generate docs
82
- $ bundle exec rake routes:oas:docs # Generate docs
83
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:docs # Generate docs by specify unit paths
84
-
85
- $ # Start swagger editor
86
- $ bundle exec rake routes:oas:editor # Start swagger editor
87
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:editor # Start swagger editor by specify unit paths
88
- $ # Start swagger ui
89
- $ bundle exec rake routes:oas:ui # Start swagger ui
90
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:ui # Start swagger ui by specify unit paths
91
- $ # Monitor swagger document
92
- $ bundle exec rake routes:oas:monitor # Monitor swagger document
93
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:monitor # Monitor swagger by specify unit paths
94
-
95
- $ # Analyze docs
96
- $ OAS_FILE="~/Desktop/swagger.yml" bundle exec rake routes:oas:analyze
97
- $ # Clean docs
98
- $ bundle exec rake routes:oas:clean
99
- $ # Deploy docs
100
- $ bundle exec rake routes:oas:deploy
101
- $ # Distribute swagger document
102
- $ bundle exec rake routes:oas:dist
103
- $ # Distribute swagger document
104
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:dist # Distribute swagger document by specify unit paths
105
-
106
- # Display paths list
107
- $ bundle exec rake routes:oas:paths_ls
108
- # Display paths stats
109
- $ bundle exec rake routes:oas:paths_stats
110
- ```
111
-
112
- ## ❤️ Support Rails Version
113
-
114
- - Rails (>= 4.2.5.1)
115
-
116
- ## ❤️ Support Ruby Version
117
-
118
- - Ruby (>= 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin18])
119
-
120
- ## ❤️ Support Rouging
121
-
122
- - Rails Engine Routing
123
- - Rails Normal Routing
124
-
125
- ## ❗️ Convention over Configuration (CoC)
126
-
127
- - `tag name` represents `controller name` and determine `paths file name`.
128
- - For example, If `controller name` is `Api::V1::UsersController`, `tag_name` is `api/v1/user`. and `paths file name` is `api/v1/user.yml`
129
-
130
- - `_` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
131
- - For example, If `components/schemas name` is `Api_V1_User`, `components/schemas file name` is `api/v1/user.yml`.
132
- - `_` is supposed to be used to express `namespace`.
133
- - format is `Namespace1_Namespace2_Model`.
134
-
135
- - `.` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
136
- - For example, If `components/schemas name` is `api.v1.User`, `components/schemas file name` is `api/v1/user.yml`.
137
- - `.` is supposed to be used to express `namespace`.
138
- - format is `namespace1.namespace2.Model`.
139
-
140
- ## 🔩 CORS
141
-
142
- Use [rack-cors](https://github.com/cyu/rack-cors) to enable CORS.
143
-
144
- ```ruby
145
- require 'rack/cors'
146
- use Rack::Cors do
147
- allow do
148
- origins '*'
149
- resource '*', headers: :any, methods: [ :get, :post, :put, :delete, :options ]
150
- end
151
- end
152
- ```
153
-
154
- Alternatively you can set CORS headers in a `before` block.
155
-
156
- ```ruby
157
- before do
158
- header['Access-Control-Allow-Origin'] = '*'
159
- header['Access-Control-Request-Method'] = '*'
160
- end
161
- ```
162
-
163
- ## 📝 License
164
-
165
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
166
-
167
- ## 🤝 Contributing
168
-
169
- 1. Fork it ( http://github.com/yukihirop/r2-oas/fork )
170
- 2. Create your feature branch (`git checkout -b my-new-feature`)
171
- 3. Commit your changes (`git commit -am 'Add some feature'`)
172
- 4. Push to the branch (`git push origin my-new-feature`)
173
- 5. Create new Pull Request