grape-swagger-rails 0.3.1 → 0.5.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +19 -0
  3. data/.github/workflows/head.yml +32 -0
  4. data/.github/workflows/rubocop.yml +14 -0
  5. data/.github/workflows/test.yml +35 -0
  6. data/.rubocop.yml +7 -2
  7. data/.rubocop_todo.yml +103 -32
  8. data/CHANGELOG.md +25 -14
  9. data/Dangerfile +2 -0
  10. data/Gemfile +24 -16
  11. data/README.md +32 -2
  12. data/RELEASING.md +4 -5
  13. data/Rakefile +5 -9
  14. data/app/assets/config/grape_swagger_rails_manifest.js +2 -0
  15. data/app/controllers/grape_swagger_rails/application_controller.rb +4 -2
  16. data/app/views/grape_swagger_rails/application/index.html.erb +1 -1
  17. data/config/routes.rb +2 -0
  18. data/grape-swagger-rails.gemspec +13 -29
  19. data/lib/grape-swagger-rails/engine.rb +2 -0
  20. data/lib/grape-swagger-rails/version.rb +3 -1
  21. data/lib/grape-swagger-rails.rb +17 -14
  22. data/lib/script/rails +4 -2
  23. data/lib/tasks/swagger_ui.rake +6 -3
  24. data/spec/dummy/Rakefile +6 -3
  25. data/spec/dummy/app/api/api.rb +2 -0
  26. data/spec/dummy/app/assets/config/manifest.js +3 -0
  27. data/spec/dummy/app/assets/javascripts/application.js +0 -2
  28. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  29. data/spec/dummy/app/controllers/welcome_controller.rb +3 -2
  30. data/spec/dummy/app/views/layouts/application.html.erb +1 -0
  31. data/spec/dummy/bin/rails +3 -5
  32. data/spec/dummy/bin/rake +2 -4
  33. data/spec/dummy/bin/setup +27 -0
  34. data/spec/dummy/config/application.rb +11 -10
  35. data/spec/dummy/config/boot.rb +4 -7
  36. data/spec/dummy/config/environment.rb +6 -2
  37. data/spec/dummy/config/environments/development.rb +40 -19
  38. data/spec/dummy/config/environments/production.rb +31 -31
  39. data/spec/dummy/config/environments/test.rb +30 -20
  40. data/spec/dummy/config/initializers/assets.rb +13 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +10 -0
  42. data/spec/dummy/config/initializers/inflections.rb +18 -0
  43. data/spec/dummy/config/initializers/swagger.rb +2 -0
  44. data/spec/dummy/config/routes.rb +2 -0
  45. data/spec/dummy/config.ru +6 -2
  46. data/spec/dummy/public/404.html +6 -6
  47. data/spec/dummy/public/422.html +6 -6
  48. data/spec/dummy/public/500.html +6 -6
  49. data/spec/features/grape-swagger-rails_spec.rb +5 -1
  50. data/spec/features/swagger_spec.rb +97 -35
  51. data/spec/features/welcome_spec.rb +3 -0
  52. data/spec/spec_helper.rb +4 -2
  53. data/spec/support/capybara.rb +3 -0
  54. data/spec/support/rails.rb +2 -0
  55. metadata +25 -340
  56. data/.travis.yml +0 -53
  57. data/spec/dummy/bin/bundle +0 -3
  58. data/spec/dummy/bin/spring +0 -18
  59. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -1
  60. data/spec/dummy/config/initializers/session_store.rb +0 -1
  61. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  62. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fbbe31ef3358e338372a0e2ad589acff22eec986accfaf7169a5af2357701d6
4
- data.tar.gz: 6b9672241d274f8b350836b3877d0bd79579d6b499ecf963f66b3aeae4c8303c
3
+ metadata.gz: d4c9588b4ccf8e66253f11a742506fc512c9a70d4d0f32c8ec72db06bdc47af5
4
+ data.tar.gz: 3148cee4aad16dced2e22f6f8639e6daa1c3190fcb46c9bc1627cdc385861d9c
5
5
  SHA512:
