lite-form 1.0.2 → 1.1.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +93 -77
- data/README.md +30 -17
- data/lib/generators/rails/USAGE +0 -1
- data/lib/generators/rails/form_generator.rb +0 -7
- data/lib/generators/rails/templates/form.rb.tt +1 -1
- data/lib/lite/form.rb +0 -1
- data/lib/lite/form/base.rb +8 -6
- data/lib/lite/form/helpers/errors.rb +5 -0
- data/lib/lite/form/helpers/propagation.rb +5 -7
- data/lib/lite/form/version.rb +1 -1
- data/lite-form.gemspec +2 -1
- metadata +21 -10
- data/lib/generators/lite/form/install_generator.rb +0 -17
- data/lib/generators/lite/form/templates/install.rb +0 -4
- data/lib/generators/rails/templates/spec.rb.tt +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 586b7faedfe8c9173df9f3ed5a3190e182df29464beef8aaa50d416bbd0ddfea
|
|
4
|
+
data.tar.gz: f04200d3a486afc90c0971c0d6b8ef493d6a6015eaa7c0b795fbf3c9b3abbeb3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b6c37f2dcfd4ff626f610b673b8597f09f1a389d0ce6f1e16097e926160baf34e160d8d90e49cf7a54c37ff95e8a6d6e56a833f82fcb817a13dbae44253f257
|
|
7
|
+
data.tar.gz: ae9667fed2747f42a888d625f8333177d554001a7c30b7e014523df0aa29d205158d707cf4d388e36dea12e4e61e9eea1ee0637deadbffd32fb4af0626dc7964
|
data/.rubocop.yml
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
require:
|
|
2
2
|
- rubocop-performance
|
|
3
|
+
- rubocop-rake
|
|
3
4
|
- rubocop-rspec
|
|
4
5
|
AllCops:
|
|
5
|
-
TargetRubyVersion:
|
|
6
|
+
TargetRubyVersion: 3.0
|
|
7
|
+
NewCops: enable
|
|
6
8
|
DisplayCopNames: true
|
|
7
9
|
DisplayStyleGuide: true
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
|
13
|
+
Enabled: true
|
|
10
14
|
Layout/EmptyLinesAroundBlockBody:
|
|
11
15
|
Exclude:
|
|
12
16
|
- 'spec/**/**/*'
|
|
@@ -14,6 +18,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
|
14
18
|
EnforcedStyle: empty_lines_except_namespace
|
|
15
19
|
Layout/EmptyLinesAroundModuleBody:
|
|
16
20
|
EnforcedStyle: empty_lines_except_namespace
|
|
21
|
+
Layout/LineLength:
|
|
22
|
+
Max: 100
|
|
23
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
24
|
+
Enabled: true
|
|
25
|
+
Lint/RaiseException:
|
|
26
|
+
Enabled: true
|
|
27
|
+
Lint/StructNewOverride:
|
|
28
|
+
Enabled: true
|
|
17
29
|
Metrics/BlockLength:
|
|
18
30
|
Exclude:
|
|
19
31
|
- 'spec/**/**/*'
|
|
@@ -24,6 +36,8 @@ RSpec/ExampleLength:
|
|
|
24
36
|
Enabled: false
|
|
25
37
|
RSpec/MultipleExpectations:
|
|
26
38
|
Enabled: false
|
|
39
|
+
Style/ArgumentsForwarding:
|
|
40
|
+
Enabled: false
|
|
27
41
|
Style/Documentation:
|
|
28
42
|
Enabled: false
|
|
29
43
|
Style/ExpandPathArguments:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.1.0] - 2021-07-19
|
|
10
|
+
### Added
|
|
11
|
+
- Added Ruby 3.0 support
|
|
12
|
+
|
|
13
|
+
## [1.0.5] - 2020-05-20
|
|
14
|
+
### Added
|
|
15
|
+
- Added ruby 2.7 support
|
|
16
|
+
- Added save args
|
|
17
|
+
- Added more callback support
|
|
18
|
+
### Removed
|
|
19
|
+
- Removed archive and destroy propagation
|
|
20
|
+
|
|
21
|
+
## [1.0.4] - 2019-12-21
|
|
22
|
+
### Removed
|
|
23
|
+
- Removed generator empty directory check
|
|
24
|
+
|
|
25
|
+
## [1.0.3] - 2019-09-16
|
|
26
|
+
### Removed
|
|
27
|
+
- Removed lite-form generator
|
|
28
|
+
- Removed spec from rails generator
|
|
29
|
+
|
|
9
30
|
## [1.0.2] - 2019-09-16
|
|
10
31
|
### Changed
|
|
11
32
|
- Changed create propagation to check errors instead of persistence
|
data/Gemfile.lock
CHANGED
|
@@ -1,115 +1,130 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lite-form (1.0
|
|
4
|
+
lite-form (1.1.0)
|
|
5
5
|
activemodel
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actionpack (6.
|
|
11
|
-
actionview (= 6.
|
|
12
|
-
activesupport (= 6.
|
|
13
|
-
rack (~> 2.0)
|
|
10
|
+
actionpack (6.1.4)
|
|
11
|
+
actionview (= 6.1.4)
|
|
12
|
+
activesupport (= 6.1.4)
|
|
13
|
+
rack (~> 2.0, >= 2.0.9)
|
|
14
14
|
rack-test (>= 0.6.3)
|
|
15
15
|
rails-dom-testing (~> 2.0)
|
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
17
|
-
actionview (6.
|
|
18
|
-
activesupport (= 6.
|
|
17
|
+
actionview (6.1.4)
|
|
18
|
+
activesupport (= 6.1.4)
|
|
19
19
|
builder (~> 3.1)
|
|
20
20
|
erubi (~> 1.4)
|
|
21
21
|
rails-dom-testing (~> 2.0)
|
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
23
|
-
activemodel (6.
|
|
24
|
-
activesupport (= 6.
|
|
25
|
-
activerecord (6.
|
|
26
|
-
activemodel (= 6.
|
|
27
|
-
activesupport (= 6.
|
|
28
|
-
activesupport (6.
|
|
23
|
+
activemodel (6.1.4)
|
|
24
|
+
activesupport (= 6.1.4)
|
|
25
|
+
activerecord (6.1.4)
|
|
26
|
+
activemodel (= 6.1.4)
|
|
27
|
+
activesupport (= 6.1.4)
|
|
28
|
+
activesupport (6.1.4)
|
|
29
29
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
30
|
-
i18n (>=
|
|
31
|
-
minitest (
|
|
32
|
-
tzinfo (~>
|
|
33
|
-
zeitwerk (~> 2.
|
|
34
|
-
ast (2.4.
|
|
35
|
-
builder (3.2.
|
|
30
|
+
i18n (>= 1.6, < 2)
|
|
31
|
+
minitest (>= 5.1)
|
|
32
|
+
tzinfo (~> 2.0)
|
|
33
|
+
zeitwerk (~> 2.3)
|
|
34
|
+
ast (2.4.2)
|
|
35
|
+
builder (3.2.4)
|
|
36
36
|
colorize (0.8.1)
|
|
37
|
-
concurrent-ruby (1.1.
|
|
38
|
-
crass (1.0.
|
|
39
|
-
database_cleaner (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
concurrent-ruby (1.1.9)
|
|
38
|
+
crass (1.0.6)
|
|
39
|
+
database_cleaner (2.0.1)
|
|
40
|
+
database_cleaner-active_record (~> 2.0.0)
|
|
41
|
+
database_cleaner-active_record (2.0.1)
|
|
42
|
+
activerecord (>= 5.a)
|
|
43
|
+
database_cleaner-core (~> 2.0.0)
|
|
44
|
+
database_cleaner-core (2.0.1)
|
|
45
|
+
diff-lcs (1.4.4)
|
|
46
|
+
erubi (1.10.0)
|
|
47
|
+
fasterer (0.9.0)
|
|
43
48
|
colorize (~> 0.7)
|
|
44
|
-
ruby_parser (>= 3.
|
|
49
|
+
ruby_parser (>= 3.14.1)
|
|
45
50
|
generator_spec (0.9.4)
|
|
46
51
|
activesupport (>= 3.0.0)
|
|
47
52
|
railties (>= 3.0.0)
|
|
48
|
-
i18n (1.
|
|
53
|
+
i18n (1.8.10)
|
|
49
54
|
concurrent-ruby (~> 1.0)
|
|
50
|
-
|
|
51
|
-
loofah (2.2.3)
|
|
55
|
+
loofah (2.10.0)
|
|
52
56
|
crass (~> 1.0.2)
|
|
53
57
|
nokogiri (>= 1.5.9)
|
|
54
|
-
method_source (0.
|
|
55
|
-
mini_portile2 (2.
|
|
56
|
-
minitest (5.
|
|
57
|
-
nokogiri (1.
|
|
58
|
-
mini_portile2 (~> 2.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
method_source (1.0.0)
|
|
59
|
+
mini_portile2 (2.5.3)
|
|
60
|
+
minitest (5.14.4)
|
|
61
|
+
nokogiri (1.11.7)
|
|
62
|
+
mini_portile2 (~> 2.5.0)
|
|
63
|
+
racc (~> 1.4)
|
|
64
|
+
parallel (1.20.1)
|
|
65
|
+
parser (3.0.2.0)
|
|
66
|
+
ast (~> 2.4.1)
|
|
67
|
+
racc (1.5.2)
|
|
68
|
+
rack (2.2.3)
|
|
63
69
|
rack-test (1.1.0)
|
|
64
70
|
rack (>= 1.0, < 3)
|
|
65
71
|
rails-dom-testing (2.0.3)
|
|
66
72
|
activesupport (>= 4.2.0)
|
|
67
73
|
nokogiri (>= 1.6)
|
|
68
|
-
rails-html-sanitizer (1.
|
|
69
|
-
loofah (~> 2.
|
|
70
|
-
railties (6.
|
|
71
|
-
actionpack (= 6.
|
|
72
|
-
activesupport (= 6.
|
|
74
|
+
rails-html-sanitizer (1.3.0)
|
|
75
|
+
loofah (~> 2.3)
|
|
76
|
+
railties (6.1.4)
|
|
77
|
+
actionpack (= 6.1.4)
|
|
78
|
+
activesupport (= 6.1.4)
|
|
73
79
|
method_source
|
|
74
|
-
rake (>= 0.
|
|
75
|
-
thor (
|
|
80
|
+
rake (>= 0.13)
|
|
81
|
+
thor (~> 1.0)
|
|
76
82
|
rainbow (3.0.0)
|
|
77
|
-
rake (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
rspec-
|
|
82
|
-
|
|
83
|
-
rspec-
|
|
84
|
-
rspec-
|
|
83
|
+
rake (13.0.6)
|
|
84
|
+
regexp_parser (2.1.1)
|
|
85
|
+
rexml (3.2.5)
|
|
86
|
+
rspec (3.10.0)
|
|
87
|
+
rspec-core (~> 3.10.0)
|
|
88
|
+
rspec-expectations (~> 3.10.0)
|
|
89
|
+
rspec-mocks (~> 3.10.0)
|
|
90
|
+
rspec-core (3.10.1)
|
|
91
|
+
rspec-support (~> 3.10.0)
|
|
92
|
+
rspec-expectations (3.10.1)
|
|
85
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
86
|
-
rspec-support (~> 3.
|
|
87
|
-
rspec-mocks (3.
|
|
94
|
+
rspec-support (~> 3.10.0)
|
|
95
|
+
rspec-mocks (3.10.2)
|
|
88
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
89
|
-
rspec-support (~> 3.
|
|
90
|
-
rspec-support (3.
|
|
91
|
-
rubocop (
|
|
92
|
-
jaro_winkler (~> 1.5.1)
|
|
97
|
+
rspec-support (~> 3.10.0)
|
|
98
|
+
rspec-support (3.10.2)
|
|
99
|
+
rubocop (1.18.3)
|
|
93
100
|
parallel (~> 1.10)
|
|
94
|
-
parser (>=
|
|
101
|
+
parser (>= 3.0.0.0)
|
|
95
102
|
rainbow (>= 2.2.2, < 4.0)
|
|
103
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
104
|
+
rexml
|
|
105
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
|
96
106
|
ruby-progressbar (~> 1.7)
|
|
97
|
-
unicode-display_width (>= 1.4.0, <
|
|
98
|
-
rubocop-
|
|
99
|
-
|
|
100
|
-
rubocop-
|
|
101
|
-
rubocop (>=
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
108
|
+
rubocop-ast (1.8.0)
|
|
109
|
+
parser (>= 3.0.1.1)
|
|
110
|
+
rubocop-performance (1.11.4)
|
|
111
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
112
|
+
rubocop-ast (>= 0.4.0)
|
|
113
|
+
rubocop-rake (0.6.0)
|
|
114
|
+
rubocop (~> 1.0)
|
|
115
|
+
rubocop-rspec (2.4.0)
|
|
116
|
+
rubocop (~> 1.0)
|
|
117
|
+
rubocop-ast (>= 1.1.0)
|
|
118
|
+
ruby-progressbar (1.11.0)
|
|
119
|
+
ruby_parser (3.16.0)
|
|
120
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
|
121
|
+
sexp_processor (4.15.3)
|
|
122
|
+
sqlite3 (1.4.2)
|
|
123
|
+
thor (1.1.0)
|
|
124
|
+
tzinfo (2.0.4)
|
|
125
|
+
concurrent-ruby (~> 1.0)
|
|
126
|
+
unicode-display_width (2.0.0)
|
|
127
|
+
zeitwerk (2.4.2)
|
|
113
128
|
|
|
114
129
|
PLATFORMS
|
|
115
130
|
ruby
|
|
@@ -125,8 +140,9 @@ DEPENDENCIES
|
|
|
125
140
|
rspec
|
|
126
141
|
rubocop
|
|
127
142
|
rubocop-performance
|
|
143
|
+
rubocop-rake
|
|
128
144
|
rubocop-rspec
|
|
129
145
|
sqlite3
|
|
130
146
|
|
|
131
147
|
BUNDLED WITH
|
|
132
|
-
2.
|
|
148
|
+
2.2.24
|
data/README.md
CHANGED
|
@@ -30,18 +30,21 @@ Or install it yourself as:
|
|
|
30
30
|
|
|
31
31
|
## Setup
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
`../app/forms/application_form.rb`
|
|
33
|
+
### Generators
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
Use `rails g form NAME` will generate the following files:
|
|
36
|
+
|
|
37
|
+
```erb
|
|
38
|
+
app/forms/[name]_form.rb
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
If a `ApplicationForm` file in the `app/forms` directory is available, the
|
|
42
|
+
generator will create file that inherit from `ApplicationForm` if not it will
|
|
43
|
+
fallback to `Lite::Form::Base`.
|
|
44
|
+
|
|
45
|
+
### Forms
|
|
43
46
|
|
|
44
|
-
You will
|
|
47
|
+
You will need to fill this class with the methods and actions you want to perform:
|
|
45
48
|
|
|
46
49
|
```ruby
|
|
47
50
|
class UserForm < ApplicationForm
|
|
@@ -56,9 +59,9 @@ class UserForm < ApplicationForm
|
|
|
56
59
|
# Setup your form validations like you would on model objects
|
|
57
60
|
validates :name, presence: true
|
|
58
61
|
|
|
59
|
-
# Access
|
|
62
|
+
# Access 6 predefined callbacks to trigger before, after, and
|
|
60
63
|
# around your actions. Available callbacks are `initialize`
|
|
61
|
-
# `create`, `save`, and `update
|
|
64
|
+
# `commit`, `create`, `rollback`, `save`, and `update`.
|
|
62
65
|
before_create :prepend_signature!
|
|
63
66
|
after_update :append_signature!
|
|
64
67
|
|
|
@@ -71,17 +74,26 @@ class UserForm < ApplicationForm
|
|
|
71
74
|
# Propagation methods help you perform an action on an object.
|
|
72
75
|
# If successful is returns the result else it adds the object
|
|
73
76
|
# errors to the form object. Available propagation methods are:
|
|
74
|
-
# `create_and_return!(object, params)`,
|
|
75
|
-
# `
|
|
77
|
+
# `create_and_return!(object, params)`,
|
|
78
|
+
# `update_and_return!(object, params)`,
|
|
79
|
+
# `save_and_return!(object)`
|
|
76
80
|
create_and_return!(User, attributes)
|
|
77
81
|
end
|
|
78
82
|
|
|
79
83
|
def update_action
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
run_callbacks(:commit) do
|
|
85
|
+
ActiveRecord::Base.transaction do
|
|
86
|
+
user = User.find(attributes[:id])
|
|
87
|
+
update_and_return!(user, attributes.slice(:id))
|
|
88
|
+
|
|
89
|
+
# The `save_and_return!` supports on/off validation
|
|
90
|
+
user.settings.web_notification = true
|
|
91
|
+
save_and_return!(user.settings, validate: false)
|
|
92
|
+
end
|
|
84
93
|
end
|
|
94
|
+
rescue StandardError => e
|
|
95
|
+
# This will run the `rollback` callback and re-raise the error.
|
|
96
|
+
raise_transaction_rollback(e)
|
|
85
97
|
end
|
|
86
98
|
|
|
87
99
|
def prepend_signature!
|
|
@@ -98,7 +110,6 @@ end
|
|
|
98
110
|
## Usage
|
|
99
111
|
|
|
100
112
|
To access the form you need to pass the object to the form class and thats it.
|
|
101
|
-
You can even decorate a collection of objects by passing the collection to `decorate`.
|
|
102
113
|
|
|
103
114
|
```ruby
|
|
104
115
|
form = UserForm.new(params)
|
|
@@ -136,7 +147,9 @@ include ActiveModel::Serialization
|
|
|
136
147
|
|
|
137
148
|
# Default callbacks that are defined
|
|
138
149
|
define_model_callbacks :initialize
|
|
150
|
+
define_model_callbacks :commit
|
|
139
151
|
define_model_callbacks :create
|
|
152
|
+
define_model_callbacks :rollback
|
|
140
153
|
define_model_callbacks :save
|
|
141
154
|
define_model_callbacks :update
|
|
142
155
|
```
|
data/lib/generators/rails/USAGE
CHANGED
|
@@ -10,16 +10,9 @@ module Rails
|
|
|
10
10
|
|
|
11
11
|
def copy_files
|
|
12
12
|
path = File.join('app', 'forms', class_path, "#{file_name}_form.rb")
|
|
13
|
-
empty_directory('app/forms')
|
|
14
13
|
template('form.rb.tt', path)
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
def copy_specs
|
|
18
|
-
path = File.join('spec', 'forms', class_path, "#{file_name}_form_spec.rb")
|
|
19
|
-
empty_directory('spec/forms')
|
|
20
|
-
template('spec.rb.tt', path)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
16
|
private
|
|
24
17
|
|
|
25
18
|
def file_name
|
data/lib/lite/form.rb
CHANGED
data/lib/lite/form/base.rb
CHANGED
|
@@ -17,10 +17,18 @@ module Lite
|
|
|
17
17
|
include Lite::Form::Helpers::Propagation
|
|
18
18
|
|
|
19
19
|
define_model_callbacks :initialize
|
|
20
|
+
define_model_callbacks :commit
|
|
20
21
|
define_model_callbacks :create
|
|
22
|
+
define_model_callbacks :rollback
|
|
21
23
|
define_model_callbacks :save
|
|
22
24
|
define_model_callbacks :update
|
|
23
25
|
|
|
26
|
+
attr_reader :result
|
|
27
|
+
|
|
28
|
+
def initialize(params = {})
|
|
29
|
+
run_callbacks(:initialize) { super(params) }
|
|
30
|
+
end
|
|
31
|
+
|
|
24
32
|
class << self
|
|
25
33
|
|
|
26
34
|
def model_name
|
|
@@ -33,12 +41,6 @@ module Lite
|
|
|
33
41
|
|
|
34
42
|
end
|
|
35
43
|
|
|
36
|
-
attr_reader :result
|
|
37
|
-
|
|
38
|
-
def initialize(params = {})
|
|
39
|
-
run_callbacks(:initialize) { super(params) }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
end
|
|
@@ -7,19 +7,17 @@ module Lite
|
|
|
7
7
|
|
|
8
8
|
private
|
|
9
9
|
|
|
10
|
-
%i[archive destroy save].each do |action|
|
|
11
|
-
define_method("#{action}_and_return!") do |klass|
|
|
12
|
-
merge_errors!(klass) unless klass.send(action)
|
|
13
|
-
klass
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
10
|
def create_and_return!(klass, params)
|
|
18
11
|
klass = klass.create(params)
|
|
19
12
|
merge_errors!(klass) unless klass.errors.empty?
|
|
20
13
|
klass
|
|
21
14
|
end
|
|
22
15
|
|
|
16
|
+
def save_and_return!(klass, *args)
|
|
17
|
+
merge_errors!(klass) unless klass.save(*args)
|
|
18
|
+
klass
|
|
19
|
+
end
|
|
20
|
+
|
|
23
21
|
def update_and_return!(klass, params)
|
|
24
22
|
merge_errors!(klass) unless klass.update(params)
|
|
25
23
|
klass
|
data/lib/lite/form/version.rb
CHANGED
data/lite-form.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
)
|
|
26
26
|
else
|
|
27
27
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
28
|
-
|
|
28
|
+
'public gem pushes.'
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Specify which files should be added to the gem when it is released.
|
|
@@ -48,6 +48,7 @@ Gem::Specification.new do |spec|
|
|
|
48
48
|
spec.add_development_dependency 'rspec'
|
|
49
49
|
spec.add_development_dependency 'rubocop'
|
|
50
50
|
spec.add_development_dependency 'rubocop-performance'
|
|
51
|
+
spec.add_development_dependency 'rubocop-rake'
|
|
51
52
|
spec.add_development_dependency 'rubocop-rspec'
|
|
52
53
|
spec.add_development_dependency 'sqlite3'
|
|
53
54
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lite-form
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -150,6 +150,20 @@ dependencies:
|
|
|
150
150
|
- - ">="
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
152
|
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: rubocop-rake
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
153
167
|
- !ruby/object:Gem::Dependency
|
|
154
168
|
name: rubocop-rspec
|
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,7 +192,7 @@ dependencies:
|
|
|
178
192
|
- - ">="
|
|
179
193
|
- !ruby/object:Gem::Version
|
|
180
194
|
version: '0'
|
|
181
|
-
description:
|
|
195
|
+
description:
|
|
182
196
|
email:
|
|
183
197
|
- j.gomez@drexed.com
|
|
184
198
|
executables: []
|
|
@@ -200,12 +214,9 @@ files:
|
|
|
200
214
|
- _config.yml
|
|
201
215
|
- bin/console
|
|
202
216
|
- bin/setup
|
|
203
|
-
- lib/generators/lite/form/install_generator.rb
|
|
204
|
-
- lib/generators/lite/form/templates/install.rb
|
|
205
217
|
- lib/generators/rails/USAGE
|
|
206
218
|
- lib/generators/rails/form_generator.rb
|
|
207
219
|
- lib/generators/rails/templates/form.rb.tt
|
|
208
|
-
- lib/generators/rails/templates/spec.rb.tt
|
|
209
220
|
- lib/lite/form.rb
|
|
210
221
|
- lib/lite/form/base.rb
|
|
211
222
|
- lib/lite/form/exceptions.rb
|
|
@@ -219,7 +230,7 @@ homepage: http://drexed.github.io/lite-form
|
|
|
219
230
|
licenses:
|
|
220
231
|
- MIT
|
|
221
232
|
metadata: {}
|
|
222
|
-
post_install_message:
|
|
233
|
+
post_install_message:
|
|
223
234
|
rdoc_options: []
|
|
224
235
|
require_paths:
|
|
225
236
|
- lib
|
|
@@ -234,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
234
245
|
- !ruby/object:Gem::Version
|
|
235
246
|
version: '0'
|
|
236
247
|
requirements: []
|
|
237
|
-
rubygems_version: 3.
|
|
238
|
-
signing_key:
|
|
248
|
+
rubygems_version: 3.2.24
|
|
249
|
+
signing_key:
|
|
239
250
|
specification_version: 4
|
|
240
251
|
summary: Ruby Form based framework (aka form objects)
|
|
241
252
|
test_files: []
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails/generators'
|
|
4
|
-
|
|
5
|
-
module Lite
|
|
6
|
-
module Form
|
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
|
8
|
-
|
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
10
|
-
|
|
11
|
-
def copy_application_query_file
|
|
12
|
-
copy_file('install.rb', 'app/forms/application_form.rb')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|