steel_wheel 0.5.1 → 0.5.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: e464b8495907b093719e2c6c87f21cf8049813b764541e71351690fffea92137
4
- data.tar.gz: 9094321c43e3fb7e8e68a10a0e4b31460c8b8e28f9f2fade4c6f74b9e33dc317
3
+ metadata.gz: 13785609cbd9084917cbe11c267122a95e4bcb03578d5c1e67d4bb72b18ab5a3
4
+ data.tar.gz: 42b38f64b7fc05ebd6b9a03ae529342147b21a218777921b61fb46730e6e3fe4
5
5
  SHA512:
6
- metadata.gz: fbb09cc404c5dc67ce885503f1b5650b66ef8cda1bc3a2b3b3fc7ff217effdc687f1ec6b9fdcba9aff3a34573d8893472d38d02b85d62d950d5749a11f6bfbc3
7
- data.tar.gz: b243e60f6e1e55707d9b319c2cc865f5612892a8286c508ffada5f2f85f233d642955082500040531ecb779f379c2105baf0b827baf381f71d19e88ccd6ed188
6
+ metadata.gz: e97bc94a9f5aff72400db8ea1a23a2303a92855aacdae79f595ee132eea820ffe551a1d870df373e79cbb91ae4ded83403e01a651d3219877b82ddb48942bbc0
7
+ data.tar.gz: 41dfc695129fa36a886ba8666222cf2d62c244ab00ca516198b9e4f3f94512c810417b01484090909a7a1ff680bca8a814838511e41468246155c0948d58e7b3
data/.codeclimate.yml ADDED
@@ -0,0 +1,2 @@
1
+ exclude_patterns:
2
+ - 'lib/generators'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steel_wheel (0.5.1)
4
+ steel_wheel (0.5.2)
5
5
  easy_params (~> 0.1.2)
6
6
  flow_object (~> 0.3.1)
7
7
  memery (~> 1)
@@ -10,47 +10,41 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (5.2.6)
14
- actionview (= 5.2.6)
15
- activesupport (= 5.2.6)
16
- rack (~> 2.0, >= 2.0.8)
13
+ actionpack (7.0.3.1)
14
+ actionview (= 7.0.3.1)
15
+ activesupport (= 7.0.3.1)
16
+ rack (~> 2.0, >= 2.2.0)
17
17
  rack-test (>= 0.6.3)
18
18
  rails-dom-testing (~> 2.0)
19
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
- actionview (5.2.6)
21
- activesupport (= 5.2.6)
19
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
+ actionview (7.0.3.1)
21
+ activesupport (= 7.0.3.1)
22
22
  builder (~> 3.1)
23
23
  erubi (~> 1.4)
24
24
  rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
- activemodel (5.2.6)
27
- activesupport (= 5.2.6)
28
- activesupport (5.2.6)
25
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
+ activemodel (7.0.3.1)
27
+ activesupport (= 7.0.3.1)
28
+ activesupport (7.0.3.1)
29
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
30
- i18n (>= 0.7, < 2)
31
- minitest (~> 5.1)
32
- tzinfo (~> 1.1)
30
+ i18n (>= 1.6, < 2)
31
+ minitest (>= 5.1)
32
+ tzinfo (~> 2.0)
33
33
  builder (3.2.4)
34
34
  coderay (1.1.2)
35
- concurrent-ruby (1.1.9)
35
+ concurrent-ruby (1.1.10)
36
36
  crass (1.0.6)
37
37
  diff-lcs (1.3)
38
38
  docile (1.3.5)
39
- dry-configurable (0.11.6)
39
+ dry-container (0.10.1)
40
40
  concurrent-ruby (~> 1.0)
41
- dry-core (~> 0.4, >= 0.4.7)
42
- dry-equalizer (~> 0.2)
43
- dry-container (0.7.2)
44
- concurrent-ruby (~> 1.0)
45
- dry-configurable (~> 0.1, >= 0.1.3)
46
- dry-core (0.4.9)
41
+ dry-core (0.8.1)
47
42
  concurrent-ruby (~> 1.0)
48
43
  dry-equalizer (0.3.0)
49
- dry-inflector (0.2.0)
50
- dry-logic (1.0.8)
44
+ dry-inflector (0.3.0)
45
+ dry-logic (1.2.0)
51
46
  concurrent-ruby (~> 1.0)
52
- dry-core (~> 0.2)
53
- dry-equalizer (~> 0.2)
47
+ dry-core (~> 0.5, >= 0.5)
54
48
  dry-struct (1.3.0)
55
49
  dry-core (~> 0.4, >= 0.4.4)
56
50
  dry-equalizer (~> 0.3)
@@ -67,42 +61,45 @@ GEM
67
61
  activemodel (>= 3.2, < 8)
68
62
  dry-struct (~> 1.3.0)
69
63
  dry-types (~> 1.4.0)
70
- erubi (1.10.0)
64
+ erubi (1.11.0)
71
65
  flow_object (0.3.1)