6
- metadata.gz: 6e9d7ae03cf73df5422183cc1485fb6cc915900fc5cfeaafab6b494491238199ae99094feecf4be65c9a794b93cad21cc7cb6e01c09bc6ae55fc66368ce1f116
7
- data.tar.gz: 4e5b3c98c11a2316fd2712ee612cabd009ea3baf0e9bdaeacca8a0d497aee8879e27afbd3dc1b102ea83eb0abae7e5d8ecb04b89bb5750b7dcdf591cf2fc1071
6
+ metadata.gz: 91b7f33ff1190d15f16937087ca698a94e2daf43aed206b80821bbc879d1cdeac98e7fe151d1a5414fa50ae649adaa293d87ac0fd06135540903159ff8ed0e98
7
+ data.tar.gz: 69968abc92dc53117812b3901cb98baa72036496005fc5ba65fc7b759eb9a0e40536af7bbcd0f4cced9567a7e7687b53144bb18599731554569fd0f2f4938f50
@@ -0,0 +1,19 @@
1
+ name: Danger
2
+ on: [pull_request]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v3
8
+ with:
9
+ fetch-depth: 0
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: "2.7"
14
+ bundler-cache: true
15
+ - name: Run Danger
16
+ run: |
17
+ # the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok
18
+ TOKEN=$(echo -n Z2hwX2lYb0dPNXNyejYzOFJyaTV3QUxUdkNiS1dtblFwZTFuRXpmMwo= | base64 --decode)
19
+ DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -0,0 +1,32 @@
1
+ name: Tests (HEAD)
2
+ on: [pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ continue-on-error: true
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ entry:
11
+ - { ruby: "3.2", grape-swagger: "HEAD" }
12
+ - { ruby: "ruby-head", grape-swagger: "HEAD" }
13
+ - { ruby: "jruby-head", grape-swagger: "HEAD" }
14
+ env:
15
+ GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.entry.ruby }}
22
+ bundler-cache: true
23
+ - name: Setup Firefox
24
+ uses: browser-actions/setup-firefox@v1
25
+ with:
26
+ firefox-version: "111.0.1"
27
+ - uses: browser-actions/setup-geckodriver@latest
28
+ with:
29
+ geckodriver-version: "0.32.2"
30
+ - uses: coactions/setup-xvfb@v1
31
+ with:
32
+ run: bundle exec rake spec
@@ -0,0 +1,14 @@
1
+ name: Rubocop
2
+ on: [pull_request]
3
+ jobs:
4
+ rubocop:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v3
8
+ - name: Set up Ruby
9
+ uses: ruby/setup-ruby@v1
10
+ with:
11
+ ruby-version: "3.2"
12
+ bundler-cache: true
13
+ - name: Run Rubocop
14
+ run: bundle exec rubocop
@@ -0,0 +1,35 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ entry:
10
+ - { ruby: "2.7", grape-swagger: "1.6.1" }
11
+ - { ruby: "3.0", grape-swagger: "1.6.1" }
12
+ - { ruby: "3.1", grape-swagger: "1.6.1" }
13
+ - { ruby: "3.2", grape-swagger: "1.6.1" }
14
+ - { ruby: "3.2", grape-swagger: "2.0.2" }
15
+ - { ruby: "jruby-9.4.6", grape-swagger: "1.6.1" }
16
+ - { ruby: "jruby-9.4.6", grape-swagger: "2.0.2" }
17
+ env:
18
+ GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.entry.ruby }}
25
+ bundler-cache: true
26
+ - name: Setup Firefox
27
+ uses: browser-actions/setup-firefox@v1
28
+ with:
29
+ firefox-version: "111.0.1"
30
+ - uses: browser-actions/setup-geckodriver@latest
31
+ with:
32
+ geckodriver-version: "0.32.2"
33
+ - uses: coactions/setup-xvfb@v1
34
+ with:
35
+ run: bundle exec rake spec
data/.rubocop.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  AllCops:
2
- Exclude:
3
- - vendor/**/*
2
+ TargetRubyVersion: 2.7
3
+ NewCops: enable
4
4
 
5
5
  inherit_from: .rubocop_todo.yml
6
+
7
+ require:
8
+ - rubocop-capybara
9
+ - rubocop-rake
10
+ - rubocop-rspec
data/.rubocop_todo.yml CHANGED
@@ -1,61 +1,132 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-08-19 12:23:54 -0400 using RuboCop version 0.38.0.
3
+ # on 2024-04-06 14:14:58 UTC using RuboCop version 1.62.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 6
10
+ # Configuration parameters: EnforcedStyle.
11
+ # SupportedStyles: link_or_button, strict
12
+ Capybara/ClickLinkOrButtonStyle:
13
+ Exclude:
14
+ - 'spec/features/swagger_spec.rb'
15
+
16
+ # Offense count: 1
17
+ Capybara/SpecificMatcher:
18
+ Exclude:
19
+ - 'spec/features/welcome_spec.rb'
20
+
21
+ # Offense count: 1
22
+ # Configuration parameters: Severity, Include.
23
+ # Include: **/*.gemspec
24
+ Gemspec/RequiredRubyVersion:
25
+ Exclude:
26
+ - 'grape-swagger-rails.gemspec'
27
+
28
+ # Offense count: 2
29
+ # Configuration parameters: AllowedMethods.
30
+ # AllowedMethods: enums
31
+ Lint/ConstantDefinitionInBlock:
32
+ Exclude:
33
+ - 'lib/tasks/swagger_ui.rake'
34
+
9
35
  # Offense count: 1
10
- Lint/AmbiguousRegexpLiteral:
36
+ Lint/MixedRegexpCaptureTypes:
11
37
  Exclude:
12
38
  - 'lib/tasks/swagger_ui.rake'
13
39
 
40
+ # Offense count: 4
41
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
42
+ # AllowedMethods: refine
43
+ Metrics/BlockLength:
44
+ Max: 89
45
+
46
+ # Offense count: 2
47
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
48
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
49
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
50
+ Naming/FileName:
51
+ Exclude:
52
+ - 'lib/grape-swagger-rails.rb'
53
+ - 'spec/features/grape-swagger-rails_spec.rb'
54
+
55
+ # Offense count: 13
56
+ # Configuration parameters: Prefixes, AllowedPatterns.
57
+ # Prefixes: when, with, without
58
+ RSpec/ContextWording:
59
+ Exclude:
60
+ - 'spec/features/swagger_spec.rb'
61
+
14
62
  # Offense count: 1
15
- # Configuration parameters: AllowSafeAssignment.
16
- Lint/AssignmentInCondition:
63
+ # This cop supports unsafe autocorrection (--autocorrect-all).
64
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
65
+ # SupportedStyles: described_class, explicit
66
+ RSpec/DescribedClass:
17
67
  Exclude:
18
- - 'spec/dummy/bin/spring'
68
+ - 'spec/features/grape-swagger-rails_spec.rb'
69
+
70
+ # Offense count: 6
71
+ # Configuration parameters: CountAsOne.
72
+ RSpec/ExampleLength:
73
+ Max: 8
74
+
75
+ # Offense count: 1
76
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
77
+ # Include: **/*_spec*rb*, **/spec/**/*
78
+ RSpec/FilePath:
79
+ Exclude:
80
+ - 'spec/features/grape-swagger-rails_spec.rb'
19
81
 
20
82
  # Offense count: 2
21
- Lint/HandleExceptions:
83
+ # Configuration parameters: AssignmentOnly.
84
+ RSpec/InstanceVariable:
22
85
  Exclude:
23
- - 'spec/dummy/bin/rails'
24
- - 'spec/dummy/bin/rake'
86
+ - 'spec/features/swagger_spec.rb'
25
87
 
26
- # Offense count: 31
27
- # Configuration parameters: AllowURI, URISchemes.
28
- Metrics/LineLength:
29
- Max: 129
88
+ # Offense count: 12
89
+ RSpec/MultipleExpectations:
90
+ Max: 4
30
91
 
31
92
  # Offense count: 2
32
- # Cop supports --auto-correct.
33
- # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
34
- Style/BlockDelimiters:
35
- Enabled: false
93
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
94
+ # SupportedStyles: always, named_only
95
+ RSpec/NamedSubject:
96
+ Exclude:
97
+ - 'spec/features/grape-swagger-rails_spec.rb'
98
+
99
+ # Offense count: 12
100
+ # Configuration parameters: AllowedGroups.
101
+ RSpec/NestedGroups:
102
+ Max: 4
103
+
104
+ # Offense count: 1
105
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
106
+ # Include: **/*_spec.rb
107
+ RSpec/SpecFilePathFormat:
108
+ Exclude:
109
+ - '**/spec/routing/**/*'
110
+ - 'spec/features/grape-swagger-rails_spec.rb'
36
111
 
37
- # Offense count: 9
112
+ # Offense count: 4
113
+ # Configuration parameters: AllowedConstants.
38
114
  Style/Documentation:
39
115
  Exclude:
116
+ - 'spec/**/*'
117
+ - 'test/**/*'
40
118
  - 'app/controllers/grape_swagger_rails/application_controller.rb'
41
119
  - 'lib/grape-swagger-rails.rb'
42
120
  - 'lib/grape-swagger-rails/engine.rb'
43
- - 'lib/grape-swagger-rails/version.rb'
44
- - 'spec/dummy/app/api/api.rb'
45
- - 'spec/dummy/app/controllers/application_controller.rb'
46
- - 'spec/dummy/app/controllers/welcome_controller.rb'
47
- - 'spec/dummy/config/application.rb'
48
121
 
49
- # Offense count: 2
50
- # Configuration parameters: Exclude.
51
- Style/FileName:
122
+ # Offense count: 1
123
+ Style/OpenStructUse:
52
124
  Exclude:
53
125
  - 'lib/grape-swagger-rails.rb'
54
- - 'spec/features/grape-swagger-rails_spec.rb'
55
126
 
56
- # Offense count: 1
57
- # Cop supports --auto-correct.
58
- # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
59
- Style/RegexpLiteral:
60
- Exclude:
61
- - 'lib/tasks/swagger_ui.rake'
127
+ # Offense count: 2
128
+ # This cop supports safe autocorrection (--autocorrect).
129
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
130
+ # URISchemes: http, https
131
+ Layout/LineLength:
132
+ Max: 143
data/CHANGELOG.md CHANGED
@@ -1,30 +1,41 @@
1
- ### Next Release
1
+ ### 0.5.0 (2024/04/06)
2
2
 
3
- * Your contribution here.
3
+ * [#110](https://github.com/ruby-grape/grape-swagger-rails/pull/110): Update dummy app to current rails conventions - [@duffn](https://github.com/duffn).
4
+ * [#112](https://github.com/ruby-grape/grape-swagger-rails/pull/112): Add RuboCop GHA & autocorrect violations - [@duffn](https://github.com/duffn).
5
+ * [#114](https://github.com/ruby-grape/grape-swagger-rails/pull/114): Add `api_key_placeholder` option - [@SofiaSousa](https://github.com/SofiaSousa).
6
+ * [#116](https://github.com/ruby-grape/grape-swagger-rails/pull/116): Ensure that `ostruct` is loaded - [@jrmhaig](https://github.com/jrmhaig).
7
+ * [#117](https://github.com/ruby-grape/grape-swagger-rails/pull/117): Fix rubygems source code location metadata - [@dblock](https://github.com/dblock).
8
+ * [#118](https://github.com/ruby-grape/grape-swagger-rails/pull/118): Split the test matrix, fix JRuby tests - [@dblock](https://github.com/dblock).
4
9
 
5
- ### 0.3.1 (February 16, 2019)
10
+ ### 0.4.0 (2023/03/28)
11
+
12
+ * [#107](https://github.com/ruby-grape/grape-swagger-rails/pull/107): Add test matrix for multiple ruby versions - [@duffn](https://github.com/duffn).
13
+ * [#105](https://github.com/ruby-grape/grape-swagger-rails/pull/105): Migrate to GitHub Actions - [@duffn](https://github.com/duffn).
14
+ * [#98](https://github.com/ruby-grape/grape-swagger-rails/pull/98): Fix: test against Rails 6 - [@dblock](https://github.com/dblock).
15
+
16
+ ### 0.3.1 (2019/02/16)
6
17
 
7
18
  * [#82](https://github.com/ruby-grape/grape-swagger-rails/pull/82): Fixed api_key_default_value - [@konto-andrzeja](https://github.com/konto-andrzeja).
8
19
  * [#84](https://github.com/ruby-grape/grape-swagger-rails/pull/84): Added the token api_auth type - [@Jack12816](https://github.com/Jack12816).
9
20
 
10
- ### 0.3.0 (September 22, 2016)
21
+ ### 0.3.0 (2016/09/22)
11
22
 
12
23
  * [#70](https://github.com/ruby-grape/grape-swagger-rails/pull/70): Rails 5 support - [@serggl](https://github.com/serggl).
13
24
  * [#68](https://github.com/ruby-grape/grape-swagger-rails/pull/68): Added danger, PR linter - [@dblock](https://github.com/dblock).
14
25
 
15
- ### 0.2.2 (July 13, 2016)
26
+ ### 0.2.2 (2016/07/13)
16
27
 
17
28
  * [#57](https://github.com/ruby-grape/grape-swagger-rails/pull/57): Support Swagger-UI supportedSubmitMethods option - [@ShadowWrathOogles](https://github.com/ShadowWrathOogles).
18
29
  * [#61](https://github.com/ruby-grape/grape-swagger-rails/pull/61): Removed grape and grape-swagger from required dependencies - [@aschuster3](https://github.com/aschuster3).
19
30
 
20
- ### 0.2.1 (May 21, 2016)
31
+ ### 0.2.1 (2016/05/21)
21
32
 
22
33
  * Fixed header-based authorization - [@davidbrewer](https://github.com/davidbrewer).
23
34
  * Support Swagger-UI validatorUrl option - [@davidbrewer](https://github.com/davidbrewer).
24
35
  * Support for grape 0.14.x through 0.16.x and grape-swagger 0.11.x through 0.20.x - [@dblock](https://github.com/dblock).
25
36
  * [#55](https://github.com/ruby-grape/grape-swagger-rails/pull/55): Update Swagger-UI assets and add ability to hide input boxes - [@aschuster3](https://github.com/aschuster3).
26
37
 
27
- ### 0.2.0 (February 23, 2016)
38
+ ### 0.2.0 (2016/02/23)
28
39
 
29
40
  * [#6](https://github.com/ruby-grape/grape-swagger-rails/pull/6): Fix: support multiple predefined headers - [@Tyr0](https://github.com/tyr0).
30
41
  * Upgraded swagger-ui to v2.1.1 - [@dblock](https://github.com/dblock).
@@ -35,11 +46,11 @@
35
46
  * [#39](https://github.com/ruby-grape/grape-swagger-rails/pull/39): Support CSS media queries - [@alexagranov](https://github.com/alexagranov).
36
47
  * [#42](https://github.com/ruby-grape/grape-swagger-rails/pull/42): Headers added on swaggerUi initialization (before swaggerUi.load() call) - [@sedx](https://github.com/sedx).
37
48
 
38
- ### 0.1.0 (February 5, 2015)
49
+ ### 0.1.0 (2015/02/05)
39
50
 
40
51
  * [#41](https://github.com/BrandyMint/grape-swagger-rails/pull/41): Compatibility with grape-swagger 0.8.0 and 0.9.0 - [@dblock](https://github.com/dblock).
41
52
 
42
- ### 0.0.10 (September 30, 2014)
53
+ ### 0.0.10 (2014/09/30)
43
54
 
44
55
  * [#33](https://github.com/BrandyMint/grape-swagger-rails/pull/33): Fix: make the dummy app runnable - [@dblock](https://github.com/dblock).
45
56
  * [#33](https://github.com/BrandyMint/grape-swagger-rails/pull/33): Fix: headers default to nil - [@dblock](https://github.com/dblock).
@@ -51,24 +62,24 @@
51
62
  * [#14](https://github.com/BrandyMint/grape-swagger-rails/pull/14): Added app_name to configure title of the app - [@ghilead](https://github.com/ghilead).
52
63
  * [#12](https://github.com/BrandyMint/grape-swagger-rails/pull/12): Fix: SwaggerUI url is combined with appUrl - [@ghilead](https://github.com/ghilead).
53
64
 
54
- ### 0.0.8 (February 6, 2014)
65
+ ### 0.0.8 (2014/02/06)
55
66
 
56
67
  * [#11](https://github.com/BrandyMint/grape-swagger-rails/pull/11): Fixed image loading - [@bitboxer](https://github.com/bitboxer).
57
68
 
58
- ### 0.0.7 (February 5, 2014)
69
+ ### 0.0.7 (2014/02/05)
59
70
 
60
71
  * [#7](https://github.com/BrandyMint/grape-swagger-rails/pull/7): Updated to Swagger-UI 2.0.3 - [@joelvh](https://github.com/joelvh).
61
72
  * [#6](https://github.com/BrandyMint/grape-swagger-rails/pull/6): Added appName and appUrl configuration options - [@swistaczek](https://github.com/swistaczek).
62
73
 
63
- ### 0.0.4 (July 16, 2013)
74
+ ### 0.0.4 (2013/07/16)
64
75
 
65
76
  * Configure discoveryUrl from Rails - [@dapi](https://github.com/dapi).
66
77
  * Added default support for all HTTP methods - [@mtavaresOS](https://github.com/mtavaresOS).
67
78
 
68
- ### 0.0.3 (May 24, 2013)
79
+ ### 0.0.3 (2013/05/24)
69
80
 
70
81
  * Converted to Rails Engine - [@unloved](https://github.com/unloved).
71
82
 
72
- ### 0.0.1 (April 5, 2013)
83
+ ### 0.0.1 (2013/04/05)
73
84
 
74
85
  * Initial public release - [@radanisk](https://github.com/Radanisk).
data/Dangerfile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  danger.import_dangerfile(gem: 'ruby-grape-danger')
data/Gemfile CHANGED
@@ -1,26 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- case version = ENV['GRAPE_SWAGGER_VERSION'] || '~> 0.9.0'
7
+ case version = ENV['GRAPE_SWAGGER_VERSION'] || '~> 1.6.0'
6
8
  when 'HEAD'
7
- gem 'grape-swagger', github: 'tim-vandecasteele/grape-swagger'
8
- when '0.8.0'
9
- gem 'grape', '0.9.0'
10
- gem 'grape-swagger', '0.8.0'
11
- when '0.9.0'
12
- gem 'grape', '0.10.1'
13
- gem 'grape-swagger', '0.9.0'
14
- when '0.11.0'
15
- gem 'grape', '0.16.2'
16
- gem 'grape-swagger', '0.11.0'
17
- when '0.20.2'
18
- gem 'grape', '0.14.0'
19
- gem 'grape-swagger', '0.20.2'
9
+ gem 'grape-swagger', github: 'ruby-grape/grape-swagger'
20
10
  else
11
+ gem 'grape', '>= 1.3.0'
21
12
  gem 'grape-swagger', version
22
13
  end
23
14
 
24
- group :test do
25
- gem 'ruby-grape-danger', '~> 0.1.0', require: false
15
+ group :development, :test do
16
+ gem 'capybara'
17
+ gem 'grape-swagger-ui'
18
+ gem 'jquery-rails'
19
+ gem 'mime-types'
20
+ gem 'nokogiri'
21
+ gem 'rack', '< 3.0'
22
+ gem 'rack-cors'
23
+ gem 'rake'
24
+ gem 'rspec-rails'
25
+ gem 'rubocop'
26
+ gem 'rubocop-capybara'
27
+ gem 'rubocop-rake'
28
+ gem 'rubocop-rspec'
29
+ gem 'ruby-grape-danger', '~> 0.2.0', require: false
30
+ gem 'selenium-webdriver'
31
+ gem 'sprockets-rails', require: 'sprockets/railtie'
32
+ gem 'uglifier'
33
+ gem 'webrick'
26
34
  end
data/README.md CHANGED
@@ -1,11 +1,29 @@
1
1
  # GrapeSwaggerRails
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/grape-swagger-rails.svg)](http://badge.fury.io/rb/grape-swagger-rails)
4
- [![Build Status](https://travis-ci.org/ruby-grape/grape-swagger-rails.svg)](https://travis-ci.org/ruby-grape/grape-swagger-rails)
4
+ [![Test](https://github.com/ruby-grape/grape-swagger-rails/workflows/test/badge.svg?branch=master)](https://github.com/ruby-grape/grape-swagger-rails/actions)
5
5
  [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-swagger-rails/badges/gpa.svg)](https://codeclimate.com/github/ruby-grape/grape-swagger-rails)
6
6
 
7
7
  Swagger UI as Rails Engine for grape-swagger gem.
8
8
 
9
+ # Table of Contents
10
+
11
+ - [Installation](#installation)
12
+ - [Compatibility](#compatibility)
13
+ - [Usage](#usage)
14
+ - [Basic Authentication](#basic-authentication)
15
+ - [Pre-fill Authentication](#pre-fill-authentication)
16
+ - [API Token Authentication](#api-token-authentication)
17
+ - [Swagger UI Authorization](#swagger-ui-authorization)
18
+ - [Integration with DoorKeeper](#integration-with-doorkeeper)
19
+ - [Hiding the API or Authorization text boxes](#hiding-the-api-or-authorization-text-boxes)
20
+ - [Updating Swagger UI from Dist](#updating-swagger-ui-from-dist)
21
+ - [Enabling in a Rails-API Project](#enabling-in-a-rails-api-project)
22
+ - [Enabling in Rails 6 (Sprokets 5)](#enabling-in-rails-6-sprokets-5)
23
+ - [Contributors](#contributors)
24
+ - [Contributing](#contributing)
25
+ - [License](#license)
26
+
9
27
  ## Installation
10
28
 
11
29
  Add this line to your application's Gemfile:
@@ -140,9 +158,10 @@ by specify:
140
158
  GrapeSwaggerRails.options.api_auth = 'token'
141
159
  GrapeSwaggerRails.options.api_key_name = 'Authorization'
142
160
  GrapeSwaggerRails.options.api_key_type = 'header'
161
+ GrapeSwaggerRails.options.api_key_placeholder = 'authorization_token'
143
162
  ```
144
163
 
145
- You can use the ```api_key``` input box to fill in your API token.
164
+ You can use the ```authorization_token``` input box to fill in your API token.
146
165
  ### Swagger UI Authorization
147
166
 
148
167
  You may want to authenticate users before displaying the Swagger UI, particularly when the API is protected by Basic Authentication.
@@ -221,6 +240,17 @@ Include CSS stylesheets in `app/assets/stylesheets/application.css`.
221
240
  */
222
241
  ```
223
242
 
243
+ ### Enabling in Rails 6 (Sprokets 5)
244
+
245
+ Rails 6 top-level targets are determined via `./app/assets/config/manifest.js`. Specify `grape-swagger-rails` asset files as follows.
246
+
247
+ ```javascript
248
+ //= link grape_swagger_rails/application.css
249
+ //= link grape_swagger_rails/application.js
250
+ ```
251
+
252
+ See [Upgrading Sprokets](https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs) for more information.
253
+
224
254
  ## Contributors
225
255
 
226
256
  * [unloved](https://github.com/unloved)
data/RELEASING.md CHANGED
@@ -11,12 +11,12 @@ bundle install
11
11
  rake
12
12
  ```
13
13
 
14
- Check that the last build succeeded in [Travis CI](https://travis-ci.org/ruby-grape/grape-swagger-rails) for all supported platforms.
14
+ Check that the last build succeeded in [GitHub Actions](https://github.com/ruby-grape/grape-swagger-rails/actions) for all supported platforms.
15
15
 
16
16
  Increment the version, modify [lib/grape-swagger-rails/version.rb](lib/grape-swagger-rails/version.rb).
17
17
 
18
- * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.1.0` to `0.1.1`).
19
- * Increment the second number if the release contains major features or breaking API changes (eg. change `0.1.0` to `0.2.0`).
18
+ * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.1.0` to `0.1.1`).
19
+ * Increment the second number if the release contains major features or breaking API changes (eg. change `0.1.0` to `0.2.0`).
20
20
 
21
21
  Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
22
22
 
@@ -50,8 +50,7 @@ Pushed grape-swagger-rails 0.1.1 to rubygems.org.
50
50
  Add the next release to [CHANGELOG.md](CHANGELOG.md).
51
51
 
52
52
  ```
53
- Next Release
54
- ============
53
+ ### Next Release
55
54
 
56
55
  * Your contribution here.
57
56
  ```
data/Rakefile CHANGED
@@ -1,14 +1,10 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
1
+ # frozen_string_literal: true
7
2
 
8
- APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
3
+ require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
9
5
 
6
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
10
7
  load 'rails/tasks/engine.rake'
11
- Bundler::GemHelper.install_tasks
12
8
 
13
9
  Dir[File.join(File.dirname(__FILE__), 'lib/tasks/**/*.rake')].each do |f|
14
10
  load f
@@ -23,4 +19,4 @@ RSpec::Core::RakeTask.new(:spec)
23
19
  require 'rubocop/rake_task'
24
20
  RuboCop::RakeTask.new(:rubocop)
25
21
 
26
- task default: [:rubocop, :spec]
22
+ task default: %i[rubocop spec]
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets/grape_swagger_rails .css
2
+ //= link_directory ../javascripts/grape_swagger_rails .js
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GrapeSwaggerRails
2
4
  class ApplicationController < ActionController::Base
3
5
  if Rails::VERSION::MAJOR >= 4
@@ -6,13 +8,13 @@ module GrapeSwaggerRails
6
8
  before_filter { run_before_action }
7
9
  end
8
10
 
9
- def index
10
- end
11
+ def index; end
11
12
 
12
13
  private
13
14
 
14
15
  def run_before_action
15
16
  return unless GrapeSwaggerRails.options.before_action
17
+
16
18
  instance_exec(request, &GrapeSwaggerRails.options.before_action)
17
19
  end
18
20
  end
@@ -96,7 +96,7 @@
96
96
 
97
97
  <form id='api_selector'>
98
98
  <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
99
- <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text" value="<%= GrapeSwaggerRails.options.api_key_default_value %>"/></div>
99
+ <div class='input'><input placeholder="<%= GrapeSwaggerRails.options.api_key_placeholder %>" id="input_apiKey" name="apiKey" type="text" value="<%= GrapeSwaggerRails.options.api_key_default_value %>"/></div>
100
100
  <div class='input'><a id="explore" class="exploreBtn" href="#">Explore</a></div>
101
101
  </form>
102
102
  </div>
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  GrapeSwaggerRails::Engine.routes.draw do
2
4
  root to: 'application#index'
3
5
  end
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'grape-swagger-rails/version'
5
6
 
@@ -8,34 +9,17 @@ Gem::Specification.new do |spec|
8
9
  spec.version = GrapeSwaggerRails::VERSION
9
10
  spec.authors = ['Alexander Logunov']
10
11
  spec.email = ['unlovedru@gmail.com']
11
- spec.description = 'Swagger UI as Rails Engine for grape-swagger gem'
12
- spec.summary = 'Swagger UI as Rails Engine for grape-swagger gem'
12
+ spec.description = 'Swagger UI as Rails Engine for grape-swagger gem.'
13
+ spec.summary = 'Swagger UI as Rails Engine for grape-swagger gem.'
13
14
  spec.homepage = 'https://github.com/ruby-grape/grape-swagger-rails'
14
15
  spec.license = 'MIT'
15
16
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
- spec.test_files = `git ls-files spec`.split($INPUT_RECORD_SEPARATOR)
17
- spec.require_paths = %w(lib)
18
-
19
- spec.add_dependency 'railties', '>= 3.2.12'
20
-
21
- spec.add_development_dependency 'bundler', '~> 1.15'
22
- spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'git'
24
- spec.add_development_dependency 'rspec-rails'
25
- spec.add_development_dependency 'capybara'
26
- spec.add_development_dependency 'grape'
27
- spec.add_development_dependency 'grape-swagger', '>= 0.7.2'
28
- spec.add_development_dependency 'selenium-webdriver'
29
- spec.add_development_dependency 'sass-rails'
30
- spec.add_development_dependency 'uglifier'
31
- spec.add_development_dependency 'coffee-rails'
32
- spec.add_development_dependency 'jquery-rails'
33
- spec.add_development_dependency 'grape-swagger-ui'
34
- spec.add_development_dependency 'sprockets'
35
- spec.add_development_dependency 'rack', '~> 1.6'
36
- spec.add_development_dependency 'rack-cors'
37
- spec.add_development_dependency 'rubocop', '0.38.0'
38
- spec.add_development_dependency 'mime-types', '< 3.0'
39
- spec.add_development_dependency 'rack-no_animations'
40
- spec.add_development_dependency 'nokogiri', '< 1.7.0'
17
+ spec.require_paths = %w[lib]
18
+ spec.add_dependency 'railties', '>= 6.0.6.1'
19
+ spec.metadata = {
20
+ 'bug_tracker_uri' => 'https://github.com/ruby-grape/grape-swagger-rails/issues',
21
+ 'changelog_uri' => 'https://github.com/ruby-grape/grape-swagger-rails/blob/master/CHANGELOG.md',
22
+ 'source_code_uri' => "https://github.com/ruby-grape/grape-swagger-rails/tree/v#{GrapeSwaggerRails::VERSION}",
23
+ 'rubygems_mfa_required' => 'true'
24
+ }
41
25
  end