grape-path-helpers 1.2.0 → 1.3.0

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: b434b7d1b56cd5b639816b364d237e3bd658b0cfe03c0d516c3135794a02bca6
4
- data.tar.gz: 4d2958b9bb94e83fa61bb465ef564b100e1e1ff63dbb8748dbc821f4240b88e8
3
+ metadata.gz: 4d73093a0f054919e2ad15c91772f4e7efac0ce0197d49d3be5ad5175df80a98
4
+ data.tar.gz: a1e486c0b0c076edc6c6bc5411184c97fbd2e5e861b83747e1d273faffdf0ba3
5
5
  SHA512:
6
- metadata.gz: dd5def728204b01e35b74e86d9c3b5115864b8e2ac1d1e912b0a7d6a623fda80a1ccbd855464f6cea73159280867eef46b33891aab34e883429dcb56051849be
7
- data.tar.gz: d3c3dd5cace700e833448314055f7253ab93bf02af69ed70a4384f7e5176ac3914056cdf37000b3b1662fc9b0d23d5c1d8ab20d2bd147acb727edf7e41733958
6
+ metadata.gz: 5491f91f2177f6ee3ba5575255a1e693dd6edae69da9a1733a5479e8a2478007b2c07abe0f5d1ac8d01e234dfeae1f45c4ae1fcc3982bb23854a3da16f0def0a
7
+ data.tar.gz: f93f9038b288580fe66cc166993eb58dcfb1fa34cde384c49c03fde0d6f1c33961a6b98622a1ab16099dcd92a40b5217ecce965ba6c0649d80db4f5d276fd8fd
@@ -1,4 +1,4 @@
1
- image: "ruby:2.4-alpine"
1
+ image: "ruby:2.6-alpine"
2
2
 
3
3
  cache:
4
4
  paths:
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ * [Upgrade to Grape 1.3.1](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/21)
6
+
3
7
  ## 1.2.0
4
8
 
