g2_command 0.4.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "fivemat"
7
+ gem "pry"
8
+ gem "rails", "6.0.3"
9
+ gem "rake", "~> 12.0"
10
+ gem "rspec", "~> 3.0"
11
+ gem "rspec_junit_formatter"
12
+ gem "rubocop-g2"
13
+ gem "simplecov", "0.16.1"
14
+
15
+ gemspec path: "../"
@@ -0,0 +1,224 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ g2_command (2.2.0)
5
+ activemodel (>= 5.0, < 7)
6
+ activesupport (>= 5.0, < 7)
7
+ dry-initializer (~> 3.0)
8
+ dry-monads (~> 1.3)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actioncable (6.0.3)
14
+ actionpack (= 6.0.3)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ actionmailbox (6.0.3)
18
+ actionpack (= 6.0.3)
19
+ activejob (= 6.0.3)
20
+ activerecord (= 6.0.3)
21
+ activestorage (= 6.0.3)
22
+ activesupport (= 6.0.3)
23
+ mail (>= 2.7.1)
24
+ actionmailer (6.0.3)
25
+ actionpack (= 6.0.3)
26
+ actionview (= 6.0.3)
27
+ activejob (= 6.0.3)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.0.3)
31
+ actionview (= 6.0.3)
32
+ activesupport (= 6.0.3)
33
+ rack (~> 2.0, >= 2.0.8)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.0.3)
38
+ actionpack (= 6.0.3)
39
+ activerecord (= 6.0.3)
40
+ activestorage (= 6.0.3)
41
+ activesupport (= 6.0.3)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.0.3)
44
+ activesupport (= 6.0.3)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.0.3)
50
+ activesupport (= 6.0.3)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.0.3)
53
+ activesupport (= 6.0.3)
54
+ activerecord (6.0.3)
55
+ activemodel (= 6.0.3)
56
+ activesupport (= 6.0.3)
57
+ activestorage (6.0.3)
58
+ actionpack (= 6.0.3)
59
+ activejob (= 6.0.3)
60
+ activerecord (= 6.0.3)
61
+ marcel (~> 0.3.1)
62
+ activesupport (6.0.3)
63
+ concurrent-ruby (~> 1.0, >= 1.0.2)
64
+ i18n (>= 0.7, < 2)
65
+ minitest (~> 5.1)
66
+ tzinfo (~> 1.1)
67
+ zeitwerk (~> 2.2, >= 2.2.2)
68
+ appraisal (2.3.0)
69
+ bundler
70
+ rake
71
+ thor (>= 0.14.0)
72
+ ast (2.4.1)
73
+ builder (3.2.4)
74
+ coderay (1.1.3)
75
+ concurrent-ruby (1.1.7)
76
+ crass (1.0.6)
77
+ diff-lcs (1.4.4)
78
+ docile (1.3.2)
79
+ dry-core (0.4.9)
80
+ concurrent-ruby (~> 1.0)
81
+ dry-equalizer (0.3.0)
82
+ dry-initializer (3.0.4)
83
+ dry-monads (1.3.5)
84
+ concurrent-ruby (~> 1.0)
85
+ dry-core (~> 0.4, >= 0.4.4)
86
+ dry-equalizer
87
+ erubi (1.9.0)
88
+ fivemat (1.3.7)
89
+ globalid (0.4.2)
90
+ activesupport (>= 4.2.0)
91
+ i18n (1.8.5)
92
+ concurrent-ruby (~> 1.0)
93
+ json (2.3.1)
94
+ loofah (2.7.0)
95
+ crass (~> 1.0.2)
96
+ nokogiri (>= 1.5.9)
97
+ mail (2.7.1)
98
+ mini_mime (>= 0.1.1)
99
+ marcel (0.3.3)
100
+ mimemagic (~> 0.3.2)
101
+ method_source (1.0.0)
102
+ mimemagic (0.3.5)
103
+ mini_mime (1.0.2)
104
+ mini_portile2 (2.4.0)
105
+ minitest (5.14.2)
106
+ nio4r (2.5.4)
107
+ nokogiri (1.10.10)
108
+ mini_portile2 (~> 2.4.0)
109
+ parallel (1.19.2)
110
+ parser (2.7.2.0)
111
+ ast (~> 2.4.1)
112
+ pry (0.13.1)
113
+ coderay (~> 1.1)
114
+ method_source (~> 1.0)
115
+ rack (2.2.3)
116
+ rack-test (1.1.0)
117
+ rack (>= 1.0, < 3)
118
+ rails (6.0.3)
119
+ actioncable (= 6.0.3)
120
+ actionmailbox (= 6.0.3)
121
+ actionmailer (= 6.0.3)
122
+ actionpack (= 6.0.3)
123
+ actiontext (= 6.0.3)
124
+ actionview (= 6.0.3)
125
+ activejob (= 6.0.3)
126
+ activemodel (= 6.0.3)
127
+ activerecord (= 6.0.3)
128
+ activestorage (= 6.0.3)
129
+ activesupport (= 6.0.3)
130
+ bundler (>= 1.3.0)
131
+ railties (= 6.0.3)
132
+ sprockets-rails (>= 2.0.0)
133
+ rails-dom-testing (2.0.3)
134
+ activesupport (>= 4.2.0)
135
+ nokogiri (>= 1.6)
136
+ rails-html-sanitizer (1.3.0)
137
+ loofah (~> 2.3)
138
+ railties (6.0.3)
139
+ actionpack (= 6.0.3)
140
+ activesupport (= 6.0.3)
141
+ method_source
142
+ rake (>= 0.8.7)
143
+ thor (>= 0.20.3, < 2.0)
144
+ rainbow (3.0.0)
145
+ rake (12.3.3)
146
+ regexp_parser (1.8.2)
147
+ rexml (3.2.4)
148
+ rspec (3.9.0)
149
+ rspec-core (~> 3.9.0)
150
+ rspec-expectations (~> 3.9.0)
151
+ rspec-mocks (~> 3.9.0)
152
+ rspec-core (3.9.3)
153
+ rspec-support (~> 3.9.3)
154
+ rspec-expectations (3.9.3)
155
+ diff-lcs (>= 1.2.0, < 2.0)
156
+ rspec-support (~> 3.9.0)
157
+ rspec-mocks (3.9.1)
158
+ diff-lcs (>= 1.2.0, < 2.0)
159
+ rspec-support (~> 3.9.0)
160
+ rspec-support (3.9.4)
161
+ rspec_junit_formatter (0.4.1)
162
+ rspec-core (>= 2, < 4, != 2.12.0)
163
+ rubocop (0.93.1)
164
+ parallel (~> 1.10)
165
+ parser (>= 2.7.1.5)
166
+ rainbow (>= 2.2.2, < 4.0)
167
+ regexp_parser (>= 1.8)
168
+ rexml
169
+ rubocop-ast (>= 0.6.0)
170
+ ruby-progressbar (~> 1.7)
171
+ unicode-display_width (>= 1.4.0, < 2.0)
172
+ rubocop-ast (1.1.0)
173
+ parser (>= 2.7.1.5)
174
+ rubocop-g2 (1.2.1)
175
+ rubocop (>= 0.82)
176
+ rubocop-rails (>= 2.5)
177
+ rubocop-rspec (>= 1.39)
178
+ rubocop-rails (2.8.1)
179
+ activesupport (>= 4.2.0)
180
+ rack (>= 1.1)
181
+ rubocop (>= 0.87.0)
182
+ rubocop-rspec (1.44.1)
183
+ rubocop (~> 0.87)
184
+ rubocop-ast (>= 0.7.1)
185
+ ruby-progressbar (1.10.1)
186
+ simplecov (0.16.1)
187
+ docile (~> 1.1)
188
+ json (>= 1.8, < 3)
189
+ simplecov-html (~> 0.10.0)
190
+ simplecov-html (0.10.2)
191
+ sprockets (4.0.2)
192
+ concurrent-ruby (~> 1.0)
193
+ rack (> 1, < 3)
194
+ sprockets-rails (3.2.2)
195
+ actionpack (>= 4.0)
196
+ activesupport (>= 4.0)
197
+ sprockets (>= 3.0.0)
198
+ thor (1.0.1)
199
+ thread_safe (0.3.6)
200
+ tzinfo (1.2.7)
201
+ thread_safe (~> 0.1)
202
+ unicode-display_width (1.7.0)
203
+ websocket-driver (0.7.3)
204
+ websocket-extensions (>= 0.1.0)
205
+ websocket-extensions (0.1.5)
206
+ zeitwerk (2.4.0)
207
+
208
+ PLATFORMS
209
+ ruby
210
+
211
+ DEPENDENCIES
212
+ appraisal
213
+ fivemat
214
+ g2_command!
215
+ pry
216
+ rails (= 6.0.3)
217
+ rake (~> 12.0)
218
+ rspec (~> 3.0)
219
+ rspec_junit_formatter
220
+ rubocop-g2
221
+ simplecov (= 0.16.1)
222
+
223
+ BUNDLED WITH
224
+ 2.1.4
@@ -5,6 +5,7 @@ require 'active_model'
5
5
  require 'dry-initializer'
6
6
  require 'dry-monads'
7
7
 
8
+ require 'gem_ext/active_model/errors' if ActiveModel.version < Gem::Version.new('5.2')
8
9
  require 'command/failure'
9
10
  require 'command/input_middleware'
10
11
  require 'command/interrupt'
@@ -12,14 +13,13 @@ require 'command/interrupt'
12
13
  module Command
13
14
  extend ActiveSupport::Concern
14
15
 
15
- # rubocop:disable Metrics/BlockLength
16
16
  included do
17
17
  extend Dry::Initializer
18
18
  include Dry::Monads[:result]
19
19
  include ActiveModel::Validations
20
20
 
21
21
  def initialize(inputs = {})
22
- super(Command::InputMiddleware.call(inputs))
22
+ super(**Command::InputMiddleware.call(inputs))
23
23
  end
24
24
 
25
25
  def execute
@@ -27,7 +27,7 @@ module Command
27
27
  end
28
28
 
29
29
  def run
30
- result = if valid?
30
+ result = if errors.empty? && valid?
31
31
  begin
32
32
  execute
33
33
  rescue Command::Interrupt => e
@@ -50,7 +50,6 @@ module Command
50
50
  self.class.dry_initializer.attributes(self)
51
51
  end
52
52
  end
53
- # rubocop:enable Metrics/BlockLength
54
53
 
55
54
  class_methods do
56
55
  def run(inputs = {})
@@ -8,7 +8,7 @@ module Command
8
8
  def self.call(inputs)
9
9
  return inputs unless inputs.is_a?(Hash)
10
10
 
11
- inputs.to_h.deep_symbolize_keys
11
+ inputs.to_h.symbolize_keys
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Command
4
- VERSION = '0.4.0'
4
+ VERSION = '2.3.0'
5
5
  end
@@ -0,0 +1,10 @@
1
+ require 'active_model/errors'
2
+
3
+ module ActiveModel
4
+ class Errors
5
+ def merge!(other)
6
+ @messages.merge!(other.messages) { |_, ary1, ary2| ary1 + ary2 }
7
+ @details.merge!(other.details) { |_, ary1, ary2| ary1 + ary2 }
8
+ end
9
+ end
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g2_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-24 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '7'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '6.0'
29
+ version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '7'
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '6.0'
39
+ version: '5.0'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '7'
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '6.0'
49
+ version: '5.0'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '7'
@@ -78,18 +78,22 @@ dependencies:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '1.3'
81
- description:
81
+ description:
82
82
  email:
83
83
  - hasghari@g2.com
84
84
  executables: []
85
85
  extensions: []
86
86
  extra_rdoc_files: []
87
87
  files:
88
- - ".github/workflows/ruby.yml"
88
+ - ".circleci/config.yml"
89
+ - ".github/config/rubocop_linter_action.yml"
90
+ - ".github/workflows/linters.yml"
89
91
  - ".gitignore"
90
92
  - ".rspec"
91
93
  - ".rubocop.yml"
94
+ - ".ruby-version"
92
95
  - ".tool-versions"
96
+ - Appraisals
93
97
  - CODE_OF_CONDUCT.md
94
98
  - Gemfile
95
99
  - Gemfile.lock
@@ -99,6 +103,13 @@ files:
99
103
  - bin/console
100
104
  - bin/setup
101
105
  - g2_command.gemspec
106
+ - gemfiles/.bundle/config
107
+ - gemfiles/rails_5.1.gemfile
108
+ - gemfiles/rails_5.1.gemfile.lock
109
+ - gemfiles/rails_5.2.gemfile
110
+ - gemfiles/rails_5.2.gemfile.lock
111
+ - gemfiles/rails_6.0.gemfile
112
+ - gemfiles/rails_6.0.gemfile.lock
102
113
  - lib/command.rb
103
114
  - lib/command/failure.rb
104
115
  - lib/command/input_middleware.rb
@@ -107,13 +118,14 @@ files:
107
118
  - lib/command/interrupt.rb
108
119
  - lib/command/version.rb
109
120
  - lib/g2_command.rb
121
+ - lib/gem_ext/active_model/errors.rb
110
122
  homepage: https://github.com/g2crowd/g2_command
111
123
  licenses:
112
124
  - MIT
113
125
  metadata:
114
126
  homepage_uri: https://github.com/g2crowd/g2_command
115
127
  source_code_uri: https://github.com/g2crowd/g2_command
116
- post_install_message:
128
+ post_install_message:
117
129
  rdoc_options: []
118
130
  require_paths:
119
131
  - lib
@@ -121,15 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
133
  requirements:
122
134
  - - ">="
123
135
  - !ruby/object:Gem::Version
124
- version: 2.3.0
136
+ version: 2.4.0
125
137
  required_rubygems_version: !ruby/object:Gem::Requirement
126
138
  requirements:
127
139
  - - ">="
128
140
  - !ruby/object:Gem::Version
129
141
  version: '0'
130
142
  requirements: []
131
- rubygems_version: 3.0.3
132
- signing_key:
143
+ rubygems_version: 3.1.4
144
+ signing_key:
133
145
  specification_version: 4
134
146
  summary: An implementation of the command pattern using dry-rb
135
147
  test_files: []
@@ -1,26 +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@v2
12
- - name: Set up Ruby
13
- uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: 2.6.6
16
- - name: Configure Bundler
17
- run: |
18
- gem install bundler:2.1.4 --no-document
19
- bundle install --jobs 4 --retry 3
20
- - name: Run tests with RSpec
21
- uses: paambaati/codeclimate-action@v2.5.4
22
- env:
23
- CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
24
- with:
25
- coverageCommand: bundle exec rspec
26
- debug: false