hmvc-rails 1.0.1 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f83b0fe836cc23a55c3cc64b7c7501fc95ab64038dd9045c7234282cbd689b0
4
- data.tar.gz: fe91f5e61f4f9a90a338dd63bad014493e1d64e16a7b3cfba28b82af25010be8
3
+ metadata.gz: 9de7078e250ce789dde7bc905120bfa1df37c5b4331eb0e4af2b37d3693ebb76
4
+ data.tar.gz: 8407611d95791ec631cf0452f305c7668f7187fa637090e3c8664eb4b8e588b9
5
5
  SHA512:
6
- metadata.gz: d910ee0f1bb4e00b6cf72a38698b1ae3d53f3975e22b6b76df64ab3a968f3bbce62f50d05061f7459c6e0cd48de3f4194722a1542a97188213d29ac54fe05724
7
- data.tar.gz: a132f4be97ee132e94890f9602b9fe57c3dde7f25b99691fba50a7a431bb335f6cc6394af288596ac651a7f28b9b7b8fd8f640a7c3069786b6ec25fc589b4ff7
6
+ metadata.gz: d51f03cf45c693bb719f9e6f87fee95b226751a87f59f99ef603fd6a88543e198bbd427f8f8185ae9278f1ec0aa28b6144e2f924d3e3f583c8a8d1612ff0df01
7
+ data.tar.gz: 7aebc3eb2ba81f11b0a3a897c598234f0691571b025763388f4e65ec18c08a94b90b4a92abbabedc4484bf0d5ab3df7d75d212b052e361c1e683a17e72e16bd9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hmvc-rails (1.0.1)
4
+ hmvc-rails (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -67,17 +67,17 @@ GEM
67
67
  tzinfo (~> 2.0)
68
68
  ast (2.4.2)
69
69
  builder (3.2.4)
70
- concurrent-ruby (1.2.0)
70
+ concurrent-ruby (1.2.2)
71
71
  crass (1.0.6)
72
- date (3.3.3)
72
+ date (3.3.4)
73
73
  erubi (1.12.0)
74
- globalid (1.1.0)
75
- activesupport (>= 5.0)
76
- i18n (1.12.0)
74
+ globalid (1.2.1)
75
+ activesupport (>= 6.1)
76
+ i18n (1.14.1)
77
77
  concurrent-ruby (~> 1.0)
78
- loofah (2.19.1)
78
+ loofah (2.22.0)
79
79
  crass (~> 1.0.2)
80
- nokogiri (>= 1.5.9)
80
+ nokogiri (>= 1.12.0)
81
81
  mail (2.8.1)
82
82
  mini_mime (>= 0.1.1)
83
83
  net-imap
@@ -85,26 +85,27 @@ GEM
85
85
  net-smtp
86
86
  marcel (1.0.2)
87
87
  method_source (1.0.0)
88
- mini_mime (1.1.2)
88
+ mini_mime (1.1.5)
89
89
  minitest (5.17.0)
90
- net-imap (0.3.4)
90
+ net-imap (0.3.7)
91
91
  date
92
92
  net-protocol
93
93
  net-pop (0.1.2)
94
94
  net-protocol
95
- net-protocol (0.2.1)
95
+ net-protocol (0.2.2)
96
96
  timeout
97
- net-smtp (0.3.3)
97
+ net-smtp (0.4.0)
98
98
  net-protocol
99
- nio4r (2.5.8)
100
- nokogiri (1.14.2-x86_64-darwin)
99
+ nio4r (2.7.0)
100
+ nokogiri (1.15.5-x86_64-darwin)
101
101
  racc (~> 1.4)
102
- parallel (1.22.1)
103
- parser (3.2.1.0)
102
+ parallel (1.24.0)
103
+ parser (3.2.2.4)
104
104
  ast (~> 2.4.1)
105
- racc (1.6.2)
106
- rack (2.2.6.2)
107
- rack-test (2.0.2)
105
+ racc
106
+ racc (1.7.3)
107
+ rack (2.2.8)
108
+ rack-test (2.1.0)
108
109
  rack (>= 1.3)
109
110
  rails (7.0.0)
110
111
  actioncable (= 7.0.0)
@@ -120,11 +121,13 @@ GEM
120
121
  activesupport (= 7.0.0)
121
122
  bundler (>= 1.15.0)
122
123
  railties (= 7.0.0)
123
- rails-dom-testing (2.0.3)
124
- activesupport (>= 4.2.0)
124
+ rails-dom-testing (2.2.0)
125
+ activesupport (>= 5.0.0)
126
+ minitest
125
127
  nokogiri (>= 1.6)
126
- rails-html-sanitizer (1.5.0)
127
- loofah (~> 2.19, >= 2.19.1)
128
+ rails-html-sanitizer (1.6.0)
129
+ loofah (~> 2.21)
130
+ nokogiri (~> 1.14)
128
131
  railties (7.0.0)
129
132
  actionpack (= 7.0.0)
130
133
  activesupport (= 7.0.0)
@@ -134,8 +137,8 @@ GEM
134
137
  zeitwerk (~> 2.5)
135
138
  rainbow (3.1.1)
136
139
  rake (13.0.0)
137
- regexp_parser (2.7.0)
138
- rexml (3.2.5)
140
+ regexp_parser (2.8.3)
141
+ rexml (3.2.6)
139
142
  rubocop (1.21.0)
140
143
  parallel (~> 1.10)
141
144
  parser (>= 3.0.0.0)
@@ -145,18 +148,18 @@ GEM
145
148
  rubocop-ast (>= 1.9.1, < 2.0)
146
149
  ruby-progressbar (~> 1.7)
147
150
  unicode-display_width (>= 1.4.0, < 3.0)
148
- rubocop-ast (1.26.0)
151
+ rubocop-ast (1.30.0)
149
152
  parser (>= 3.2.1.0)
150
- ruby-progressbar (1.11.0)
151
- thor (1.2.1)
152
- timeout (0.3.2)
153
+ ruby-progressbar (1.13.0)
154
+ thor (1.3.0)
155
+ timeout (0.4.1)
153
156
  tzinfo (2.0.6)
154
157
  concurrent-ruby (~> 1.0)
155
- unicode-display_width (2.4.2)
156
- websocket-driver (0.7.5)
158
+ unicode-display_width (2.5.0)
159
+ websocket-driver (0.7.6)
157
160
  websocket-extensions (>= 0.1.0)
158
161
  websocket-extensions (0.1.5)
159
- zeitwerk (2.6.7)
162
+ zeitwerk (2.6.12)
160
163
 
161
164
  PLATFORMS
162
165
  x86_64-darwin-19
data/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  Add this line to your application's Gemfile
20
20
 
21
21
  ```ruby
22
- gem 'hmvc-rails', '1.0.0', group: :development
22
+ gem 'hmvc-rails', '1.0.3', group: :development
23
23
  ```
24
24
 
25
25
  Then execute
@@ -69,12 +69,24 @@ insert app/controllers/application_controller.rb
69
69
  rails g hmvc_rails controller_name
70
70
  ```
71
71
 
72
+ ### Short command
73
+
74
+ ```
75
+ hmvc controller_name
76
+ ```
77
+
72
78
  Example
73
79
 
74
80
  ```
75
81
  rails g hmvc_rails admin
76
82
  ```
77
83
 
84
+ Or
85
+
86
+ ```
87
+ hmvc admin
88
+ ```
89
+
78
90
  ```
79
91
  create app/controllers/admin_controller.rb
80
92
  create app/operations/admin/index_operation.rb
@@ -94,7 +106,7 @@ create app/views/admin/new.html.erb
94
106
  create app/views/admin/edit.html.erb
95
107
  ```
96
108
 
97
- ### Options
109
+ ### Options (You can also use short command too)
98
110
 
99
111
  ##### 1. If you want to create with action other than default. You can use option `--action`
100
112
 
data/bin/hmvc ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "hmvc/rails"
5
+ require_relative "../lib/generators/hmvc_rails/hmvc_rails_generator"
6
+
7
+ HmvcRailsGenerator.start(ARGV)
Binary file
Binary file
@@ -23,8 +23,8 @@ module Extras
23
23
  private
24
24
 
25
25
  def field_errors
26
- JSON.parse(message).map do |field, messages|
27
- messages.map { |message_detail| { name: field, message: message_detail } }
26
+ JSON.parse(message).map do |messages|
27
+ messages.map { |field, message_detail| { name: field, message: message_detail } }
28
28
  end.flatten
29
29
  end
30
30
  end
@@ -50,7 +50,7 @@ module Extras
50
50
 
51
51
  class Conflict < StandardError; end
52
52
 
53
- class UnprocessableEntity < ActiveRecord::RecordInvalid; end
53
+ class UnprocessableEntity < StandardError; end
54
54
 
55
55
  class InternalServerError < StandardError; end
56
56
 
@@ -7,6 +7,7 @@ class UniquenessValidator < ActiveModel::EachValidator
7
7
  @klass = options[:model] if options[:model]
8
8
  end
9
9
 
10
+ # rubocop:disable Metrics/AbcSize
10
11
  def validate_each(record, attribute)
11
12
  record_org = record
12
13
  attribute_org = attribute
@@ -26,4 +27,5 @@ class UniquenessValidator < ActiveModel::EachValidator
26
27
 
27
28
  record_org.errors.add(attribute_org, :taken) if record
28
29
  end
30
+ # rubocop:enable Metrics/AbcSize
29
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Hmvc
4
4
  module Rails
5
- VERSION = "1.0.1"
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
@@ -15,14 +15,35 @@ module RuboCop
15
15
  return unless node.children.first == :call
16
16
 
17
17
  node.body.to_a.compact.each do |ast|
18
- next if ast.is_a?(Symbol) && (ast.to_s.start_with?("step_") || ast.to_s == "super")
18
+ next if special_node?(ast.class)
19
19
 
20
- next if ast.is_a?(RuboCop::AST::SendNode) &&
21
- (ast.children.last.to_s.start_with?("step_") || ast.children.last.to_s == "super")
20
+ next if ast.is_a?(Symbol) && valid?(ast.to_s)
21
+
22
+ next if ast.is_a?(RuboCop::AST::SendNode) && valid?(ast.children.last.to_s)
22
23
 
23
24
  add_offense(node, message: "Method works in \"call\" without prefix \"step_\"")
24
25
  end
25
26
  end
27
+
28
+ private
29
+
30
+ def special_node?(node_name)
31
+ [
32
+ RuboCop::AST::Node,
33
+ RuboCop::AST::IfNode,
34
+ RuboCop::AST::IntNode,
35
+ RuboCop::AST::ArgsNode,
36
+ RuboCop::AST::BlockNode,
37
+ RuboCop::AST::YieldNode,
38
+ RuboCop::AST::SuperNode,
39
+ RuboCop::AST::ReturnNode,
40
+ RuboCop::AST::ResbodyNode
41
+ ].include?(node_name)
42
+ end
43
+
44
+ def valid?(text)
45
+ %w[step_ transaction].any? { |keyword| text.start_with?(keyword) }
46
+ end
26
47
  end
27
48
  end
28
49
  end
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmvc-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - thucpt
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-20 00:00:00.000000000 Z
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: hmvc-rails is a high-level model for the Rails MVC architecture
14
14
  email:
15
15
  - thuc.phan@tomosia.com
16
- executables: []
16
+ executables:
17
+ - hmvc
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
@@ -25,7 +26,10 @@ files:
25
26
  - LICENSE.txt
26
27
  - README.md
27
28
  - Rakefile
29
+ - bin/hmvc
28
30
  - hmvc-rails-1.0.0.gem
31
+ - hmvc-rails-1.0.1.gem
32
+ - hmvc-rails-1.0.2.gem
29
33
  - lib/generators/hmvc_rails/hmvc_rails_generator.rb
30
34
  - lib/generators/hmvc_rails/install_generator.rb
31
35
  - lib/generators/hmvc_rails/templates/configures/hmvc_rails.rb.tt