auxiliary_rails 0.3.0 → 0.3.1

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: d2dca627a51fe1045de4e00f82cd2ac9dcc96df20816d7de67a8bf818180a06c
4
- data.tar.gz: e5ae6c889d8ed752d382d86822410a409daaf9f14b04cbf833938af32adab6e9
3
+ metadata.gz: 96acec32159316a20cb54c5f2e456fb7c87b6e1f058f6944df4fb1bdeeca2517
4
+ data.tar.gz: 3ca5ea02af552fb200555f1ab40160b86394b255ecbe2550aebb50e1ac0571b1
5
5
  SHA512:
6
- metadata.gz: cabb77bb72b361996f1bd9623768d7c1af219c0f1bed3a516781493b0b77b7892bb42a3e4ffbefaabd879862fd7b3f25872a87e814e6b7aa7ec2bfc51e1e93d1
7
- data.tar.gz: 07d26c7e442836147af787b33b5d6300f8e3d01c4b60a53fd31cbf0381158a7af5f16f8cb67af8d395ac8df25333cc75de8edaf8d1b0eb01e5cb1f708a1ebc43
6
+ metadata.gz: b6c230d4ceadb59c9ad3260c575d571ddb6b190ff7bac76e597cf6334fdcec2a033e8a467893336ad9c1dc21efbc9c2c1c17823861ac4f954d51856066465461
7
+ data.tar.gz: 05c3be9386e85591ed4afbcd6f178d41a460dd20348580fa443393d736196fca7affa1db32a5ee6eca3b33d52f62e27a55e896620c26c14feca7b63799920438
@@ -7,6 +7,7 @@ require:
7
7
 
8
8
  AllCops:
9
9
  Exclude:
10
+ - bin/rubocop
10
11
  - lib/generators/auxiliary_rails/templates/**/*
11
12
  - vendor/**/* # fix for CI
12
13
 
@@ -40,5 +41,14 @@ Style/Documentation:
40
41
  Style/FrozenStringLiteralComment:
41
42
  Enabled: false
42
43
 
44
+ Style/HashEachMethods:
45
+ Enabled: true
46
+
47
+ Style/HashTransformKeys:
48
+ Enabled: true
49
+
50
+ Style/HashTransformValues:
51
+ Enabled: true
52
+
43
53
  Style/NegatedIf:
44
54
  EnforcedStyle: postfix
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-01-25 02:14:48 +0200 using RuboCop version 0.78.0.
3
+ # on 2020-03-13 22:32:38 +0200 using RuboCop version 0.80.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -15,17 +15,3 @@ Lint/SendWithMixinArgument:
15
15
  # Offense count: 1
16
16
  RSpec/NestedGroups:
17
17
  Max: 4
18
-
19
- # Offense count: 1
20
- # Configuration parameters: MinBodyLength.
21
- Style/GuardClause:
22
- Exclude:
23
- - 'auxiliary_rails.gemspec'
24
-
25
- # Offense count: 1
26
- # Cop supports --auto-correct.
27
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
28
- # SupportedStyles: slashes, percent_r, mixed
29
- Style/RegexpLiteral:
30
- Exclude:
31
- - 'lib/generators/auxiliary_rails/command_generator.rb'
@@ -1,5 +1,15 @@
1
1
  # AuxiliaryRails Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ## v0.3.1
6
+
7
+ ### Added
8
+ - Errorable concern
9
+
10
+ ### Changed
11
+ - Remove validation failed default error #25
12
+
3
13
  ## v0.3.0
4
14
 
5
15
  ### Added
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auxiliary_rails (0.3.0)
4
+ auxiliary_rails (0.3.1)
5
5
  dry-core
6
6
  dry-initializer
7
7
  dry-initializer-rails
8
+ rails (>= 5.2, < 7)
8
9
  thor
9
10
 
10
11
  GEM
@@ -104,7 +105,7 @@ GEM
104
105
  pry (0.12.2)
105
106
  coderay (~> 1.1.0)
106
107
  method_source (~> 0.9.0)
107
- rack (2.2.2)
108
+ rack (2.2.3)
108
109
  rack-test (1.1.0)
109
110
  rack (>= 1.0, < 3)
110
111
  rails (6.0.2.1)
@@ -135,6 +136,7 @@ GEM
135
136
  thor (>= 0.20.3, < 2.0)
136
137
  rainbow (3.0.0)
137
138
  rake (13.0.1)
139
+ rexml (3.2.4)
138
140
  rspec (3.9.0)
