rest-api-generator 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -0
- data/README.md +14 -0
- data/lib/generators/rest_api_generator/helpers.rb +2 -1
- data/lib/generators/rest_api_generator/spec/rswag_generator.rb +1 -1
- data/lib/rest_api_generator/config.rb +11 -0
- data/lib/rest_api_generator/version.rb +1 -1
- data/lib/rest_api_generator.rb +11 -0
- data/rest-api-generator.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04727c112f46dd53f0ab7b45c0e83c13ddd3ae2df45fed5b3aa89cf7fac6efa4
|
4
|
+
data.tar.gz: 8de60fa55662ef20a6390af3da742c5873e3a2499598790afe759e0afae00352
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 585ad32f866f1e0374dd6051c91ee898a382ed67b1995c511536e3548ed25cc0731725980570ef814d9782d73803b94fd78183af5eee137ed8a054cfb3ab2850
|
7
|
+
data.tar.gz: 68aedf154d0f0b0472cc082d5cbf8ec47e2276070a60963aa8ab58cbb827221fcde13c709e4d7dcd3341ac6a7787a9373fd7564d904b0595aabd165f009ac41e
|
data/Gemfile.lock
CHANGED
@@ -78,6 +78,8 @@ GEM
|
|
78
78
|
activesupport (>= 3.0)
|
79
79
|
railties (>= 3.0)
|
80
80
|
rspec-rails (>= 2.2)
|
81
|
+
anyway_config (2.3.1)
|
82
|
+
ruby-next-core (>= 0.14.0)
|
81
83
|
ast (2.4.2)
|
82
84
|
builder (3.2.4)
|
83
85
|
concurrent-ruby (1.1.10)
|
@@ -218,6 +220,7 @@ GEM
|
|
218
220
|
rubocop (~> 1.33)
|
219
221
|
rubocop-shopify (2.10.1)
|
220
222
|
rubocop (~> 1.35)
|
223
|
+
ruby-next-core (0.15.3)
|
221
224
|
ruby-progressbar (1.11.0)
|
222
225
|
sqlite3 (1.5.4-x86_64-linux)
|
223
226
|
switchcop (0.1.2)
|
@@ -237,10 +240,12 @@ GEM
|
|
237
240
|
zeitwerk (2.6.6)
|
238
241
|
|
239
242
|
PLATFORMS
|
243
|
+
ruby
|
240
244
|
x86_64-linux
|
241
245
|
|
242
246
|
DEPENDENCIES
|
243
247
|
ammeter (~> 1.1.5)
|
248
|
+
anyway_config (>= 2.0.0)
|
244
249
|
database_cleaner
|
245
250
|
rake (~> 13.0)
|
246
251
|
rest-api-generator!
|
data/README.md
CHANGED
@@ -243,6 +243,20 @@ This spec options work as generators too, so you can call them individually:
|
|
243
243
|
rails g rest_api_generator:spec:rswag Car name:string color:string
|
244
244
|
```
|
245
245
|
|
246
|
+
##### Custom paths
|
247
|
+
|
248
|
+
By default, the plain rspec and rswag specs are going to be generated in the _spec/requests_ and _spec/docs_
|
249
|
+
directories, respectively. You can override this configuration with an initializer inside your project:
|
250
|
+
|
251
|
+
```rb
|
252
|
+
# config/initializers/rest_api_generator.rb
|
253
|
+
|
254
|
+
RestApiGenerator.configure do |config|
|
255
|
+
config.test_path = "custom_test_dir/requests"
|
256
|
+
config.docs_path = "custom_docs_dir/rswag"
|
257
|
+
end
|
258
|
+
```
|
259
|
+
|
246
260
|
### Resource Features
|
247
261
|
|
248
262
|
#### Modular Error Handler
|
@@ -5,7 +5,8 @@ module RestApiGenerator
|
|
5
5
|
attr_accessor :options, :attributes
|
6
6
|
|
7
7
|
API_CONTROLLER_DIR_PATH = "app/controllers"
|
8
|
-
API_TEST_DIR_PATH =
|
8
|
+
API_TEST_DIR_PATH = RestApiGenerator.configuration.test_path
|
9
|
+
API_DOCS_DIR_PATH = RestApiGenerator.configuration.docs_path
|
9
10
|
|
10
11
|
private
|
11
12
|
|
data/lib/rest_api_generator.rb
CHANGED
@@ -4,6 +4,7 @@ require "rails"
|
|
4
4
|
require_relative "rest_api_generator/version"
|
5
5
|
require_relative "rest_api_generator/application_controller"
|
6
6
|
require_relative "rest_api_generator/error_handler"
|
7
|
+
require_relative "rest_api_generator/config"
|
7
8
|
require_relative "rest_api_generator/custom_error"
|
8
9
|
require_relative "rest_api_generator/helpers/render"
|
9
10
|
require_relative "rest_api_generator/filterable"
|
@@ -12,6 +13,16 @@ require_relative "rest_api_generator/orderable"
|
|
12
13
|
module RestApiGenerator
|
13
14
|
class Error < StandardError; end
|
14
15
|
|
16
|
+
class << self
|
17
|
+
def configuration
|
18
|
+
@configuration ||= Config.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def configure
|
22
|
+
yield(configuration)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
15
26
|
def self.parent_controller
|
16
27
|
"RestApiGenerator::ApplicationController"
|
17
28
|
end
|
data/rest-api-generator.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_dependency "rails", ">= 5.0"
|
36
36
|
|
37
37
|
spec.add_development_dependency "ammeter", "~> 1.1.5"
|
38
|
+
spec.add_development_dependency "anyway_config", ">= 2.0.0"
|
38
39
|
spec.add_development_dependency "database_cleaner"
|
39
40
|
spec.add_development_dependency "rspec-rails", "~> 6.0.0"
|
40
41
|
spec.add_development_dependency "rswag"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-api-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PedroAugustoRamalhoDuarte
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: anyway_config
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: database_cleaner
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +139,7 @@ files:
|
|
125
139
|
- lib/rest_api_generator.rb
|
126
140
|
- lib/rest_api_generator/application_controller.rb
|
127
141
|
- lib/rest_api_generator/child_resource_controller.rb
|
142
|
+
- lib/rest_api_generator/config.rb
|
128
143
|
- lib/rest_api_generator/custom_error.rb
|
129
144
|
- lib/rest_api_generator/error_handler.rb
|
130
145
|
- lib/rest_api_generator/filterable.rb
|
@@ -158,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
173
|
- !ruby/object:Gem::Version
|
159
174
|
version: '0'
|
160
175
|
requirements: []
|
161
|
-
rubygems_version: 3.3.
|
176
|
+
rubygems_version: 3.3.3
|
162
177
|
signing_key:
|
163
178
|
specification_version: 4
|
164
179
|
summary: Build a Ruby on Rails REST API faster
|