5
9
  * [Add wildcard segments support](https://gitlab.com/gitlab-org/grape-path-helpers/merge_requests/16)
@@ -1,48 +1,62 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-path-helpers (1.0.6)
5
- activesupport (>= 4, < 5.1)
6
- grape (~> 1.0)
4
+ grape-path-helpers (1.3.0)
5
+ activesupport
6
+ grape (~> 1.3)
7
7
  rake (~> 12)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (5.0.7)
12
+ activesupport (6.0.2.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.2)
17
18
  ast (2.4.0)
18
- axiom-types (0.1.1)
19
- descendants_tracker (~> 0.0.4)
20
- ice_nine (~> 0.11.0)
21
- thread_safe (~> 0.3, >= 0.3.1)
22
- builder (3.2.3)
19
+ builder (3.2.4)
23
20
  coderay (1.1.2)
24
- coercible (1.0.0)
25
- descendants_tracker (~> 0.0.1)
26
- concurrent-ruby (1.0.5)
27
- descendants_tracker (0.0.4)
28
- thread_safe (~> 0.3, >= 0.3.1)
21
+ concurrent-ruby (1.1.6)
29
22
  diff-lcs (1.3)
30
- equalizer (0.0.11)
31
- grape (1.0.3)
23
+ dry-configurable (0.11.3)
24
+ concurrent-ruby (~> 1.0)
25
+ dry-core (~> 0.4, >= 0.4.7)
26
+ dry-equalizer (~> 0.2)
27
+ dry-container (0.7.2)
28
+ concurrent-ruby (~> 1.0)
29
+ dry-configurable (~> 0.1, >= 0.1.3)
30
+ dry-core (0.4.9)
31
+ concurrent-ruby (~> 1.0)
32
+ dry-equalizer (0.3.0)
33
+ dry-inflector (0.2.0)
34
+ dry-logic (1.0.6)
35
+ concurrent-ruby (~> 1.0)
36
+ dry-core (~> 0.2)
37
+ dry-equalizer (~> 0.2)
38
+ dry-types (1.4.0)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-container (~> 0.3)
41
+ dry-core (~> 0.4, >= 0.4.4)
42
+ dry-equalizer (~> 0.3)
43
+ dry-inflector (~> 0.1, >= 0.1.2)
44
+ dry-logic (~> 1.0, >= 1.0.2)
45
+ grape (1.3.1)
32
46
  activesupport
33
47
  builder
48
+ dry-types (>= 1.1)
34
49
  mustermann-grape (~> 1.0.0)
35
50
  rack (>= 1.3.0)
36
51
  rack-accept
37
- virtus (>= 1.0.0)
38
- i18n (1.0.1)
52
+ i18n (1.8.2)
39
53
  concurrent-ruby (~> 1.0)
40
- ice_nine (0.11.2)
41
54
  method_source (0.9.0)
42
- minitest (5.11.3)
43
- mustermann (1.0.2)
44
- mustermann-grape (1.0.0)
45
- mustermann (~> 1.0.0)
55
+ minitest (5.14.0)
56
+ mustermann (1.1.1)
57
+ ruby2_keywords (~> 0.0.1)
58
+ mustermann-grape (1.0.1)
59
+ mustermann (>= 1.0.0)
46
60
  parallel (1.12.1)
47
61
  parser (2.5.1.0)
48
62
  ast (~> 2.4.0)
@@ -50,11 +64,11 @@ GEM
50
64
  pry (0.11.3)
51
65
  coderay (~> 1.1.0)
52
66
  method_source (~> 0.9.0)
53
- rack (2.0.5)
67
+ rack (2.2.2)
54
68
  rack-accept (0.4.5)
55
69
  rack (>= 0.4)
56
70
  rainbow (3.0.0)
57
- rake (12.3.1)
71
+ rake (12.3.3)
58
72
  rspec (3.7.0)
59
73
  rspec-core (~> 3.7.0)
60
74
  rspec-expectations (~> 3.7.0)
@@ -76,15 +90,12 @@ GEM
76
90
  ruby-progressbar (~> 1.7)
77
91
  unicode-display_width (~> 1.0, >= 1.0.1)
78
92
  ruby-progressbar (1.9.0)
93
+ ruby2_keywords (0.0.2)
79
94
  thread_safe (0.3.6)
80
- tzinfo (1.2.5)
95
+ tzinfo (1.2.6)
81
96
  thread_safe (~> 0.1)
82
97
  unicode-display_width (1.3.3)
83
- virtus (1.0.5)
84
- axiom-types (~> 0.1)
85
- coercible (~> 1.0)
86
- descendants_tracker (~> 0.0, >= 0.0.3)
87
- equalizer (~> 0.0, >= 0.0.9)
98
+ zeitwerk (2.3.0)
88
99
 
89
100
  PLATFORMS
90
101
  ruby
@@ -96,4 +107,4 @@ DEPENDENCIES
96
107
  rubocop (~> 0.56)
97
108
 
98
109
  BUNDLED WITH
99
- 1.16.2
110
+ 1.17.3
@@ -1,6 +1,7 @@
1
1
  MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Harper Henn
3
+ Copyright (c) 2015,2016 Harper Henn
4
+ Copyright (c) 2018-2020 GitLab B.V.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # grape-path-helpers
2
2
 
3
- [![Build status](https://gitlab.com/gitlab-org/grape-path-helpers/badges/master/build.svg)](https://gitlab.com/gitlab-org/grape-path-helpers/commits/master)
3
+ [![Build status](https://gitlab.com/gitlab-org/grape-path-helpers/badges/master/pipeline.svg)](https://gitlab.com/gitlab-org/grape-path-helpers/commits/master)
4
4
 
5
5
  Provides named route helpers for Grape APIs, similar to [Rails' route helpers](http://edgeguides.rubyonrails.org/routing.html#path-and-url-helpers).
6
6
 
7
- **This is a fork and rename of [group-route-helpers](https://github.com/reprah/grape-route-helpers). It [includes some fixes](CHANGELOG.md) needed for GitLab.**
7
+ **This is a fork and rename of [grape-route-helpers](https://github.com/reprah/grape-route-helpers). It [includes some fixes](CHANGELOG.md) needed for GitLab.**
8
8
 
9
9
  ### Installation
10
10
 
@@ -76,7 +76,7 @@ You can use helper methods in your REPL session by including a module:
76
76
  Use the methods inside your Grape API actions. Given this example API:
77
77
 
78
78
  ```ruby
79
- class ExampleAPI < Grape::API
79
+ class ExampleAPI < Grape::API::Instance
80
80
  version 'v1'
81
81
  prefix 'api'
82
82
  format 'json'
@@ -127,7 +127,7 @@ api_v1_anything_path # => '/api/v1/*anything'
127
127
  If you want to assign a custom helper name to a route, pass the `:as` option when creating your route in your API:
128
128
 
129
129
  ```ruby
130
- class Base < Grape::API
130
+ class Base < Grape::API::Instance
131
131
  get 'ping', as: 'is_the_server_running'
132
132
  'pong'
133
133
  end
@@ -169,6 +169,14 @@ end
169
169
 
170
170
  6.) Create a new pull request
171
171
 
172
+ ### Releasing
173
+
174
+ 1. Update the [CHANGELOG](CHANGELOG.md).
175
+ 2. Update the version in [lib/grape-path-helpers/version.rb](lib/grape-path-helpers/version.rb).
176
+ 3. [Tag](https://gitlab.com/gitlab-org/grape-path-helpers/-/tags) the commit with the version number prefixed by 'v'.
177
+ 4. Run `gem build grape-path-helpers` locally.
178
+ 5. Run `gem push $new_file.gem` locally, where `$new_file` is the file generated by the step above.
179
+
172
180
  ### License
173
181
 
174
182
  See LICENSE
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.homepage = 'https://gitlab.com/gitlab-org/grape-path-helpers'
13
13
 
14
14
  gem.add_runtime_dependency 'activesupport'
15
- gem.add_runtime_dependency 'grape', '~> 1.0'
15
+ gem.add_runtime_dependency 'grape', '~> 1.3'
16
16
  gem.add_runtime_dependency 'rake', '~> 12'
17
17
 
18
18
  gem.add_development_dependency 'pry', '~> 0.11'
@@ -12,5 +12,5 @@ module GrapePathHelpers
12
12
  require 'grape-path-helpers/railtie' if defined?(Rails)
13
13
  end
14
14
 
15
- Grape::API.extend GrapePathHelpers::AllRoutes
15
+ Grape::API::Instance.extend GrapePathHelpers::AllRoutes
16
16
  Grape::Endpoint.send(:include, GrapePathHelpers::NamedRouteMatcher)
@@ -8,7 +8,7 @@ module GrapePathHelpers
8
8
 
9
9
  segments = arguments.first || {}
10
10
 
11
- route = Grape::API.decorated_routes.detect do |r|
11
+ route = Grape::API::Instance.decorated_routes.detect do |r|
12
12
  route_match?(r, method_id, segments)
13
13
  end
14
14
 
@@ -22,7 +22,7 @@ module GrapePathHelpers
22
22
  def respond_to_missing?(method_name, _include_private = false)
23
23
  return super unless method_name =~ /_path$/
24
24
 
25
- Grape::API.decorated_routes.detect do |route|
25
+ Grape::API::Instance.decorated_routes.detect do |route|
26
26
  return true if route.respond_to?(method_name)
27
27
  end
28
28
 
@@ -3,7 +3,7 @@ module GrapePathHelpers
3
3
  # and required arguments for every Grape::Route.
4
4
  class RouteDisplayer
5
5
  def route_attributes
6
- Grape::API.decorated_routes.map do |route|
6
+ Grape::API::Instance.decorated_routes.map do |route|
7
7
  {
8
8
  route_path: route.route_path,
9
9
  route_method: route.route_method,
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapePathHelpers
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe GrapePathHelpers::AllRoutes do
4
- Grape::API.extend described_class
4
+ Grape::API::Instance.extend described_class
5
5
 
6
6
  describe '#all_routes' do
7
7
  context 'when API is mounted within another API' do
@@ -11,7 +11,7 @@ describe GrapePathHelpers::AllRoutes do
11
11
  mounting_api
12
12
 
13
13
  # A route is unique if no other route shares the same set of options
14
- all_route_options = Grape::API.all_routes.map do |r|
14
+ all_route_options = Grape::API::Instance.all_routes.map do |r|
15
15
  r.instance_variable_get(:@options).merge(path: r.path)
16
16
  end
17
17
 
@@ -28,7 +28,7 @@ describe GrapePathHelpers::AllRoutes do
28
28
  it 'returns all POST routes' do
29
29
  expected_routes = Spec::Support::MultiplePostsAPI.routes.map(&:path)
30
30
 
31
- all_routes = Grape::API.all_routes
31
+ all_routes = Grape::API::Instance.all_routes
32
32
  expect(all_routes.map(&:path)).to include(*expected_routes)
33
33
  end
34
34
  end
@@ -5,7 +5,7 @@ describe GrapePathHelpers::NamedRouteMatcher do
5
5
  include described_class
6
6
 
7
7
  let(:routes) do
8
- Grape::API.decorated_routes
8
+ Grape::API::Instance.decorated_routes
9
9
  end
10
10
 
11
11
  let(:ping_route) do
@@ -44,13 +44,13 @@ describe GrapePathHelpers::NamedRouteMatcher do
44
44
 
45
45
  describe '#method_missing' do
46
46
  it 'returns super method_missing if the method does not end with path' do
47
- expect(Grape::API).not_to receive(:decorated_routes)
47
+ expect(Grape::API::Instance).not_to receive(:decorated_routes)
48
48
 
49
49
  helper_class.test_method
50
50
  end
51
51
 
52
52
  it 'search for the route if the method ends with path' do
53
- expect(Grape::API).to receive(:decorated_routes).and_call_original
53
+ expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
54
54
 
55
55
  helper_class.test_method_path
56
56
  end
@@ -146,14 +146,14 @@ describe GrapePathHelpers::NamedRouteMatcher do
146
146
  end
147
147
 
148
148
  describe '#respond_to_missing?' do
149
- it 'returns super if the method doesb not end with path' do
150
- expect(Grape::API).not_to receive(:decorated_routes)
149
+ it 'returns super if the method does not end with path' do
150
+ expect(Grape::API::Instance).not_to receive(:decorated_routes) # rubocop:disable Metrics/LineLength
151
151
 
152
152
  expect(helper_class.send(:respond_to_missing?, :test)).to eq(false)
153
153
  end
154
154
 
155
155
  it 'search for the route if the method ends with path' do
156
- expect(Grape::API).to receive(:decorated_routes).and_call_original
156
+ expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
157
157
 
158
158
  expect(helper_class.send(:respond_to_missing?, :test_path)).to eq(false)
159
159
  end
@@ -1,7 +1,7 @@
1
1
  module Spec
2
2
  module Support
3
3
  # Test API
4
- class API < Grape::API
4
+ class API < Grape::API::Instance
5
5
  version 'v1'
6
6
  prefix 'api'
7
7
  format 'json'
@@ -48,7 +48,7 @@ module Spec
48
48
  end
49
49
 
50
50
  # API with more than one version
51
- class APIWithMultipleVersions < Grape::API
51
+ class APIWithMultipleVersions < Grape::API::Instance
52
52
  version %w[beta alpha v1]
53
53
 
54
54
  get 'ping' do
@@ -57,13 +57,13 @@ module Spec
57
57
  end
58
58
 
59
59
  # API with another API mounted inside it
60
- class MountedAPI < Grape::API
60
+ class MountedAPI < Grape::API::Instance
61
61
  mount Spec::Support::API
62
62
  mount Spec::Support::APIWithMultipleVersions
63
63
  end
64
64
 
65
65
  # API with a version that would be illegal as a method name
66
- class APIWithIllegalVersion < Grape::API
66
+ class APIWithIllegalVersion < Grape::API::Instance
67
67
  version 'beta-1'
68
68
 
69
69
  get 'ping' do
@@ -72,7 +72,7 @@ module Spec
72
72
  end
73
73
 
74
74
  # API with multiple POST routes
75
- class MultiplePostsAPI < Grape::API
75
+ class MultiplePostsAPI < Grape::API::Instance
76
76
  resource :hamlet do
77
77
  post 'to_be' do
78
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-path-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Blessing
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-13 00:00:00.000000000 Z
12
+ date: 2020-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.0'
34
+ version: '1.3'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.0'
41
+ version: '1.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement