grape-starter 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +30 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +4 -1
- data/grape-starter.gemspec +4 -4
- data/lib/starter/builder.rb +6 -3
- data/lib/starter/builder/orms.rb +6 -4
- data/lib/starter/builder/templates/endpoints.rb +13 -5
- data/lib/starter/builder/templates/sequel.rb +1 -1
- data/lib/starter/version.rb +1 -1
- data/template/.rubocop.yml +35 -2
- data/template/Gemfile +1 -1
- data/template/api/endpoints/root.rb +4 -3
- metadata +16 -17
- data/template/.rubocop_todo.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc328d324baf16a4ca6d533598944cef904a4a23c754cf2dec79a1d38e31f401
|
4
|
+
data.tar.gz: dfb725234b40172de9cc66ac47cac5a5d7ab40e958d70618409fcbe2b5d47a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a981c268e2591b126090c46d3776f84f1346a6ec25a21d0ff43941b8e4bafb27bd13fc7579de1ce0b48be34b3606bd2f04d641be083480692ec8c2a60e88456
|
7
|
+
data.tar.gz: e19a5b4b46853f692f95c1b067312d2d83470a4c0114f88cadda612b1143f049a4da3f20acb30c3e205ab3c90cef274814814dabe568cba7fa2e10aa78cadc14
|
data/.github/workflows/ruby.yml
CHANGED
@@ -9,10 +9,10 @@ jobs:
|
|
9
9
|
|
10
10
|
steps:
|
11
11
|
- uses: actions/checkout@v1
|
12
|
-
- name: Set up Ruby 2.
|
12
|
+
- name: Set up Ruby 2.7
|
13
13
|
uses: actions/setup-ruby@v1
|
14
14
|
with:
|
15
|
-
ruby-version: 2.
|
15
|
+
ruby-version: 2.7.1
|
16
16
|
- name: Build and test with Rake
|
17
17
|
run: |
|
18
18
|
gem install bundler
|
data/.rubocop.yml
CHANGED
@@ -38,7 +38,33 @@ Style/AsciiComments:
|
|
38
38
|
Enabled: false
|
39
39
|
|
40
40
|
Style/Documentation:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
44
|
+
Enabled: true
|
45
|
+
Layout/SpaceAroundMethodCallOperator:
|
46
|
+
Enabled: true
|
47
|
+
Lint/DeprecatedOpenSSLConstant:
|
48
|
+
Enabled: true
|
49
|
+
Lint/MixedRegexpCaptureTypes:
|
50
|
+
Enabled: true
|
51
|
+
Lint/RaiseException:
|
52
|
+
Enabled: true
|
53
|
+
Lint/StructNewOverride:
|
54
|
+
Enabled: true
|
55
|
+
Style/ExponentialNotation:
|
56
|
+
Enabled: true
|
57
|
+
Style/HashEachMethods:
|
58
|
+
Enabled: true
|
59
|
+
Style/HashTransformKeys:
|
60
|
+
Enabled: true
|
61
|
+
Style/HashTransformValues:
|
62
|
+
Enabled: true
|
63
|
+
Style/RedundantFetchBlock:
|
64
|
+
Enabled: true
|
65
|
+
Style/RedundantRegexpCharacterClass:
|
66
|
+
Enabled: true
|
67
|
+
Style/RedundantRegexpEscape:
|
68
|
+
Enabled: true
|
69
|
+
Style/SlicingWithRange:
|
70
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
### NEXT
|
2
2
|
|
3
|
+
- Fixes gems for sequel. [LeFnord](https://github.com/LeFnord)
|
4
|
+
- Minor template improvements. [LeFnord](https://github.com/LeFnord)
|
5
|
+
|
3
6
|
### v1.2.3 / 2019-12-15
|
4
7
|
|
5
8
|
- Removes require pry. [LeFnord](LeFnord) closes [!21](https://github.com/LeFnord/grape-starter/issues/21)
|
@@ -7,7 +10,7 @@
|
|
7
10
|
|
8
11
|
### v1.2.2 / 2019-02-28
|
9
12
|
|
10
|
-
- Fixes loading of `
|
13
|
+
- Fixes loading of `aplication` instead of `environment` in `config.ru`
|
11
14
|
- [#19](https://github.com/LeFnord/grape-starter/pull/19) - Adds a module under lib as namespace. [LeFnord](https://github.com/LeFnord)
|
12
15
|
|
13
16
|
### v1.2.1 / 2019-02-24
|
data/grape-starter.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 2.5'
|
26
26
|
|
27
|
-
spec.add_dependency 'gli', '~> 2.
|
28
|
-
spec.add_dependency 'activesupport', '
|
29
|
-
spec.add_dependency 'rubocop', '~> 0.
|
30
|
-
spec.add_dependency 'awesome_print', '~> 1.
|
27
|
+
spec.add_dependency 'gli', '~> 2.19'
|
28
|
+
spec.add_dependency 'activesupport', '~> 6.0'
|
29
|
+
spec.add_dependency 'rubocop', '~> 0.86'
|
30
|
+
spec.add_dependency 'awesome_print', '~> 1.8'
|
31
31
|
end
|
data/lib/starter/builder.rb
CHANGED
@@ -18,6 +18,7 @@ module Starter
|
|
18
18
|
|
19
19
|
class << self
|
20
20
|
attr_reader :prefix, :resource, :set, :force, :entity, :destination, :orm
|
21
|
+
|
21
22
|
#
|
22
23
|
# public methods
|
23
24
|
#
|
@@ -41,8 +42,10 @@ module Starter
|
|
41
42
|
config_static.each do |config|
|
42
43
|
replace_static(File.join(config[:file]), config[:pattern])
|
43
44
|
end
|
45
|
+
|
44
46
|
add_namespace_with_version
|
45
|
-
|
47
|
+
|
48
|
+
Orms.build(name, destination, options[:orm]) if options[:orm]
|
46
49
|
|
47
50
|
Starter::Config.save(
|
48
51
|
dest: destination,
|
@@ -125,9 +128,9 @@ module Starter
|
|
125
128
|
#
|
126
129
|
# replace something in static files
|
127
130
|
def replace_static(file, replacement)
|
128
|
-
|
131
|
+
file_path = File.join(destination, file)
|
129
132
|
|
130
|
-
FileFoo.call!(
|
133
|
+
FileFoo.call!(file_path) { |content| content.gsub!('{{{grape-starter}}}', replacement.to_s) }
|
131
134
|
end
|
132
135
|
|
133
136
|
# #add! a new resource releated helper methods
|
data/lib/starter/builder/orms.rb
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
module Starter
|
4
4
|
class Orms
|
5
5
|
class << self
|
6
|
-
def build(dest, orm)
|
6
|
+
def build(name, dest, orm)
|
7
7
|
load_orm(orm: orm)
|
8
8
|
return if @orm.nil?
|
9
9
|
|
10
|
+
@name = name
|
11
|
+
|
10
12
|
if @orm == 'ar' || @orm == 'activerecord'
|
11
13
|
# Fixes pooling
|
12
14
|
add_middleware(dest, 'ActiveRecord::Rack::ConnectionManagement')
|
@@ -35,21 +37,21 @@ module Starter
|
|
35
37
|
encoding: unicode
|
36
38
|
timeout: 5000
|
37
39
|
user: postgres
|
38
|
-
database:
|
40
|
+
database: #{@name}_development
|
39
41
|
|
40
42
|
test:
|
41
43
|
adapter: #{adapter}
|
42
44
|
encoding: unicode
|
43
45
|
timeout: 5000
|
44
46
|
user: postgres
|
45
|
-
database:
|
47
|
+
database: #{@name}_test
|
46
48
|
|
47
49
|
production:
|
48
50
|
adapter: #{adapter}
|
49
51
|
encoding: unicode
|
50
52
|
timeout: 5000
|
51
53
|
user: postgres
|
52
|
-
database:
|
54
|
+
database: #{@name}_production
|
53
55
|
FILE
|
54
56
|
end
|
55
57
|
|
@@ -29,7 +29,9 @@ module Starter
|
|
29
29
|
# POST
|
30
30
|
def post
|
31
31
|
"
|
32
|
-
desc 'create #{resource.singularize}'
|
32
|
+
desc 'create #{resource.singularize}' do
|
33
|
+
tags %w[#{resource.singularize}]
|
34
|
+
end
|
33
35
|
params do
|
34
36
|
# TODO: specify the parameters
|
35
37
|
end
|
@@ -41,8 +43,10 @@ module Starter
|
|
41
43
|
# GET
|
42
44
|
def get_all
|
43
45
|
"
|
44
|
-
desc 'get all of #{resource.pluralize}'
|
45
|
-
|
46
|
+
desc 'get all of #{resource.pluralize}' do
|
47
|
+
is_array true
|
48
|
+
tags %w[#{resource.singularize}]
|
49
|
+
end
|
46
50
|
get do
|
47
51
|
# your code goes here
|
48
52
|
end"
|
@@ -51,7 +55,9 @@ module Starter
|
|
51
55
|
%w[get put patch delete].each do |verb|
|
52
56
|
define_method(:"#{verb}_one") do
|
53
57
|
"
|
54
|
-
desc '#{verb} #{resource.singularize}'
|
58
|
+
desc '#{verb} #{resource.singularize}' do
|
59
|
+
tags %w[#{resource.singularize}]
|
60
|
+
end
|
55
61
|
#{verb} do
|
56
62
|
# your code goes here
|
57
63
|
end"
|
@@ -61,7 +67,9 @@ module Starter
|
|
61
67
|
%w[get put patch delete].each do |verb|
|
62
68
|
define_method(:"#{verb}_specific") do
|
63
69
|
"
|
64
|
-
desc '#{verb} specific #{resource.singularize}'
|
70
|
+
desc '#{verb} specific #{resource.singularize}' do
|
71
|
+
tags %w[#{resource.singularize}]
|
72
|
+
end
|
65
73
|
params do
|
66
74
|
requires :id
|
67
75
|
end
|
data/lib/starter/version.rb
CHANGED
data/template/.rubocop.yml
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
1
|
AllCops:
|
4
2
|
Exclude:
|
5
3
|
- '**/tmp/**/*'
|
@@ -15,8 +13,43 @@ Layout/LineLength:
|
|
15
13
|
Metrics/AbcSize:
|
16
14
|
Max: 20
|
17
15
|
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Exclude:
|
18
|
+
- 'api/endpoints/**/*'
|
18
19
|
Metrics/MethodLength:
|
19
20
|
Max: 20
|
20
21
|
|
21
22
|
Style/AsciiComments:
|
22
23
|
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
29
|
+
Enabled: true
|
30
|
+
Layout/SpaceAroundMethodCallOperator:
|
31
|
+
Enabled: true
|
32
|
+
Lint/DeprecatedOpenSSLConstant:
|
33
|
+
Enabled: true
|
34
|
+
Lint/MixedRegexpCaptureTypes:
|
35
|
+
Enabled: true
|
36
|
+
Lint/RaiseException:
|
37
|
+
Enabled: true
|
38
|
+
Lint/StructNewOverride:
|
39
|
+
Enabled: true
|
40
|
+
Style/ExponentialNotation:
|
41
|
+
Enabled: true
|
42
|
+
Style/HashEachMethods:
|
43
|
+
Enabled: true
|
44
|
+
Style/HashTransformKeys:
|
45
|
+
Enabled: true
|
46
|
+
Style/HashTransformValues:
|
47
|
+
Enabled: true
|
48
|
+
Style/RedundantFetchBlock:
|
49
|
+
Enabled: true
|
50
|
+
Style/RedundantRegexpCharacterClass:
|
51
|
+
Enabled: true
|
52
|
+
Style/RedundantRegexpEscape:
|
53
|
+
Enabled: true
|
54
|
+
Style/SlicingWithRange:
|
55
|
+
Enabled: true
|
data/template/Gemfile
CHANGED
@@ -6,9 +6,10 @@ module Api
|
|
6
6
|
module Endpoints
|
7
7
|
class Root < Grape::API
|
8
8
|
namespace :root do
|
9
|
-
desc 'Exposes all routes'
|
10
|
-
|
11
|
-
|
9
|
+
desc 'Exposes all routes' do
|
10
|
+
success Entities::Route
|
11
|
+
is_array true
|
12
|
+
end
|
12
13
|
get do
|
13
14
|
api_routes = Starter::Rake::GrapeTasks.new(::Api::Base).api_routes
|
14
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.86'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.86'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: awesome_print
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.8'
|
69
69
|
description: CLI to create a API skeleton based on Grape and Rack
|
70
70
|
email:
|
71
71
|
- pscholz.le@gmail.com
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- lib/starter/version.rb
|
106
106
|
- template/.gitignore
|
107
107
|
- template/.rubocop.yml
|
108
|
-
- template/.rubocop_todo.yml
|
109
108
|
- template/Dockerfile
|
110
109
|
- template/Gemfile
|
111
110
|
- template/LICENSE
|
@@ -137,7 +136,7 @@ homepage: https://github.com/LeFnord/grape-starter
|
|
137
136
|
licenses:
|
138
137
|
- MIT
|
139
138
|
metadata: {}
|
140
|
-
post_install_message:
|
139
|
+
post_install_message:
|
141
140
|
rdoc_options: []
|
142
141
|
require_paths:
|
143
142
|
- lib
|
@@ -152,8 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
151
|
- !ruby/object:Gem::Version
|
153
152
|
version: '0'
|
154
153
|
requirements: []
|
155
|
-
rubygems_version: 3.1.
|
156
|
-
signing_key:
|
154
|
+
rubygems_version: 3.1.4
|
155
|
+
signing_key:
|
157
156
|
specification_version: 4
|
158
157
|
summary: Creates a Grape Rack skeleton
|
159
158
|
test_files: []
|
data/template/.rubocop_todo.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2016-10-18 20:40:59 +0200 using RuboCop version 0.44.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
11
|
-
# URISchemes: http, https
|
12
|
-
|
13
|
-
# Offense count: 6
|
14
|
-
Style/Documentation:
|
15
|
-
Exclude:
|
16
|
-
- 'spec/**/*'
|
17
|
-
- 'api/**/*'
|
18
|
-
- 'lib/**/*'
|