grape-swagger-rails 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/head.yml +32 -0
  3. data/.github/workflows/rubocop.yml +14 -0
  4. data/.github/workflows/test.yml +11 -19
  5. data/.rubocop.yml +7 -2
  6. data/.rubocop_todo.yml +78 -125
  7. data/CHANGELOG.md +9 -0
  8. data/Dangerfile +2 -0
  9. data/Gemfile +8 -7
  10. data/README.md +2 -1
  11. data/Rakefile +5 -9
  12. data/app/assets/config/grape_swagger_rails_manifest.js +2 -0
  13. data/app/controllers/grape_swagger_rails/application_controller.rb +4 -2
  14. data/app/views/grape_swagger_rails/application/index.html.erb +1 -1
  15. data/config/routes.rb +2 -0
  16. data/grape-swagger-rails.gemspec +10 -4
  17. data/lib/grape-swagger-rails/engine.rb +2 -0
  18. data/lib/grape-swagger-rails/version.rb +3 -1
  19. data/lib/grape-swagger-rails.rb +17 -14
  20. data/lib/script/rails +4 -2
  21. data/lib/tasks/swagger_ui.rake +6 -3
  22. data/spec/dummy/Rakefile +6 -3
  23. data/spec/dummy/app/api/api.rb +2 -0
  24. data/spec/dummy/app/assets/config/manifest.js +3 -4
  25. data/spec/dummy/app/assets/javascripts/application.js +0 -2
  26. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  27. data/spec/dummy/app/controllers/welcome_controller.rb +3 -2
  28. data/spec/dummy/app/views/layouts/application.html.erb +1 -0
  29. data/spec/dummy/bin/rails +3 -5
  30. data/spec/dummy/bin/rake +2 -4
  31. data/spec/dummy/bin/setup +27 -0
  32. data/spec/dummy/config/application.rb +11 -10
  33. data/spec/dummy/config/boot.rb +4 -7
  34. data/spec/dummy/config/environment.rb +6 -2
  35. data/spec/dummy/config/environments/development.rb +40 -19
  36. data/spec/dummy/config/environments/production.rb +31 -31
  37. data/spec/dummy/config/environments/test.rb +30 -20
  38. data/spec/dummy/config/initializers/assets.rb +13 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +10 -0
  40. data/spec/dummy/config/initializers/inflections.rb +15 -0
  41. data/spec/dummy/config/initializers/swagger.rb +2 -0
  42. data/spec/dummy/config/routes.rb +2 -0
  43. data/spec/dummy/config.ru +6 -2
  44. data/spec/dummy/public/404.html +6 -6
  45. data/spec/dummy/public/422.html +6 -6
  46. data/spec/dummy/public/500.html +6 -6
  47. data/spec/features/grape-swagger-rails_spec.rb +5 -1
  48. data/spec/features/swagger_spec.rb +97 -35
  49. data/spec/features/welcome_spec.rb +3 -0
  50. data/spec/spec_helper.rb +4 -2
  51. data/spec/support/capybara.rb +2 -0
  52. data/spec/support/rails.rb +2 -0
  53. metadata +16 -56
  54. data/spec/dummy/bin/bundle +0 -3
  55. data/spec/dummy/bin/spring +0 -18
  56. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -1
  57. data/spec/dummy/config/initializers/session_store.rb +0 -1
  58. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  59. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de0a074a12ae467fe6e2ee5941f8efd906d5350eee5e39edf2503916c6be9c5b
4
- data.tar.gz: 727ff6e73e22a466b559e848971aca21cfabfc6cda38aaedcf2d1e19e7d78fb8
3
+ metadata.gz: d4c9588b4ccf8e66253f11a742506fc512c9a70d4d0f32c8ec72db06bdc47af5
4
+ data.tar.gz: 3148cee4aad16dced2e22f6f8639e6daa1c3190fcb46c9bc1627cdc385861d9c
5
5
  SHA512:
6
- metadata.gz: 5e88a46e45e9809d1b1870a9efa9e204b918099e4cc070bbb73d5edc4261fa22939cf1b0fb3ee583c0c7a91f88d5fa4e9f848508635eb3098ff2e93453f13439
7
- data.tar.gz: f087a0aa5ce0479b9cff260c30df08cca47d426b5bf390cbc9d54311051f9767da873378542181b5ee640b15b7abe40990fdb79ec4e498943754016465b2585c
6
+ metadata.gz: 91b7f33ff1190d15f16937087ca698a94e2daf43aed206b80821bbc879d1cdeac98e7fe151d1a5414fa50ae649adaa293d87ac0fd06135540903159ff8ed0e98
7
+ data.tar.gz: 69968abc92dc53117812b3901cb98baa72036496005fc5ba65fc7b759eb9a0e40536af7bbcd0f4cced9567a7e7687b53144bb18599731554569fd0f2f4938f50
@@ -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
@@ -1,35 +1,27 @@
1
1
  name: Tests
2
- on:
3
- push:
4
- branches:
5
- - master
6
- pull_request:
2
+ on: [push, pull_request]
7
3
  jobs:
8
4
  test:
9
5
  runs-on: ubuntu-latest
10
- continue-on-error: ${{ (matrix.grape-swagger.experimental) || (matrix.ruby.experimental) }}
11
6
  strategy:
12
7
  fail-fast: false
13
8
  matrix:
14
- grape-swagger:
15
- - { version: "1.6.0", experimental: false }
16
- - { version: "HEAD", experimental: true }
17
- ruby:
18
- - { version: "2.7", experimental: false }
19
- - { version: "3.0", experimental: false }
20
- - { version: "3.1", experimental: false }
21
- - { version: "3.2", experimental: false }
22
- - { version: "ruby-head", experimental: true }
23
- - { version: "jruby-9.4.2", experimental: false }
24
- - { version: "jruby-head", experimental: true }
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" }
25
17
  env:
26
- GRAPE_SWAGGER_VERSION: ${{ matrix.grape-swagger.version }}
18
+ GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
27
19
  steps:
28
20
  - uses: actions/checkout@v3
29
21
  - name: Set up Ruby
30
22
  uses: ruby/setup-ruby@v1
31
23
  with:
32
- ruby-version: ${{ matrix.ruby.version }}
24
+ ruby-version: ${{ matrix.entry.ruby }}
33
25
  bundler-cache: true
34
26
  - name: Setup Firefox
35
27
  uses: browser-actions/setup-firefox@v1
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,105 +1,116 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-12-08 10:39:57 -0500 using RuboCop version 0.77.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: 8
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
12
- Bundler/DuplicatedGem:
13
- Exclude:
14
- - 'Gemfile'
15
-
16
- # Offense count: 8
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
19
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
20
- Bundler/OrderedGems:
9
+ # Offense count: 6
10
+ # Configuration parameters: EnforcedStyle.
11
+ # SupportedStyles: link_or_button, strict
12
+ Capybara/ClickLinkOrButtonStyle:
21
13
  Exclude:
22
- - 'Gemfile'
14
+ - 'spec/features/swagger_spec.rb'
23
15
 
24
16
  # Offense count: 1
25
- # Cop supports --auto-correct.
26
- Layout/EmptyLineAfterGuardClause:
17
+ Capybara/SpecificMatcher:
27
18
  Exclude:
28
- - 'app/controllers/grape_swagger_rails/application_controller.rb'
19
+ - 'spec/features/welcome_spec.rb'
29
20
 
30
21
  # Offense count: 1
31
- # Cop supports --auto-correct.
32
- Layout/EmptyLineAfterMagicComment:
22
+ # Configuration parameters: Severity, Include.
23
+ # Include: **/*.gemspec
24
+ Gemspec/RequiredRubyVersion:
33
25
  Exclude:
34
26
  - 'grape-swagger-rails.gemspec'
35
27
 
28
+ # Offense count: 2
29
+ # Configuration parameters: AllowedMethods.
30
+ # AllowedMethods: enums
31
+ Lint/ConstantDefinitionInBlock:
32
+ Exclude:
33
+ - 'lib/tasks/swagger_ui.rake'
34
+
36
35
  # Offense count: 1
37
- # Cop supports --auto-correct.
38
- Layout/EmptyLinesAroundArguments:
36
+ Lint/MixedRegexpCaptureTypes:
39
37
  Exclude:
40
- - 'lib/grape-swagger-rails.rb'
38
+ - 'lib/tasks/swagger_ui.rake'
41
39
 
42
- # Offense count: 12
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
45
- # SupportedHashRocketStyles: key, separator, table
46
- # SupportedColonStyles: key, separator, table
47
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
48
- Layout/HashAlignment:
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:
49
51
  Exclude:
50
52
  - 'lib/grape-swagger-rails.rb'
53
+ - 'spec/features/grape-swagger-rails_spec.rb'
51
54
 
52
- # Offense count: 1
53
- Lint/AmbiguousRegexpLiteral:
55
+ # Offense count: 13
56
+ # Configuration parameters: Prefixes, AllowedPatterns.
57
+ # Prefixes: when, with, without
58
+ RSpec/ContextWording:
54
59
  Exclude:
55
- - 'lib/tasks/swagger_ui.rake'
60
+ - 'spec/features/swagger_spec.rb'
56
61
 
57
62
  # Offense count: 1
58
- # Configuration parameters: AllowSafeAssignment.
59
- Lint/AssignmentInCondition:
63
+ # This cop supports unsafe autocorrection (--autocorrect-all).
64
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
65
+ # SupportedStyles: described_class, explicit
66
+ RSpec/DescribedClass:
60
67
  Exclude:
61
- - 'spec/dummy/bin/spring'
68
+ - 'spec/features/grape-swagger-rails_spec.rb'
62
69
 
63
- # Offense count: 2
64
- # Cop supports --auto-correct.
65
- Lint/ScriptPermission:
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:
66
79
  Exclude:
67
- - 'Rakefile'
68
- - 'spec/dummy/Rakefile'
80
+ - 'spec/features/grape-swagger-rails_spec.rb'
69
81
 
70
82
  # Offense count: 2
71
- # Configuration parameters: AllowComments.
72
- Lint/SuppressedException:
83
+ # Configuration parameters: AssignmentOnly.
84
+ RSpec/InstanceVariable:
73
85
  Exclude:
74
- - 'spec/dummy/bin/rails'
75
- - 'spec/dummy/bin/rake'
86
+ - 'spec/features/swagger_spec.rb'
76
87
 
77
- # Offense count: 9
78
- # Configuration parameters: CountComments, ExcludedMethods.
79
- # ExcludedMethods: refine
80
- Metrics/BlockLength:
81
- Max: 282
88
+ # Offense count: 12
89
+ RSpec/MultipleExpectations:
90
+ Max: 4
82
91
 
83
92
  # Offense count: 2
84
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
85
- # 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
86
- Naming/FileName:
93
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
94
+ # SupportedStyles: always, named_only
95
+ RSpec/NamedSubject:
87
96
  Exclude:
88
- - 'lib/grape-swagger-rails.rb'
89
97
  - 'spec/features/grape-swagger-rails_spec.rb'
90
98
 
91
- # Offense count: 2
92
- # Cop supports --auto-correct.
93
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
94
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
95
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
96
- # FunctionalMethods: let, let!, subject, watch
97
- # IgnoredMethods: lambda, proc, it
98
- Style/BlockDelimiters:
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:
99
108
  Exclude:
100
- - 'lib/tasks/swagger_ui.rake'
109
+ - '**/spec/routing/**/*'
110
+ - 'spec/features/grape-swagger-rails_spec.rb'
101
111
 
102
112
  # Offense count: 4
113
+ # Configuration parameters: AllowedConstants.
103
114
  Style/Documentation:
104
115
  Exclude:
105
116
  - 'spec/**/*'
@@ -108,72 +119,14 @@ Style/Documentation:
108
119
  - 'lib/grape-swagger-rails.rb'
109
120
  - 'lib/grape-swagger-rails/engine.rb'
110
121
 
111
- # Offense count: 2
112
- # Cop supports --auto-correct.
113
- # Configuration parameters: EnforcedStyle.
114
- # SupportedStyles: compact, expanded
115
- Style/EmptyMethod:
116
- Exclude:
117
- - 'app/controllers/grape_swagger_rails/application_controller.rb'
118
- - 'spec/dummy/app/controllers/welcome_controller.rb'
119
-
120
122
  # Offense count: 1