139
141
  rspec-core (~> 3.9.0)
140
142
  rspec-expectations (~> 3.9.0)
@@ -148,11 +150,12 @@ GEM
148
150
  diff-lcs (>= 1.2.0, < 2.0)
149
151
  rspec-support (~> 3.9.0)
150
152
  rspec-support (3.9.2)
151
- rubocop (0.79.0)
153
+ rubocop (0.80.1)
152
154
  jaro_winkler (~> 1.5.1)
153
155
  parallel (~> 1.10)
154
156
  parser (>= 2.7.0.1)
155
157
  rainbow (>= 2.2.2, < 4.0)
158
+ rexml
156
159
  ruby-progressbar (~> 1.7)
157
160
  unicode-display_width (>= 1.4.0, < 1.7)
158
161
  rubocop-performance (1.5.2)
@@ -174,7 +177,7 @@ GEM
174
177
  unicode-display_width (1.6.1)
175
178
  websocket-driver (0.7.1)
176
179
  websocket-extensions (>= 0.1.0)
177
- websocket-extensions (0.1.4)
180
+ websocket-extensions (0.1.5)
178
181
  zeitwerk (2.3.0)
179
182
 
180
183
  PLATFORMS
@@ -184,12 +187,11 @@ DEPENDENCIES
184
187
  auxiliary_rails!
185
188
  bundler (~> 2.0)
186
189
  pry
187
- rails (>= 5.2, < 7)
188
190
  rake
189
191
  rspec (~> 3.8)
190
- rubocop (= 0.79)
192
+ rubocop (~> 0.80)
191
193
  rubocop-performance
192
194
  rubocop-rspec
193
195
 
194
196
  BUNDLED WITH
195
- 2.0.2
197
+ 2.1.4
data/README.md CHANGED
@@ -44,7 +44,7 @@ auxiliary_rails new APP_PATH --develop
44
44
  Or use `rails new` command specifying `--template` argument:
45
45
 
46
46
  ```sh
47
- rails new APP_PATH --database=postgresql --template=https://raw.githubusercontent.com/ergoserv/auxiliary_rails/develop/templates/rails/elementary.rb --skip-action-cable --skip-coffee --skip-test --skip-webpack-install
47
+ rails new APP_PATH --database=postgresql --template=https://raw.githubusercontent.com/ergoserv/auxiliary_rails/develop/templates/rails/elementary.rb --skip-action-cable --skip-coffee --skip-test
48
48
  ```
49
49
 
50
50
  ### Generators
@@ -17,13 +17,11 @@ Gem::Specification.new do |spec|
17
17
  spec.homepage = 'https://github.com/ergoserv/auxiliary_rails'
18
18
  spec.license = 'MIT'
19
19
 
20
- if spec.respond_to?(:metadata)
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] = spec.homepage
23
- spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
24
- else
25
- raise 'RubyGems 2.0 or newer is required'
26
- end
20
+ raise 'RubyGems 2.0 or newer is required' unless spec.respond_to?(:metadata)
21
+
22
+ spec.metadata['homepage_uri'] = spec.homepage
23
+ spec.metadata['source_code_uri'] = spec.homepage
24
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
27
25
 
28
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
27
  `git ls-files -z`.split("\x0").reject do |f|
@@ -35,15 +33,15 @@ Gem::Specification.new do |spec|
35
33
 
36
34
  spec.add_development_dependency 'bundler', '~> 2.0'
37
35
  spec.add_development_dependency 'pry'
38
- spec.add_development_dependency 'rails', '>= 5.2', '< 7'
39
36
  spec.add_development_dependency 'rake'
40
37
  spec.add_development_dependency 'rspec', '~> 3.8'
41
- spec.add_development_dependency 'rubocop', '0.79'
38
+ spec.add_development_dependency 'rubocop', '~> 0.80'
42
39
  spec.add_development_dependency 'rubocop-performance'
43
40
  spec.add_development_dependency 'rubocop-rspec'
44
41
 
45
42
  spec.add_runtime_dependency 'dry-core'
46
43
  spec.add_runtime_dependency 'dry-initializer'
47
44
  spec.add_runtime_dependency 'dry-initializer-rails'
45
+ spec.add_runtime_dependency 'rails', '>= 5.2', '< 7'
48
46
  spec.add_runtime_dependency 'thor'
49
47
  end
@@ -1,3 +1,29 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- bundle exec rubocop "$@"
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
@@ -0,0 +1,35 @@
1
+ image: ruby:2.6.5
2
+
3
+ definitions:
4
+ caches:
5
+ bundler: vendor/bundle
6
+
7
+ pipelines:
8
+ default:
9
+ - step:
10
+ name: Build
11
+ caches:
12
+ - bundler
13
+ script:
14
+ - gem install bundler
15
+ - bundle config set path vendor/bundle
16
+ - bundle install
17
+ - parallel:
18
+ - step:
19
+ name: RSpec
20
+ caches:
21
+ - bundler
22
+ script:
23
+ - gem install bundler
24
+ - bundle config set path vendor/bundle
25
+ - bundle install
26
+ - bundle exec rspec
27
+ - step:
28
+ name: RuboCop
29
+ caches:
30
+ - bundler
31
+ script:
32
+ - gem install bundler
33
+ - bundle config set path vendor/bundle
34
+ - bundle install
35
+ - bundle exec rubocop
@@ -1,3 +1,4 @@
1
+ require 'auxiliary_rails/concerns/errorable'
1
2
  require 'dry/core/class_attributes'
2
3
  require 'dry-initializer'
3
4
 
@@ -6,6 +7,7 @@ module AuxiliaryRails
6
7
  class Query
7
8
  extend Dry::Core::ClassAttributes
8
9
  extend Dry::Initializer
10
+ include AuxiliaryRails::Concerns::Errorable
9
11
 
10
12
  defines :default_relation
11
13
 
@@ -53,15 +55,6 @@ module AuxiliaryRails
53
55
  end
54
56
  # rubocop:enable Metrics/AbcSize, Style/GuardClause
55
57
 
56
- def error!(message = nil)
57
- raise error_class,
58
- "`#{self.class}` #{message || 'Query raised an error.'}"
59
- end
60
-
61
- def error_class
62
- AuxiliaryRails::Application::Error
63
- end
64
-
65
58
  def queriable_object?(object)
66
59
  object.is_a?(ActiveRecord::Relation)
67
60
  end
@@ -30,11 +30,10 @@ module AuxiliaryRails
30
30
  def new(app_path)
31
31
  run "rails new #{app_path} " \
32
32
  "--database=#{options[:database]} " \
33
- "--template=#{rails_template_path(options[:template])}" \
33
+ "--template=#{rails_template_path(options[:template])} " \
34
34
  '--skip-action-cable ' \
35
35
  '--skip-coffee ' \
36
- '--skip-test ' \
37
- '--skip-webpack-install'
36
+ '--skip-test '
38
37
  end
39
38
 
40
39
  private
@@ -0,0 +1,22 @@
1
+ module AuxiliaryRails
2
+ module Concerns
3
+ module Errorable
4
+ # extend ActiveSupport::Concern
5
+
6
+ def error!(message = nil)
7
+ message ||= "`#{self.class}` raised error."
8
+ raise error_class, message
9
+ end
10
+
11
+ if defined?(ApplicationError)
12
+ def error_class
13
+ ApplicationError
14
+ end
15
+ else
16
+ def error_class
17
+ AuxiliaryRails::Application::Error
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,10 +1,12 @@
1
1
  require 'active_support/concern'
2
+ require 'auxiliary_rails/concerns/errorable'
2
3
 
3
4
  module AuxiliaryRails
4
5
  module Concerns
5
6
  module Performable
6
7
  extend ActiveSupport::Concern
7
8
  include ActiveModel::Validations
9
+ include AuxiliaryRails::Concerns::Errorable
8
10
 
9
11
  class_methods do
10
12
  def call(*args)
@@ -18,7 +20,7 @@ module AuxiliaryRails
18
20
  if options[:validate!] == true
19
21
  validate!
20
22
  elsif options[:validate] != false && invalid?
21
- return failure!(:validation_failed)
23
+ return failure!
22
24
  end
23
25
 
24
26
  perform
@@ -99,21 +101,6 @@ module AuxiliaryRails
99
101
  error!("`#{self.class}` was not executed yet.")
100
102
  end
101
103
 
102
- def error!(message = nil)
103
- message ||= "`#{self.class}` raised error."
104
- raise error_class, message
105
- end
106
-
107
- if defined?(ApplicationError)
108
- def error_class
109
- ApplicationError
110
- end
111
- else
112
- def error_class
113
- AuxiliaryRails::Application::Error
114
- end
115
- end
116
-
117
104
  # Sets command's status to <tt>failure</tt>.
118
105
  #
119
106
  # @return [self]