72
66
  hospodar (~> 1)
73
67
  hospodar (1.0.1)
74
68
  dry-inflector (~> 0.1)
75
- i18n (1.9.1)
69
+ i18n (1.12.0)
76
70
  concurrent-ruby (~> 1.0)
77
71
  ice_nine (0.11.2)
78
72
  json (2.5.1)
79
- loofah (2.13.0)
73
+ loofah (2.18.0)
80
74
  crass (~> 1.0.2)
81
75
  nokogiri (>= 1.5.9)
82
- memery (1.3.0)
76
+ memery (1.4.1)
83
77
  ruby2_keywords (~> 0.0.2)
84
78
  method_source (0.9.2)
85
- mini_portile2 (2.4.0)
86
- minitest (5.15.0)
87
- nokogiri (1.10.10)
88
- mini_portile2 (~> 2.4.0)
79
+ mini_portile2 (2.8.0)
80
+ minitest (5.16.3)
81
+ nokogiri (1.13.8)
82
+ mini_portile2 (~> 2.8.0)
83
+ racc (~> 1.4)
89
84
  pry (0.12.2)
90
85
  coderay (~> 1.1.0)
91
86
  method_source (~> 0.9.0)
92
- rack (2.2.3)
93
- rack-test (1.1.0)
94
- rack (>= 1.0, < 3)
87
+ racc (1.6.0)
88
+ rack (2.2.4)
89
+ rack-test (2.0.2)
90
+ rack (>= 1.3)
95
91
  rails-dom-testing (2.0.3)
96
92
  activesupport (>= 4.2.0)
97
93
  nokogiri (>= 1.6)
98
- rails-html-sanitizer (1.4.2)
94
+ rails-html-sanitizer (1.4.3)
99
95
  loofah (~> 2.3)
100
- railties (5.2.6)
101
- actionpack (= 5.2.6)
102
- activesupport (= 5.2.6)
96
+ railties (7.0.3.1)
97
+ actionpack (= 7.0.3.1)
98
+ activesupport (= 7.0.3.1)
103
99
  method_source
104
- rake (>= 0.8.7)
105
- thor (>= 0.19.0, < 2.0)
100
+ rake (>= 12.2)
101
+ thor (~> 1.0)
102
+ zeitwerk (~> 2.5)
106
103
  rake (13.0.3)
107
104
  rspec (3.9.0)
108
105
  rspec-core (~> 3.9.0)
@@ -126,9 +123,9 @@ GEM
126
123
  simplecov-html (~> 0.10.0)
127
124
  simplecov-html (0.10.2)
128
125
  thor (1.2.1)
129
- thread_safe (0.3.6)
130
- tzinfo (1.2.9)
131
- thread_safe (~> 0.1)
126
+ tzinfo (2.0.5)
127
+ concurrent-ruby (~> 1.0)
128
+ zeitwerk (2.6.0)
132
129
 
133
130
  PLATFORMS
134
131
  ruby
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generates operations files
3
+
4
+ Example:
5
+ rails generate steel_wheel:application_handler
6
+
7
+ This will create:
8
+ app/handlers/application_handler.rb
@@ -0,0 +1,10 @@
1
+ module SteelWheel
2
+ class ApplicationHandlerGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def copy_files
6
+ empty_directory Pathname.new('app/handlers')
7
+ template 'handler_template.rb', "app/handlers/application_handler.rb"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationHandler < SteelWheel::Handler
2
+
3
+ end
@@ -1,16 +1,14 @@
1
- require_relative '../generic_generator'
2
-
3
1
  module SteelWheel
4
- class CommandGenerator < GenericGenerator
5
- setup_templates_root('command/templates')
6
-
7
- on_revoke do
8
- template 'command_template.rb', "app/commands/#{file_path}_command.rb"
9
- end
2
+ class CommandGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
10
4
 
11
- on_invoke do
12
- empty_directory Pathname.new('app/commands').join(*class_path)
13
- template 'command_template.rb', "app/commands/#{file_path}_command.rb"
5
+ def copy_files
6
+ if behavior == :revoke
7
+ template 'command_template.rb', "app/commands/#{file_path}_command.rb"
8
+ elsif behavior == :invoke
9
+ empty_directory Pathname.new('app/commands').join(*class_path)
10
+ template 'command_template.rb', "app/commands/#{file_path}_command.rb"
11
+ end
14
12
  end
15
13
  end
16
14
  end
@@ -1,16 +1,15 @@
1
- require_relative '../generic_generator'
2
-
3
1
  module SteelWheel
4
- class HandlerGenerator < GenericGenerator
5
- setup_templates_root('handler/templates')
6
-
7
- on_revoke do
8
- template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
9
- end
2
+ class HandlerGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
10
4
 
11
- on_invoke do
12
- empty_directory Pathname.new('app/handlers').join(*class_path)
13
- template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
5
+ def copy_files
6
+ if behavior == :revoke
7
+ template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
8
+ elsif behavior == :invoke
9
+ empty_directory Pathname.new('app/handlers').join(*class_path)
10
+ template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
11
+ Rails::Generators.invoke('steel_wheel:application_handler', [], behavior: behavior)
12
+ end
14
13
  end
15
14
  end
16
15
  end
@@ -1,9 +1,13 @@
1
1
  class <%= class_name %>Handler < ApplicationHandler
2
- params_input do
2
+ params do
3
3
 
4
4
  end
5
5
 
6
- command_stage do
6
+ query do
7
+
8
+ end
9
+
10
+ command do
7
11
  def call
8
12
  # NOOP
9
13
  end
@@ -1,16 +1,14 @@
1
- require_relative '../generic_generator'
2
-
3
1
  module SteelWheel
4
- class ParamsGenerator < GenericGenerator
5
- setup_templates_root('params/templates')
6
-
7
- on_revoke do
8
- template 'params_template.rb', "app/params/#{file_path}_params.rb"
9
- end
2
+ class ParamsGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
10
4
 
11
- on_invoke do
12
- empty_directory Pathname.new('app/params').join(*class_path)
13
- template 'params_template.rb', "app/params/#{file_path}_params.rb"
5
+ def copy_files
6
+ if behavior == :revoke
7
+ template 'params_template.rb', "app/params/#{file_path}_params.rb"
8
+ elsif behavior == :invoke
9
+ empty_directory Pathname.new('app/params').join(*class_path)
10
+ template 'params_template.rb', "app/params/#{file_path}_params.rb"
11
+ end
14
12
  end
15
13
  end
16
14
  end
@@ -1,16 +1,14 @@
1
- require_relative '../generic_generator'
2
-
3
1
  module SteelWheel
4
- class CommandGenerator < GenericGenerator
5
- setup_templates_root('query/templates')
6
-
7
- on_revoke do
8
- template 'query_template.rb', "app/queries/#{file_path}_query.rb"
9
- end
2
+ class QueryGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
10
4
 
11
- on_invoke do
12
- empty_directory Pathname.new('app/queries').join(*class_path)
13
- template 'query_template.rb', "app/queries/#{file_path}_query.rb"
5
+ def copy_files
6
+ if behavior == :revoke
7
+ template 'query_template.rb', "app/queries/#{file_path}_query.rb"
8
+ elsif behavior == :invoke
9
+ empty_directory Pathname.new('app/queries').join(*class_path)
10
+ template 'query_template.rb', "app/queries/#{file_path}_query.rb"
11
+ end
14
12
  end
15
13
  end
16
14
  end
@@ -1,3 +1,3 @@
1
1
  module SteelWheel
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.5.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steel_wheel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Baran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-29 00:00:00.000000000 Z
11
+ date: 2022-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -163,6 +163,7 @@ executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
165
165
  files:
166
+ - ".codeclimate.yml"
166
167
  - ".github/workflows/ruby.yml"
167
168
  - ".gitignore"
168
169
  - ".rspec"
@@ -177,10 +178,12 @@ files:
177
178
  - assets/action_diagram.png
178
179
  - bin/console
179
180
  - bin/setup
181
+ - lib/generators/steel_wheel/application_handler/USAGE
182
+ - lib/generators/steel_wheel/application_handler/application_handler_generator.rb
183
+ - lib/generators/steel_wheel/application_handler/templates/handler_template.rb
180
184
  - lib/generators/steel_wheel/command/USAGE
181
185
  - lib/generators/steel_wheel/command/command_generator.rb
182
186
  - lib/generators/steel_wheel/command/templates/command_template.rb
183
- - lib/generators/steel_wheel/generic_generator.rb
184
187
  - lib/generators/steel_wheel/handler/USAGE
185
188
  - lib/generators/steel_wheel/handler/handler_generator.rb
186
189
  - lib/generators/steel_wheel/handler/templates/handler_template.rb
@@ -221,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
224
  - !ruby/object:Gem::Version
222
225
  version: '0'
223
226
  requirements: []
224
- rubygems_version: 3.2.30
227
+ rubygems_version: 3.2.3
225
228
  signing_key:
226
229
  specification_version: 4
227
230
  summary: Adds operations to your rails code
@@ -1,23 +0,0 @@
1
- module SteelWheel
2
- class GenericGenerator < Rails::Generators::NamedBase
3
- def self.setup_templates_root(templates_relative_path)
4
- source_root File.expand_path(templates_relative_path, __dir__)
5
- end
6
-
7
- def self.on_revoke(&block)
8
- block_given? ? @on_revoke = block : @on_revoke
9
- end
10
-
11
- def self.on_invoke(&block)
12
- block_given? ? @on_invoke = block : @on_invoke
13
- end
14
-
15
- def copy_files
16
- if behavior == :revoke
17
- instance_eval(&self.class.on_revoke)
18
- elsif behavior == :invoke
19
- instance_eval(&self.class.on_invoke)
20
- end
21
- end
22
- end
23
- end