grape-starter 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +20 -0
- data/.github/workflows/ruby.yml +18 -13
- data/.rubocop.yml +2 -79
- data/.travis.yml +10 -5
- data/CHANGELOG.md +8 -2
- data/Gemfile +4 -4
- data/README.md +2 -3
- data/grape-starter.gemspec +2 -2
- data/lib/starter/builder/templates/activerecord.rb +18 -8
- data/lib/starter/rake/grape_tasks.rb +1 -2
- data/lib/starter/version.rb +1 -1
- data/template/.rubocop.yml +0 -79
- data/template/Gemfile +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65275de01798dbfd5b58469ffa92d549d78ad71423fd68e59be09e00d4d90348
|
4
|
+
data.tar.gz: 4ceeba3b548341b2f570951e58aa84e86345a64a916ae75f9b5c6a6681bff3d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ce822016665ae28ff18fe3faa533195ad4018f66ff0728d85ebbcebecb870f09bcb4fdf0989447bf90134ef74f8f38a3c6b866e64d45883b1abd2f767b4a2a6
|
7
|
+
data.tar.gz: fa49ce2bc02ceb2a915ea8af26d73869b8ff4a918a50f29252bee3bf1914098c80d29d7379380b4d21844210123c8b681b1ff0587596dc1ab4bdacde6d6f1966
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
rubocop:
|
7
|
+
name: Rubocop
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: actions/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: '3.0'
|
14
|
+
- run: gem install rubocop --no-doc
|
15
|
+
- run: rubocop --format progress --format json --out rubocop.json
|
16
|
+
id: rubocop
|
17
|
+
- uses: duderman/rubocop-annotate-action@v0.1.0
|
18
|
+
with:
|
19
|
+
path: rubocop.json
|
20
|
+
if: ${{ failure() }}
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- '*'
|
4
10
|
|
5
11
|
jobs:
|
6
|
-
|
7
|
-
|
12
|
+
spec:
|
8
13
|
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['2.6', '2.7', '3.0', head]
|
9
17
|
|
10
18
|
steps:
|
11
|
-
- uses: actions/checkout@
|
12
|
-
- name: Set up Ruby
|
13
|
-
uses:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
14
22
|
with:
|
15
|
-
ruby-version:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
bundle install --jobs 4 --retry 3
|
20
|
-
bundle exec rspec
|
21
|
-
bundle exec rubocop
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: Run rspec
|
26
|
+
run: bundle exec rspec
|
data/.rubocop.yml
CHANGED
@@ -10,7 +10,8 @@ AllCops:
|
|
10
10
|
- template/spec/spec-helper.rb
|
11
11
|
UseCache: true
|
12
12
|
NewCops: enable
|
13
|
-
TargetRubyVersion:
|
13
|
+
TargetRubyVersion: 3.0
|
14
|
+
SuggestExtensions: false
|
14
15
|
|
15
16
|
Layout/IndentationWidth:
|
16
17
|
Exclude:
|
@@ -40,81 +41,3 @@ Style/AsciiComments:
|
|
40
41
|
|
41
42
|
Style/Documentation:
|
42
43
|
Enabled: false
|
43
|
-
|
44
|
-
# introduced in 0.88
|
45
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
46
|
-
Enabled: true
|
47
|
-
Layout/SpaceAroundMethodCallOperator:
|
48
|
-
Enabled: true
|
49
|
-
Lint/DeprecatedOpenSSLConstant:
|
50
|
-
Enabled: true
|
51
|
-
Lint/MixedRegexpCaptureTypes:
|
52
|
-
Enabled: true
|
53
|
-
Lint/RaiseException:
|
54
|
-
Enabled: true
|
55
|
-
Lint/StructNewOverride:
|
56
|
-
Enabled: true
|
57
|
-
Style/ExponentialNotation:
|
58
|
-
Enabled: true
|
59
|
-
Style/HashEachMethods:
|
60
|
-
Enabled: true
|
61
|
-
Style/HashTransformKeys:
|
62
|
-
Enabled: true
|
63
|
-
Style/HashTransformValues:
|
64
|
-
Enabled: true
|
65
|
-
Style/RedundantFetchBlock:
|
66
|
-
Enabled: true
|
67
|
-
Style/RedundantRegexpCharacterClass:
|
68
|
-
Enabled: true
|
69
|
-
Style/RedundantRegexpEscape:
|
70
|
-
Enabled: true
|
71
|
-
Style/SlicingWithRange:
|
72
|
-
Enabled: true
|
73
|
-
|
74
|
-
# introduced in 0.89
|
75
|
-
Lint/BinaryOperatorWithIdenticalOperands:
|
76
|
-
Enabled: true
|
77
|
-
Lint/DuplicateElsifCondition:
|
78
|
-
Enabled: true
|
79
|
-
Lint/DuplicateRescueException:
|
80
|
-
Enabled: true
|
81
|
-
Lint/EmptyConditionalBody:
|
82
|
-
Enabled: true
|
83
|
-
Lint/FloatComparison:
|
84
|
-
Enabled: true
|
85
|
-
Lint/MissingSuper:
|
86
|
-
Enabled: true
|
87
|
-
Lint/OutOfRangeRegexpRef:
|
88
|
-
Enabled: true
|
89
|
-
Lint/SelfAssignment:
|
90
|
-
Enabled: true
|
91
|
-
Lint/TopLevelReturnWithArgument:
|
92
|
-
Enabled: true
|
93
|
-
Lint/UnreachableLoop:
|
94
|
-
Enabled: true
|
95
|
-
Style/AccessorGrouping:
|
96
|
-
Enabled: false
|
97
|
-
Style/ArrayCoercion:
|
98
|
-
Enabled: true
|
99
|
-
Style/BisectedAttrAccessor:
|
100
|
-
Enabled: true
|
101
|
-
Style/CaseLikeIf:
|
102
|
-
Enabled: true
|
103
|
-
Style/ExplicitBlockArgument:
|
104
|
-
Enabled: true
|
105
|
-
Style/GlobalStdStream:
|
106
|
-
Enabled: true
|
107
|
-
Style/HashAsLastArrayItem:
|
108
|
-
Enabled: true
|
109
|
-
Style/HashLikeCase:
|
110
|
-
Enabled: true
|
111
|
-
Style/OptionalBooleanParameter:
|
112
|
-
Enabled: true
|
113
|
-
Style/RedundantAssignment:
|
114
|
-
Enabled: true
|
115
|
-
Style/RedundantFileExtensionInRequire:
|
116
|
-
Enabled: true
|
117
|
-
Style/SingleArgumentDig:
|
118
|
-
Enabled: true
|
119
|
-
Style/StringConcatenation:
|
120
|
-
Enabled: true
|
data/.travis.yml
CHANGED
@@ -7,13 +7,18 @@ before_install:
|
|
7
7
|
|
8
8
|
rvm:
|
9
9
|
- ruby-head
|
10
|
-
- 2.7.
|
11
|
-
- 2.6.
|
12
|
-
- 2.5.
|
10
|
+
- 2.7.2
|
11
|
+
- 2.6.6
|
12
|
+
- 2.5.8
|
13
13
|
|
14
14
|
jobs:
|
15
15
|
fast_finish: true
|
16
|
+
include:
|
17
|
+
- rvm: truffleruby-head
|
18
|
+
env:
|
19
|
+
script: bundle exec rake spec
|
16
20
|
|
17
21
|
allow_failures:
|
18
|
-
- rvm:
|
19
|
-
|
22
|
+
- rvm: 3.0.0-preview1
|
23
|
+
- rvm: ruby-head
|
24
|
+
- rvm: truffleruby-head
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,18 @@
|
|
2
2
|
|
3
3
|
- your contributions
|
4
4
|
|
5
|
-
### v1.
|
5
|
+
### v1.4.0 / 2021-04-08
|
6
|
+
|
7
|
+
- Removes `standalone_migration` in favour of AR tasks. [LeFnord](https://github.com/LeFnord)
|
8
|
+
- Minor README improvements. [LeFnord](https://github.com/LeFnord)
|
9
|
+
- Adds GH actions for rspec and rubocop. [LeFnord](https://github.com/LeFnord)
|
10
|
+
|
11
|
+
### v1.3.0 / 2020-09-15
|
6
12
|
|
7
13
|
- Fixes migration name. [LeFnord](https://github.com/LeFnord)
|
8
14
|
- Fixes rubocop new cops handling. [LeFnord](https://github.com/LeFnord)
|
9
15
|
|
10
|
-
### v1.2.4
|
16
|
+
### v1.2.4–v1.2.6 / 2020-01-18–2020-08-13
|
11
17
|
|
12
18
|
- Prepapre releaase 1.2.6 [LeFnord](https://github.com/LeFnord)
|
13
19
|
- Updates used default rails deps versions. [LeFnord](https://github.com/LeFnord)
|
data/Gemfile
CHANGED
@@ -5,12 +5,12 @@ source 'http://rubygems.org'
|
|
5
5
|
gemspec
|
6
6
|
|
7
7
|
group :development, :test do
|
8
|
-
gem 'grape', '~> 1.
|
9
|
-
gem 'pry',
|
10
|
-
gem 'pry-byebug',
|
8
|
+
gem 'grape', '~> 1.5'
|
9
|
+
gem 'pry', require: false
|
10
|
+
gem 'pry-byebug', require: false
|
11
11
|
gem 'rack-cors', require: false
|
12
12
|
gem 'rack-test', require: false
|
13
13
|
gem 'rake', '~> 13.0'
|
14
|
-
gem 'rspec', '~> 3.
|
14
|
+
gem 'rspec', '~> 3.10'
|
15
15
|
gem 'rspec-command'
|
16
16
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
|
1
|
+
![Ruby](https://github.com/LeFnord/grape-starter/workflows/Ruby/badge.svg)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/grape-starter.svg)](https://badge.fury.io/rb/grape-starter)
|
3
|
-
[![Inline docs](http://inch-ci.org/github/LeFnord/grape-starter.svg?branch=master)](http://inch-ci.org/github/LeFnord/grape-starter)
|
4
3
|
|
5
4
|
|
6
5
|
# Grape Starter
|
@@ -83,7 +82,7 @@ To run it, go into awesome_api folder, start the server
|
|
83
82
|
$ cd awesome_api
|
84
83
|
$ ./script/server *port
|
85
84
|
```
|
86
|
-
the API is now accessible under: [http://localhost:9292/api/v1/root](http://localhost:9292/api/v1/root)
|
85
|
+
the API is now accessible under: [http://localhost:9292/api/v1/root](http://localhost:9292/api/v1/root)
|
87
86
|
the documentation of it under: [http://localhost:9292/doc](http://localhost:9292/doc).
|
88
87
|
|
89
88
|
More could be found in [README](template/README.md).
|
data/grape-starter.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.6'
|
26
26
|
|
27
27
|
spec.add_dependency 'gli', '~> 2.19'
|
28
28
|
spec.add_dependency 'activesupport', '~> 6.0'
|
29
|
-
spec.add_dependency 'rubocop', '~>
|
29
|
+
spec.add_dependency 'rubocop', '~> 1.12'
|
30
30
|
spec.add_dependency 'awesome_print', '~> 1.8'
|
31
31
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_record'
|
4
|
+
|
3
5
|
module Starter
|
4
6
|
module Templates
|
5
7
|
module ActiveRecord
|
@@ -27,7 +29,7 @@ module Starter
|
|
27
29
|
FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
|
28
30
|
Logger.new(File.open(log_file, 'a'))
|
29
31
|
else
|
30
|
-
Logger.new(
|
32
|
+
Logger.new($stdout)
|
31
33
|
end
|
32
34
|
|
33
35
|
ActiveRecord::Base.logger = logger
|
@@ -60,18 +62,25 @@ module Starter
|
|
60
62
|
|
61
63
|
def rakefile
|
62
64
|
<<-FILE.strip_heredoc
|
63
|
-
|
64
65
|
# ActiveRecord migration tasks
|
65
|
-
require '
|
66
|
-
|
66
|
+
require 'active_record'
|
67
|
+
include ActiveRecord::Tasks
|
68
|
+
config_dir = File.expand_path('../config', __FILE__)
|
69
|
+
config_content = File.join(config_dir, 'database.yml')
|
70
|
+
DatabaseTasks.env = ENV['RACK_ENV'] || 'development'
|
71
|
+
DatabaseTasks.database_configuration = YAML.load_file(config_content)
|
72
|
+
DatabaseTasks.db_dir = 'db'
|
73
|
+
DatabaseTasks.migrations_paths = File.join('db', 'migrate')
|
74
|
+
|
75
|
+
ActiveRecord::Base.configurations = DatabaseTasks.database_configuration
|
76
|
+
ActiveRecord::Base.establish_connection DatabaseTasks.env.to_sym
|
77
|
+
|
78
|
+
load 'active_record/railties/databases.rake'
|
67
79
|
FILE
|
68
80
|
end
|
69
81
|
|
70
82
|
def gemfile
|
71
83
|
<<-FILE.strip_heredoc
|
72
|
-
# BE stuff
|
73
|
-
gem 'standalone_migrations'
|
74
|
-
|
75
84
|
# DB stuff
|
76
85
|
gem 'activerecord', '>= 6'
|
77
86
|
gem 'pg'
|
@@ -79,8 +88,9 @@ module Starter
|
|
79
88
|
end
|
80
89
|
|
81
90
|
def migration(klass_name, resource)
|
91
|
+
version = "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}"
|
82
92
|
<<-FILE.strip_heredoc
|
83
|
-
class Create#{klass_name} < ActiveRecord::Migration[
|
93
|
+
class Create#{klass_name} < ActiveRecord::Migration[#{version}]
|
84
94
|
def change
|
85
95
|
create_table :#{resource} do |t|
|
86
96
|
|
data/lib/starter/version.rb
CHANGED
data/template/.rubocop.yml
CHANGED
@@ -6,7 +6,6 @@ AllCops:
|
|
6
6
|
- Gemfile
|
7
7
|
UseCache: true
|
8
8
|
NewCops: enable
|
9
|
-
TargetRubyVersion: 2.7
|
10
9
|
|
11
10
|
Layout/LineLength:
|
12
11
|
Max: 120
|
@@ -25,81 +24,3 @@ Style/AsciiComments:
|
|
25
24
|
|
26
25
|
Style/Documentation:
|
27
26
|
Enabled: false
|
28
|
-
|
29
|
-
# introduced in 0.88
|
30
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
31
|
-
Enabled: true
|
32
|
-
Layout/SpaceAroundMethodCallOperator:
|
33
|
-
Enabled: true
|
34
|
-
Lint/DeprecatedOpenSSLConstant:
|
35
|
-
Enabled: true
|
36
|
-
Lint/MixedRegexpCaptureTypes:
|
37
|
-
Enabled: true
|
38
|
-
Lint/RaiseException:
|
39
|
-
Enabled: true
|
40
|
-
Lint/StructNewOverride:
|
41
|
-
Enabled: true
|
42
|
-
Style/ExponentialNotation:
|
43
|
-
Enabled: true
|
44
|
-
Style/HashEachMethods:
|
45
|
-
Enabled: true
|
46
|
-
Style/HashTransformKeys:
|
47
|
-
Enabled: true
|
48
|
-
Style/HashTransformValues:
|
49
|
-
Enabled: true
|
50
|
-
Style/RedundantFetchBlock:
|
51
|
-
Enabled: true
|
52
|
-
Style/RedundantRegexpCharacterClass:
|
53
|
-
Enabled: true
|
54
|
-
Style/RedundantRegexpEscape:
|
55
|
-
Enabled: true
|
56
|
-
Style/SlicingWithRange:
|
57
|
-
Enabled: true
|
58
|
-
|
59
|
-
# introduced in 0.89
|
60
|
-
Lint/BinaryOperatorWithIdenticalOperands:
|
61
|
-
Enabled: true
|
62
|
-
Lint/DuplicateElsifCondition:
|
63
|
-
Enabled: true
|
64
|
-
Lint/DuplicateRescueException:
|
65
|
-
Enabled: true
|
66
|
-
Lint/EmptyConditionalBody:
|
67
|
-
Enabled: true
|
68
|
-
Lint/FloatComparison:
|
69
|
-
Enabled: true
|
70
|
-
Lint/MissingSuper:
|
71
|
-
Enabled: true
|
72
|
-
Lint/OutOfRangeRegexpRef:
|
73
|
-
Enabled: true
|
74
|
-
Lint/SelfAssignment:
|
75
|
-
Enabled: true
|
76
|
-
Lint/TopLevelReturnWithArgument:
|
77
|
-
Enabled: true
|
78
|
-
Lint/UnreachableLoop:
|
79
|
-
Enabled: true
|
80
|
-
Style/AccessorGrouping:
|
81
|
-
Enabled: false
|
82
|
-
Style/ArrayCoercion:
|
83
|
-
Enabled: true
|
84
|
-
Style/BisectedAttrAccessor:
|
85
|
-
Enabled: true
|
86
|
-
Style/CaseLikeIf:
|
87
|
-
Enabled: true
|
88
|
-
Style/ExplicitBlockArgument:
|
89
|
-
Enabled: true
|
90
|
-
Style/GlobalStdStream:
|
91
|
-
Enabled: true
|
92
|
-
Style/HashAsLastArrayItem:
|
93
|
-
Enabled: true
|
94
|
-
Style/HashLikeCase:
|
95
|
-
Enabled: true
|
96
|
-
Style/OptionalBooleanParameter:
|
97
|
-
Enabled: true
|
98
|
-
Style/RedundantAssignment:
|
99
|
-
Enabled: true
|
100
|
-
Style/RedundantFileExtensionInRequire:
|
101
|
-
Enabled: true
|
102
|
-
Style/SingleArgumentDig:
|
103
|
-
Enabled: true
|
104
|
-
Style/StringConcatenation:
|
105
|
-
Enabled: true
|
data/template/Gemfile
CHANGED
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.12'
|
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: '
|
54
|
+
version: '1.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: awesome_print
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".github/dependabot.yml"
|
78
|
+
- ".github/workflows/rubocop.yml"
|
78
79
|
- ".github/workflows/ruby.yml"
|
79
80
|
- ".gitignore"
|
80
81
|
- ".inch.yml"
|
@@ -145,14 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
requirements:
|
146
147
|
- - ">="
|
147
148
|
- !ruby/object:Gem::Version
|
148
|
-
version: '2.
|
149
|
+
version: '2.6'
|
149
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
151
|
requirements:
|
151
152
|
- - ">="
|
152
153
|
- !ruby/object:Gem::Version
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.2.15
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Creates a Grape Rack skeleton
|