121
- # Cop supports --auto-correct.
122
- Style/Encoding:
123
- Exclude:
124
- - 'grape-swagger-rails.gemspec'
125
-
126
- # Offense count: 14
127
- # Cop supports --auto-correct.
128
- Style/ExpandPathArguments:
129
- Exclude:
130
- - 'Rakefile'
131
- - 'grape-swagger-rails.gemspec'
132
- - 'lib/script/rails'
133
- - 'lib/tasks/swagger_ui.rake'
134
- - 'spec/dummy/Rakefile'
135
- - 'spec/dummy/bin/bundle'
136
- - 'spec/dummy/bin/rails'
137
- - 'spec/dummy/bin/rake'
138
- - 'spec/dummy/config/application.rb'
139
- - 'spec/dummy/config/boot.rb'
140
- - 'spec/dummy/config/environment.rb'
141
- - 'spec/spec_helper.rb'
142
-
143
- # Offense count: 37
144
- # Cop supports --auto-correct.
145
- # Configuration parameters: EnforcedStyle.
146
- # SupportedStyles: always, never
147
- Style/FrozenStringLiteralComment:
148
- Enabled: false
149
-
150
- # Offense count: 3
151
- # Cop supports --auto-correct.
152
- # Configuration parameters: PreferredDelimiters.
153
- Style/PercentLiteralDelimiters:
123
+ Style/OpenStructUse:
154
124
  Exclude:
155
- - 'grape-swagger-rails.gemspec'
156
125
  - 'lib/grape-swagger-rails.rb'
157
- - 'spec/features/swagger_spec.rb'
158
-
159
- # Offense count: 1
160
- # Cop supports --auto-correct.
161
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
162
- # SupportedStyles: slashes, percent_r, mixed
163
- Style/RegexpLiteral:
164
- Exclude:
165
- - 'lib/tasks/swagger_ui.rake'
166
126
 
167
127
  # Offense count: 2
168
- # Cop supports --auto-correct.
169
- # Configuration parameters: MinSize.
170
- # SupportedStyles: percent, brackets
171
- Style/SymbolArray:
172
- EnforcedStyle: brackets
173
-
174
- # Offense count: 48
175
- # Cop supports --auto-correct.
176
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
128
+ # This cop supports safe autocorrection (--autocorrect).
129
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
177
130
  # URISchemes: http, https
178
- Metrics/LineLength:
179
- Max: 129
131
+ Layout/LineLength:
132
+ Max: 143
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.5.0 (2024/04/06)
2
+
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).
9
+
1
10
  ### 0.4.0 (2023/03/28)
2
11
 
3
12
  * [#107](https://github.com/ruby-grape/grape-swagger-rails/pull/107): Add test matrix for multiple ruby versions - [@duffn](https://github.com/duffn).
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -6,28 +8,27 @@ case version = ENV['GRAPE_SWAGGER_VERSION'] || '~> 1.6.0'
6
8
  when 'HEAD'
7
9
  gem 'grape-swagger', github: 'ruby-grape/grape-swagger'
8
10
  else
9
- gem 'grape-swagger', version
10
11
  gem 'grape', '>= 1.3.0'
12
+ gem 'grape-swagger', version
11
13
  end
12
14
 
13
15
  group :development, :test do
14
16
  gem 'capybara'
15
- gem 'coffee-rails'
16
17
  gem 'grape-swagger-ui'
17
18
  gem 'jquery-rails'
18
19
  gem 'mime-types'
19
20
  gem 'nokogiri'
20
21
  gem 'rack', '< 3.0'
21
22
  gem 'rack-cors'
22
- gem 'rack-no_animations'
23
23
  gem 'rake'
24
24
  gem 'rspec-rails'
25
- gem 'rubocop', '0.77.0'
25
+ gem 'rubocop'
26
+ gem 'rubocop-capybara'
27
+ gem 'rubocop-rake'
28
+ gem 'rubocop-rspec'
26
29
  gem 'ruby-grape-danger', '~> 0.2.0', require: false
27
- gem 'sass'
28
- gem 'sass-rails'
29
30
  gem 'selenium-webdriver'
30
- gem 'sprockets'
31
+ gem 'sprockets-rails', require: 'sprockets/railtie'
31
32
  gem 'uglifier'
32
33
  gem 'webrick'
33
34
  end
data/README.md CHANGED
@@ -158,9 +158,10 @@ by specify:
158
158
  GrapeSwaggerRails.options.api_auth = 'token'
159
159
  GrapeSwaggerRails.options.api_key_name = 'Authorization'
160
160
  GrapeSwaggerRails.options.api_key_type = 'header'
161
+ GrapeSwaggerRails.options.api_key_placeholder = 'authorization_token'
161
162
  ```
162
163
 
163
- 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.
164
165
  ### Swagger UI Authorization
165
166
 
166
167
  You may want to authenticate users before displaying the Swagger UI, particularly when the API is protected by Basic Authentication.
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'grape-swagger-rails/version'
@@ -7,13 +9,17 @@ Gem::Specification.new do |spec|
7
9
  spec.version = GrapeSwaggerRails::VERSION
8
10
  spec.authors = ['Alexander Logunov']
9
11
  spec.email = ['unlovedru@gmail.com']
10
- spec.description = 'Swagger UI as Rails Engine for grape-swagger gem'
11
- 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.'
12
14
  spec.homepage = 'https://github.com/ruby-grape/grape-swagger-rails'
13
15
  spec.license = 'MIT'
14
16
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
15
- spec.test_files = `git ls-files spec`.split($INPUT_RECORD_SEPARATOR)
16
17
  spec.require_paths = %w[lib]
17
-
18
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
+ }
19
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GrapeSwaggerRails
2
4
  class Engine < ::Rails::Engine
3
5
  paths['lib/tasks'] = 'lib/tasks/exported'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GrapeSwaggerRails
2
- VERSION = '0.4.0'.freeze
4
+ VERSION = '0.5.0'
3
5
  end
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'grape-swagger-rails/engine'
4
+ require 'ostruct'
2
5
 
3
6
  module GrapeSwaggerRails
4
7
  class Options < OpenStruct
@@ -20,24 +23,24 @@ module GrapeSwaggerRails
20
23
  mattr_accessor :options
21
24
 
22
25
  self.options = Options.new(
26
+ url: '/swagger_doc',
27
+ app_name: 'Swagger',
28
+ app_url: 'http://swagger.wordnik.com',
23
29
 
24
- url: '/swagger_doc',
25
- app_name: 'Swagger',
26
- app_url: 'http://swagger.wordnik.com',
27
-
28
- headers: {},
30
+ headers: {},
29
31
 
30
- api_auth: '', # 'basic' or 'bearer'
31
- api_key_name: 'api_key', # 'Authorization'
32
- api_key_type: 'query', # 'header'
33
- api_key_default_value: '', # Auto populates api_key
32
+ api_auth: '', # 'basic' or 'bearer'
33
+ api_key_name: 'api_key', # 'Authorization'
34
+ api_key_type: 'query', # 'header'
35
+ api_key_default_value: '', # Auto populates api_key
36
+ api_key_placeholder: 'api_key', # Placeholder for api_key input
34
37
 
35
- doc_expansion: 'none',
36
- supported_submit_methods: %w(get post put delete patch),
38
+ doc_expansion: 'none',
39
+ supported_submit_methods: %w[get post put delete patch],
37
40
 
38
- before_action_proc: nil, # Proc used as a controller before action
41
+ before_action_proc: nil, # Proc used as a controller before action
39
42
 
40
- hide_url_input: false,
41
- hide_api_key_input: false
43
+ hide_url_input: false,
44
+ hide_api_key_input: false
42
45
  )
43
46
  end
data/lib/script/rails CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
5
 
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/grape-swagger-rails/engine', __FILE__)
6
+ ENGINE_ROOT = File.expand_path('..', __dir__)
7
+ ENGINE_PATH = File.expand_path('../lib/grape-swagger-rails/engine', __dir__)
6
8
 
7
9
  require 'rails/all'
8
10
  require 'rails/engine/commands'