grape-starter 1.2.5 → 1.4.2

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: fc328d324baf16a4ca6d533598944cef904a4a23c754cf2dec79a1d38e31f401
4
- data.tar.gz: dfb725234b40172de9cc66ac47cac5a5d7ab40e958d70618409fcbe2b5d47a6f
3
+ metadata.gz: 491977e15c7e7804abb752a2e11669d3c252ff96b75faf29cd1b1bde4c9b6b84
4
+ data.tar.gz: 501f7c1daf72bec375e4f73d157a4a17aaf915b98645d6780797bf15389b8b6b
5
5
  SHA512:
6
- metadata.gz: 8a981c268e2591b126090c46d3776f84f1346a6ec25a21d0ff43941b8e4bafb27bd13fc7579de1ce0b48be34b3606bd2f04d641be083480692ec8c2a60e88456
7
- data.tar.gz: e19a5b4b46853f692f95c1b067312d2d83470a4c0114f88cadda612b1143f049a4da3f20acb30c3e205ab3c90cef274814814dabe568cba7fa2e10aa78cadc14
6
+ metadata.gz: '028fd1e821d918f0caf633c1708b71692e20fa28fe6eb44cb232e185580d789fc8227832a59305ae2e9f4bbc68e89e4989872630032306817bc8289b048b5d79'
7
+ data.tar.gz: a3803b400bd1ad36461d6b374bd179927553e3554677c466f2beaca28172e1db7bd3f82f360b567742c0757cd0db1eaf16063156ae4d0d3ed1a65105950fdcbc
@@ -0,0 +1,14 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ day: "friday"
13
+ assignees:
14
+ - "LeFnord"
@@ -0,0 +1,38 @@
1
+ name: Pipeline
2
+ on:
3
+ pull_request:
4
+ types: [assigned, opened, edited, synchronize, reopened]
5
+ push:
6
+ branches:
7
+ - 'master'
8
+
9
+ jobs:
10
+ # pre-spec
11
+ #
12
+ rubocop:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.0'
19
+ bundler-cache: true
20
+ - name: Run rubocop
21
+ run: bundle exec rubocop --parallel --format progress
22
+
23
+ rspec:
24
+ runs-on: ubuntu-latest
25
+ needs: ['rubocop']
26
+ strategy:
27
+ matrix:
28
+ ruby-version: ['2.7', '3.0', head]
29
+
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true
37
+ - name: Run rspec
38
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ tmp/
9
9
  pkg/
10
10
  template/Gemfile.lock
11
11
  grape-starter.md
12
+ tmp
data/.rubocop.yml CHANGED
@@ -1,15 +1,21 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ inherit_mode:
4
+ merge:
5
+ - Exclude
6
+
3
7
  AllCops:
4
8
  Exclude:
5
9
  - '**/bin/**/*'
6
10
  - '**/tmp/**/*'
7
11
  - '**/script/**/*'
8
- # - '**/template/**/*'
9
12
  - '**/template/api/**'
10
13
  - grape-starter.gemspec
14
+ - template/spec/spec-helper.rb
11
15
  UseCache: true
12
- TargetRubyVersion: 2.7
16
+ NewCops: enable
17
+ TargetRubyVersion: 3.0
18
+ SuggestExtensions: false
13
19
 
14
20
  Layout/IndentationWidth:
15
21
  Exclude:
@@ -39,32 +45,3 @@ Style/AsciiComments:
39
45
 
40
46
  Style/Documentation:
41
47
  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
@@ -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
@@ -1,5 +1,41 @@
1
1
  ### NEXT
2
2
 