@@ -1,3 +1,3 @@
1
1
  module AuxiliaryRails
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
@@ -38,7 +38,7 @@ module AuxiliaryRails
38
38
  end
39
39
 
40
40
  def command_spec_path
41
- command_file_path.gsub(/^app\//, 'spec/')
41
+ command_file_path.gsub(%r{^app/}, 'spec/')
42
42
  end
43
43
  end
44
44
  end
@@ -22,13 +22,6 @@ file '.rubocop.yml', <<~FILE
22
22
  - config/default.yml
23
23
  FILE
24
24
 
25
- file 'bin/rubocop', <<~FILE
26
- #!/usr/bin/env bash
27
-
28
- bundle exec rubocop "$@"
29
- FILE
30
- chmod 'bin/rubocop', 0o755
31
-
32
25
  run 'touch .env'
33
26
  append_file '.gitignore', <<~FILE
34
27
  .env*.local
@@ -42,7 +35,6 @@ gem_group :development, :test do
42
35
  gem 'dotenv-rails'
43
36
  gem 'factory_bot_rails'
44
37
  gem 'faker'
45
- gem 'pry-byebug'
46
38
  gem 'pry-rails'
47
39
  gem 'rspec-rails'
48
40
  gem 'rubocop-ergoserv',
@@ -58,13 +50,14 @@ end
58
50
  after_bundle do
59
51
  # ensure using the latest versions of gems
60
52
  run 'bundle update'
53
+ run 'bundle binstubs rubocop'
61
54
 
62
- generate :controller, 'pages', 'home',
55
+ generate 'rspec:install'
56
+
57
+ generate 'controller', 'pages', 'home',
63
58
  '--no-assets',
64
59
  '--no-helper',
65
60
  '--no-test-framework',
66
61
  '--skip-routes'
67
62
  route "root to: 'pages#home'"
68
-
69
- generate 'rspec:install'
70
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auxiliary_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Babenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-06 00:00:00.000000000 Z
12
+ date: 2020-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -39,26 +39,6 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rails
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '5.2'
49
- - - "<"
50
- - !ruby/object:Gem::Version
51
- version: '7'
52
- type: :development
53
- prerelease: false
54
- version_requirements: !ruby/object:Gem::Requirement
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: '5.2'
59
- - - "<"
60
- - !ruby/object:Gem::Version
61
- version: '7'
62
42
  - !ruby/object:Gem::Dependency
63
43
  name: rake
64
44
  requirement: !ruby/object:Gem::Requirement
@@ -91,16 +71,16 @@ dependencies:
91
71
  name: rubocop
92
72
  requirement: !ruby/object:Gem::Requirement
93
73
  requirements:
94
- - - '='
74
+ - - "~>"
95
75
  - !ruby/object:Gem::Version
96
- version: '0.79'
76
+ version: '0.80'
97
77
  type: :development
98
78
  prerelease: false
99
79
  version_requirements: !ruby/object:Gem::Requirement
100
80
  requirements:
101
- - - '='
81
+ - - "~>"
102
82
  - !ruby/object:Gem::Version
103
- version: '0.79'
83
+ version: '0.80'
104
84
  - !ruby/object:Gem::Dependency
105
85
  name: rubocop-performance
106
86
  requirement: !ruby/object:Gem::Requirement
@@ -171,6 +151,26 @@ dependencies:
171
151
  - - ">="
172
152
  - !ruby/object:Gem::Version
173
153
  version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: rails
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '5.2'
161
+ - - "<"
162
+ - !ruby/object:Gem::Version
163
+ version: '7'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '5.2'
171
+ - - "<"
172
+ - !ruby/object:Gem::Version
173
+ version: '7'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: thor
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -217,12 +217,14 @@ files:
217
217
  - bin/console
218
218
  - bin/rubocop
219
219
  - bin/setup
220
+ - bitbucket-pipelines.yml
220
221
  - lib/auxiliary_rails.rb
221
222
  - lib/auxiliary_rails/application/command.rb
222
223
  - lib/auxiliary_rails/application/error.rb
223
224
  - lib/auxiliary_rails/application/form.rb
224
225
  - lib/auxiliary_rails/application/query.rb
225
226
  - lib/auxiliary_rails/cli.rb
227
+ - lib/auxiliary_rails/concerns/errorable.rb
226
228
  - lib/auxiliary_rails/concerns/performable.rb
227
229
  - lib/auxiliary_rails/railtie.rb
228
230
  - lib/auxiliary_rails/version.rb