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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a26894e42ff2662719a173e14b263e31673e2d36cb720c21476c507f8ce7c64
4
- data.tar.gz: 47f4d1c8049d154566f801c991893a135cd3c6d99f07d6a5138193ab43ba9e97
3
+ metadata.gz: 65275de01798dbfd5b58469ffa92d549d78ad71423fd68e59be09e00d4d90348
4
+ data.tar.gz: 4ceeba3b548341b2f570951e58aa84e86345a64a916ae75f9b5c6a6681bff3d1
5
5
  SHA512:
6
- metadata.gz: 14a3786d6abf9af32f733a0cd5168ccad2af04c3811143af0cf601572aa8ef51d5f1bbc3e12767c69c70f6789f6c4dc3d4e30cdb4cd061e0159c6e7a30e3dca9
7
- data.tar.gz: 1e25c66a61297aaf2fb8baac8055f86a008a80e7f4c8268d97002db78acb29254932b8eec3956eb4eb3e5983e088eb52bfd3304e8cde1db5c0b3f45a064f23df
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() }}
@@ -1,21 +1,26 @@
1
1
  name: Ruby
2
2
 
3
- on: [push]
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
4
10
 
5
11
  jobs:
6
- build:
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@v1
12
- - name: Set up Ruby 2.7
13
- uses: actions/setup-ruby@v1
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
14
22
  with:
15
- ruby-version: 2.7.1
16
- - name: Build and test with Rake
17
- run: |
18
- gem install bundler
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: 2.7
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.0
11
- - 2.6.5
12
- - 2.5.7
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
- - ruby-head
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.3.0 2020-09-15
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--v1.2.6 2020-01-18--2020-08-13
16
+ ### v1.2.4v1.2.6 / 2020-01-182020-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.4'
9
- gem 'pry', platforms: [:mri]
10
- gem 'pry-byebug', platforms: [:mri]
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.8'
14
+ gem 'rspec', '~> 3.10'
15
15
  gem 'rspec-command'
16
16
  end
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
- [![Build Status](https://travis-ci.org/LeFnord/grape-starter.svg?branch=master)](https://travis-ci.org/LeFnord/grape-starter)
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).
@@ -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.5'
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', '~> 0.89'
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(STDOUT)
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 'standalone_migrations'
66
- StandaloneMigrations::Tasks.load_tasks
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[6.0]
93
+ class Create#{klass_name} < ActiveRecord::Migration[#{version}]
84
94
  def change
85
95
  create_table :#{resource} do |t|
86
96
 
@@ -11,8 +11,7 @@ module Starter
11
11
  class GrapeTasks < ::Rake::TaskLib
12
12
  include Rack::Test::Methods
13
13
 
14
- attr_reader :resource
15
- attr_reader :api_class
14
+ attr_reader :resource, :api_class
16
15
 
17
16
  def initialize(api_class = nil)
18
17
  super()
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Starter
4
- VERSION = '1.3.0'
4
+ VERSION = '1.4.0'
5
5
  end
@@ -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
@@ -20,5 +20,5 @@ group :development, :test do
20
20
  gem 'rack-test'
21
21
  gem 'rake'
22
22
  gem 'rspec'
23
- gem 'rubocop', '~> 0.88'
23
+ gem 'rubocop'
24
24
  end
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.3.0
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: 2020-09-14 00:00:00.000000000 Z
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: '0.89'
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: '0.89'
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.5'
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.1.4
156
+ rubygems_version: 3.2.15
156
157
  signing_key:
157
158
  specification_version: 4
158
159
  summary: Creates a Grape Rack skeleton