3
+ - your contributions
4
+
5
+ ### v1.4.2 / 2021-12-20
6
+
7
+ - Fixes active-support version to > 6 and < 7. [LeFnord](https://github.com/LeFnord)
8
+
9
+ ### v1.4.1 / 2021-12-17 -> yanked
10
+
11
+ - Upgrades active-support version. [LeFnord](https://github.com/LeFnord)
12
+
13
+ ### v1.4.0 / 2021-04-08
14
+
15
+ - Removes `standalone_migration` in favour of AR tasks. [LeFnord](https://github.com/LeFnord)
16
+ - Minor README improvements. [LeFnord](https://github.com/LeFnord)
17
+ - Adds GH actions for rspec and rubocop. [LeFnord](https://github.com/LeFnord)
18
+
19
+ ### v1.3.0 / 2020-09-15
20
+
21
+ - Fixes migration name. [LeFnord](https://github.com/LeFnord)
22
+ - Fixes rubocop new cops handling. [LeFnord](https://github.com/LeFnord)
23
+
24
+ ### v1.2.4–v1.2.6 / 2020-01-18–2020-08-13
25
+
26
+ - Prepapre releaase 1.2.6 [LeFnord](https://github.com/LeFnord)
27
+ - Updates used default rails deps versions. [LeFnord](https://github.com/LeFnord)
28
+ - Create dependabot.yml [peter scholz](https://github.com/LeFnord)
29
+ - Prepare release 1.2.5 [LeFnord](https://github.com/LeFnord)
30
+ - Minor improvements. [LeFnord](https://github.com/LeFnord)
31
+ - Lets run GH actions again. [LeFnord](https://github.com/LeFnord)
32
+ - Minor template improvements. [LeFnord](https://github.com/LeFnord)
33
+ - Changes ruby.yml to use 2.7 [LeFnord](https://github.com/LeFnord)
34
+ - Prepare release 1.2.4 [LeFnord](https://github.com/LeFnord)
35
+ - Respects froozen string stuff. [LeFnord](https://github.com/LeFnord)
36
+ - Updates Ruby and deps. (#23) [LeFnord](https://github.com/LeFnord)
37
+ - Create ruby.yml [LeFnord](https://github.com/LeFnord)
38
+
3
39
  - Fixes gems for sequel. [LeFnord](https://github.com/LeFnord)
4
40
  - Minor template improvements. [LeFnord](https://github.com/LeFnord)
5
41
 
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.0'
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
- gem 'rake', '~> 12.0'
14
- gem 'rspec', '~> 3.8'
15
- gem 'rspec-command'
13
+ gem 'rake', '~> 13.0'
14
+ gem 'rspec', '~> 3.10'
15
+ gem 'rspec-command', git: 'https://github.com/waltjones/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
+ [![Pipeline](https://github.com/LeFnord/grape-starter/actions/workflows/pipeline.yml/badge.svg?branch=master)](https://github.com/LeFnord/grape-starter/actions/workflows/pipeline.yml)
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
- spec.add_dependency 'activesupport', '~> 6.0'
29
- spec.add_dependency 'rubocop', '~> 0.86'
28
+ spec.add_dependency 'activesupport', '>= 6', '< 7'
29
+ spec.add_dependency 'rubocop', '~> 1.12'
30
30
  spec.add_dependency 'awesome_print', '~> 1.8'
31
31
  end
@@ -24,9 +24,11 @@ module Starter
24
24
  end
25
25
  end
26
26
 
27
+ # rubocop:disable Style/StringConcatenation
27
28
  def base_file_name
28
29
  @resource.tr('/', '-').downcase + '.rb'
29
30
  end
31
+ # rubocop:enable Style/StringConcatenation
30
32
 
31
33
  def base_spec_name
32
34
  base_file_name.gsub(/.rb$/, '_spec.rb')
@@ -59,7 +59,7 @@ module Starter
59
59
  load_orm
60
60
  return if @orm.nil?
61
61
 
62
- file_name = "#{Time.now.strftime('%Y%m%d%H%m%S')}_Create#{klass_name}.rb"
62
+ file_name = "#{Time.now.strftime('%Y%m%d%H%m%S')}_create_#{klass_name.downcase}.rb"
63
63
  migration_dest = File.join(Dir.pwd, 'db', 'migrate', file_name)
64
64
  FileFoo.write_file(migration_dest, migration(klass_name, resource))
65
65
  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
@@ -9,6 +11,8 @@ module Starter
9
11
 
10
12
  def initializer
11
13
  <<-FILE.strip_heredoc
14
+ # frozen_string_literal: true
15
+
12
16
  require 'yaml'
13
17
  require 'erb'
14
18
  require 'active_record'
@@ -25,7 +29,7 @@ module Starter
25
29
  FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
26
30
  Logger.new(File.open(log_file, 'a'))
27
31
  else
28
- Logger.new(STDOUT)
32
+ Logger.new($stdout)
29
33
  end
30
34
 
31
35
  ActiveRecord::Base.logger = logger
@@ -58,27 +62,35 @@ module Starter
58
62
 
59
63
  def rakefile
60
64
  <<-FILE.strip_heredoc
61
-
62
65
  # ActiveRecord migration tasks
63
- require 'standalone_migrations'
64
- 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'
65
79
  FILE
66
80
  end
67
81
 
68
82
  def gemfile
69
83
  <<-FILE.strip_heredoc
70
- # BE stuff
71
- gem 'standalone_migrations'
72
-
73
84
  # DB stuff
74
- gem 'activerecord', '~> 5.2'
85
+ gem 'activerecord', '>= 6'
75
86
  gem 'pg'
76
87
  FILE
77
88
  end
78
89
 
79
90
  def migration(klass_name, resource)
91
+ version = "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}"
80
92
  <<-FILE.strip_heredoc
81
- class Create#{klass_name} < ActiveRecord::Migration[5.2]
93
+ class Create#{klass_name} < ActiveRecord::Migration[#{version}]
82
94
  def change
83
95
  create_table :#{resource} do |t|
84
96
 
@@ -52,6 +52,7 @@ module Starter
52
52
  end"
53
53
  end
54
54
 
55
+ # rubocop:disable Style/CombinableLoops
55
56
  %w[get put patch delete].each do |verb|
56
57
  define_method(:"#{verb}_one") do
57
58
  "
@@ -78,6 +79,7 @@ module Starter
78
79
  end"
79
80
  end
80
81
  end
82
+ # rubocop:enable Style/CombinableLoops
81
83
 
82
84
  # request specs shared examples
83
85
  #
@@ -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()
@@ -45,7 +45,7 @@ RSpec.shared_examples 'DELETE one' do
45
45
  let(:route) { route_from_description }
46
46
 
47
47
  subject { delete route }
48
- specify { expect(subject.status).to eql 204 }
48
+ specify { expect(subject.status).to eql 200 }
49
49
  end
50
50
 
51
51
  # plural forms
@@ -75,5 +75,5 @@ RSpec.shared_examples 'DELETE specific' do |key: nil|
75
75
  let(:specific_route) { "#{route_from_description}/#{key}" }
76
76
 
77
77
  subject { delete specific_route }
78
- specify { expect(subject.status).to eql 204 }
78
+ specify { expect(subject).to to_have_status 200 }
79
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Starter
4
- VERSION = '1.2.5'
4
+ VERSION = '1.4.2'
5
5
  end
@@ -5,7 +5,7 @@ AllCops:
5
5
  - Rakefile
6
6
  - Gemfile
7
7
  UseCache: true
8
- TargetRubyVersion: 2.7
8
+ NewCops: enable
9
9
 
10
10
  Layout/LineLength:
11
11
  Max: 120
@@ -24,32 +24,3 @@ Style/AsciiComments:
24
24
 
25
25
  Style/Documentation:
26
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/Dockerfile CHANGED
@@ -1,19 +1,14 @@
1
- FROM ruby:2.5
1
+ FROM ruby:3
2
2
 
3
3
  # stes some Environment variables
4
- ENV NODE_ENV='production'
5
- ENV RACK_ENV='production'
6
-
7
-
8
- # throw errors if Gemfile has been modified since Gemfile.lock
9
- RUN bundle config --global frozen 1
4
+ ENV NODE_ENV='development'
5
+ ENV RACK_ENV='development'
10
6
 
11
7
  ADD . /dummy
12
8
  WORKDIR /dummy
13
9
 
14
10
  COPY Gemfile Gemfile.lock ./
15
-
16
- RUN bundle install
11
+ RUN bundle install --path vendor/bundle
17
12
 
18
13
  COPY . .
19
14
 
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.86'
23
+ gem 'rubocop'
24
24
  end
@@ -6,8 +6,7 @@ require 'rack/test'
6
6
  require File.expand_path('../config/application', __dir__)
7
7
 
8
8
  grape_starter_gem = Gem::Specification.find_by_name('grape-starter').gem_dir
9
-
10
- Dir[grape_starter_gem + '/lib/starter/rspec/**/*.rb'].sort.each { |f| require f }
9
+ Dir["#{grape_starter_gem}/lib/starter/rspec/**/*.rb"].sort.each { |f| require f }
11
10
 
12
11
  RSpec.configure do |config|
13
12
  include Rack::Test::Methods
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.5
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeFnord
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-04 00:00:00.000000000 Z
11
+ date: 2021-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -28,30 +28,36 @@ dependencies:
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '6'
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: '6.0'
36
+ version: '7'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '6'
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: '6.0'
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rubocop
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0.86'
53
+ version: '1.12'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0.86'
60
+ version: '1.12'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: awesome_print
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -74,7 +80,8 @@ executables:
74
80
  extensions: []
75
81
  extra_rdoc_files: []
76
82
  files:
77
- - ".github/workflows/ruby.yml"
83
+ - ".github/dependabot.yml"
84
+ - ".github/workflows/pipeline.yml"
78
85
  - ".gitignore"
79
86
  - ".inch.yml"
80
87
  - ".rspec"
@@ -144,14 +151,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
151
  requirements:
145
152
  - - ">="
146
153
  - !ruby/object:Gem::Version
147
- version: '2.5'
154
+ version: '2.6'
148
155
  required_rubygems_version: !ruby/object:Gem::Requirement
149
156
  requirements:
150
157
  - - ">="
151
158
  - !ruby/object:Gem::Version
152
159
  version: '0'
153
160
  requirements: []
154
- rubygems_version: 3.1.4
161
+ rubygems_version: 3.2.33
155
162
  signing_key:
156
163
  specification_version: 4
157
164
  summary: Creates a Grape Rack skeleton
@@ -1,21 +0,0 @@
1
- name: Ruby
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - uses: actions/checkout@v1
12
- - name: Set up Ruby 2.7
13
- uses: actions/setup-ruby@v1
14
- 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