formie 1.0.4 → 1.1.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: 5ef348b6943dc8c20cedb102cffb2bc8ecf911bcaf5a371ac82123c292989821
4
- data.tar.gz: 665deeb0be28f935ab48d54bcfa3d014b8ecabbd76c9015703c13153e38ba7ed
3
+ metadata.gz: ebf7737de8d4afca91ebff32ec0bfb2164f52964e5a4c611fb6957d31576ba70
4
+ data.tar.gz: 402816d39d77d39b74914fdca1d33d83e47f8ee548324cd314a86fce59806848
5
5
  SHA512:
6
- metadata.gz: 45f28748bd5c287dbfeaef2687b8fd3dbe37092a1bd8a8c6029a0a29606289f02d1823c1201b446022549fea7836309c4e763b3395632655defb92a631314b13
7
- data.tar.gz: 989cc6575837923b9a6484d024f5aed5ae5c1a823b9b455bc765f62f9a397959ce33409f570dc104701a6f5186654892d58015001bf9cd35a0413e29c4771679
6
+ metadata.gz: 5db6b5b77f7fa7cfdd2370768fa9e5410ae2fcca5d483a9733658f8cff19f716513f1b67245dd9cc52eced89709fa10de8a97eb39a5c273911ebd58a913b7901
7
+ data.tar.gz: 76a452db8870277aefe56e004ff540149b529df31010aae0d57695126623cfe34eaf09f38f049bfd4a4584e909c68267d8f8f437b24fcb2a339bcbd9041cb866
@@ -1,6 +1,6 @@
1
+ # see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
1
2
  name: Rake
2
3
 
3
- #on: [push, pull_request]
4
4
  on: [push]
5
5
 
6
6
  jobs:
@@ -8,17 +8,19 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- # os: [ubuntu-latest, macos-latest]
12
11
  os: [ubuntu-latest]
13
- # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
14
- # ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
15
- ruby: [2.7]
12
+ ruby: ["2.7", "3.0", "3.2", head]
13
+ test_command: ["bundle exec rake test"]
16
14
  runs-on: ${{ matrix.os }}
17
15
 
18
16
  steps:
19
- - uses: actions/checkout@v2
17
+ - uses: actions/checkout@v3
20
18
  - uses: ruby/setup-ruby@v1
21
19
  with:
22
20
  ruby-version: ${{ matrix.ruby }}
23
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24
- - run: bundle exec rake
21
+ - name: Bundle install
22
+ run: |
23
+ bundle config path /home/runner/bundle
24
+ bundle install
25
+ bundle update
26
+ - run: ${{ matrix.test_command }}
data/.ruby-gemset CHANGED
@@ -1 +1 @@
1
- rails-6.1
1
+ rails-7.0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.7.2
1
+ ruby-3.2.2
data/Appraisals CHANGED
@@ -1,20 +1,25 @@
1
- appraise 'rails-6.1' do
2
- gem 'rails', '~> 6.1'
3
- gem 'dryer-config', '~> 6.0'
1
+ appraise "rails-7.0" do
2
+ gem "rails", "~> 7.0"
3
+ gem "dryer-config", "~> 7.0"
4
4
  end
5
5
 
6
- appraise 'rails-6.0' do
7
- gem 'rails', '~> 6.0'
6
+ appraise "rails-6.1" do
7
+ gem "rails", "~> 6.1"
8
+ gem "dryer-config", "~> 6.0"
8
9
  end
9
10
 
10
- #appraise 'rails-5.2' do
11
+ # appraise "rails-6.0" do
12
+ # gem "rails", "~> 6.0"
13
+ # end
14
+ #
15
+ # appraise 'rails-5.2' do
11
16
  # gem 'rails', '~> 5.2.0'
12
- #end
17
+ # end
13
18
  #
14
- #appraise 'rails-5.1' do
19
+ # appraise 'rails-5.1' do
15
20
  # gem 'rails', '~> 5.1'
16
- #end
21
+ # end
17
22
  #
18
- #appraise 'rails-5.0' do
23
+ # appraise 'rails-5.0' do
19
24
  # gem 'rails', '~> 5.0.0'
20
- #end
25
+ # end
data/Gemfile CHANGED
@@ -1,12 +1,14 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'rails'
4
+ gem "rails"
5
5
 
6
6
  group :test do
7
- gem 'observr'
8
- gem 'rubocop', require: false
9
- gem 'simplecov', require: false
10
- gem 'capybara'
11
- gem 'slim'
7
+ gem "capybara"
8
+ gem "observr"
9
+ gem "ricecream"
10
+ gem "rubocop", require: false
11
+ gem "simplecov", require: false
12
+ gem "slim"
13
+ gem "spring"
12
14
  end
data/Gemfile.lock CHANGED
@@ -1,208 +1,227 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- formie (1.0.4)
4
+ formie (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (6.1.3.2)
10
- actionpack (= 6.1.3.2)
11
- activesupport (= 6.1.3.2)
9
+ actioncable (7.0.4.3)
10
+ actionpack (= 7.0.4.3)
11
+ activesupport (= 7.0.4.3)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailbox (6.1.3.2)
15
- actionpack (= 6.1.3.2)
16
- activejob (= 6.1.3.2)
17
- activerecord (= 6.1.3.2)
18
- activestorage (= 6.1.3.2)
19
- activesupport (= 6.1.3.2)
14
+ actionmailbox (7.0.4.3)
15
+ actionpack (= 7.0.4.3)
16
+ activejob (= 7.0.4.3)
17
+ activerecord (= 7.0.4.3)
18
+ activestorage (= 7.0.4.3)
19
+ activesupport (= 7.0.4.3)
20
20
  mail (>= 2.7.1)
21
- actionmailer (6.1.3.2)
22
- actionpack (= 6.1.3.2)
23
- actionview (= 6.1.3.2)
24
- activejob (= 6.1.3.2)
25
- activesupport (= 6.1.3.2)
21
+ net-imap
22
+ net-pop
23
+ net-smtp
24
+ actionmailer (7.0.4.3)
25
+ actionpack (= 7.0.4.3)
26
+ actionview (= 7.0.4.3)
27
+ activejob (= 7.0.4.3)
28
+ activesupport (= 7.0.4.3)
26
29
  mail (~> 2.5, >= 2.5.4)
30
+ net-imap
31
+ net-pop
32
+ net-smtp
27
33
  rails-dom-testing (~> 2.0)
28
- actionpack (6.1.3.2)
29
- actionview (= 6.1.3.2)
30
- activesupport (= 6.1.3.2)
31
- rack (~> 2.0, >= 2.0.9)
34
+ actionpack (7.0.4.3)
35
+ actionview (= 7.0.4.3)
36
+ activesupport (= 7.0.4.3)
37
+ rack (~> 2.0, >= 2.2.0)
32
38
  rack-test (>= 0.6.3)
33
39
  rails-dom-testing (~> 2.0)
34
40
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.1.3.2)
36
- actionpack (= 6.1.3.2)
37
- activerecord (= 6.1.3.2)
38
- activestorage (= 6.1.3.2)
39
- activesupport (= 6.1.3.2)
41
+ actiontext (7.0.4.3)
42
+ actionpack (= 7.0.4.3)
43
+ activerecord (= 7.0.4.3)
44
+ activestorage (= 7.0.4.3)
45
+ activesupport (= 7.0.4.3)
46
+ globalid (>= 0.6.0)
40
47
  nokogiri (>= 1.8.5)
41
- actionview (6.1.3.2)
42
- activesupport (= 6.1.3.2)
48
+ actionview (7.0.4.3)
49
+ activesupport (= 7.0.4.3)
43
50
  builder (~> 3.1)
44
51
  erubi (~> 1.4)
45
52
  rails-dom-testing (~> 2.0)
46
53
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.1.3.2)
48
- activesupport (= 6.1.3.2)
54
+ activejob (7.0.4.3)
55
+ activesupport (= 7.0.4.3)
49
56
  globalid (>= 0.3.6)
50
- activemodel (6.1.3.2)
51
- activesupport (= 6.1.3.2)
52
- activerecord (6.1.3.2)
53
- activemodel (= 6.1.3.2)
54
- activesupport (= 6.1.3.2)
55
- activestorage (6.1.3.2)
56
- actionpack (= 6.1.3.2)
57
- activejob (= 6.1.3.2)
58
- activerecord (= 6.1.3.2)
59
- activesupport (= 6.1.3.2)
60
- marcel (~> 1.0.0)
61
- mini_mime (~> 1.0.2)
62
- activesupport (6.1.3.2)
57
+ activemodel (7.0.4.3)
58
+ activesupport (= 7.0.4.3)
59
+ activerecord (7.0.4.3)
60
+ activemodel (= 7.0.4.3)
61
+ activesupport (= 7.0.4.3)
62
+ activestorage (7.0.4.3)
63
+ actionpack (= 7.0.4.3)
64
+ activejob (= 7.0.4.3)
65
+ activerecord (= 7.0.4.3)
66
+ activesupport (= 7.0.4.3)
67
+ marcel (~> 1.0)
68
+ mini_mime (>= 1.1.0)
69
+ activesupport (7.0.4.3)
63
70
  concurrent-ruby (~> 1.0, >= 1.0.2)
64
71
  i18n (>= 1.6, < 2)
65
72
  minitest (>= 5.1)
66
73
  tzinfo (~> 2.0)
67
- zeitwerk (~> 2.3)
68
- addressable (2.7.0)
69
- public_suffix (>= 2.0.2, < 5.0)
70
- appraisal (2.4.0)
74
+ addressable (2.8.4)
75
+ public_suffix (>= 2.0.2, < 6.0)
76
+ appraisal (2.4.1)
71
77
  bundler
72
78
  rake
73
79
  thor (>= 0.14.0)
74
80
  ast (2.4.2)
75
81
  builder (3.2.4)
76
- capybara (3.35.3)
82
+ capybara (3.39.0)
77
83
  addressable
84
+ matrix
78
85
  mini_mime (>= 0.1.3)
79
86
  nokogiri (~> 1.8)
80
87
  rack (>= 1.6.0)
81
88
  rack-test (>= 0.6.3)
82
89
  regexp_parser (>= 1.5, < 3.0)
83
90
  xpath (~> 3.2)
84
- combustion (1.3.1)
91
+ combustion (1.3.7)
85
92
  activesupport (>= 3.0.0)
86
93
  railties (>= 3.0.0)
87
94
  thor (>= 0.14.6)
88
- concurrent-ruby (1.1.9)
95
+ concurrent-ruby (1.2.2)
89
96
  crass (1.0.6)
97
+ date (3.3.3)
90
98
  docile (1.4.0)
91
- erubi (1.10.0)
92
- globalid (0.4.2)
93
- activesupport (>= 4.2.0)
94
- i18n (1.8.10)
99
+ erubi (1.12.0)
100
+ globalid (1.1.0)
101
+ activesupport (>= 5.0)
102
+ i18n (1.12.0)
95
103
  concurrent-ruby (~> 1.0)
96
- loofah (2.10.0)
104
+ json (2.6.3)
105
+ loofah (2.20.0)
97
106
  crass (~> 1.0.2)
98
107
  nokogiri (>= 1.5.9)
99
- mail (2.7.1)
108
+ mail (2.8.1)
100
109
  mini_mime (>= 0.1.1)
101
- marcel (1.0.1)
110
+ net-imap
111
+ net-pop
112
+ net-smtp
113
+ marcel (1.0.2)
114
+ matrix (0.4.2)
102
115
  method_source (1.0.0)
103
- mini_mime (1.0.3)
104
- minitest (5.14.4)
105
- nio4r (2.5.7)
106
- nokogiri (1.11.7-x86_64-linux)
116
+ mini_mime (1.1.2)
117
+ minitest (5.18.0)
118
+ net-imap (0.3.4)
119
+ date
120
+ net-protocol
121
+ net-pop (0.1.2)
122
+ net-protocol
123
+ net-protocol (0.2.1)
124
+ timeout
125
+ net-smtp (0.3.3)
126
+ net-protocol
127
+ nio4r (2.5.9)
128
+ nokogiri (1.14.3-x86_64-linux)
107
129
  racc (~> 1.4)
108
130
  observr (1.0.5)
109
- parallel (1.20.1)
110
- parser (3.0.1.1)
131
+ parallel (1.22.1)
132
+ parser (3.2.2.0)
111
133
  ast (~> 2.4.1)
112
- public_suffix (4.0.6)
113
- racc (1.5.2)
114
- rack (2.2.3)
115
- rack-test (1.1.0)
116
- rack (>= 1.0, < 3)
117
- rails (6.1.3.2)
118
- actioncable (= 6.1.3.2)
119
- actionmailbox (= 6.1.3.2)
120
- actionmailer (= 6.1.3.2)
121
- actionpack (= 6.1.3.2)
122
- actiontext (= 6.1.3.2)
123
- actionview (= 6.1.3.2)
124
- activejob (= 6.1.3.2)
125
- activemodel (= 6.1.3.2)
126
- activerecord (= 6.1.3.2)
127
- activestorage (= 6.1.3.2)
128
- activesupport (= 6.1.3.2)
134
+ public_suffix (5.0.1)
135
+ racc (1.6.2)
136
+ rack (2.2.6.4)
137
+ rack-test (2.1.0)
138
+ rack (>= 1.3)
139
+ rails (7.0.4.3)
140
+ actioncable (= 7.0.4.3)
141
+ actionmailbox (= 7.0.4.3)
142
+ actionmailer (= 7.0.4.3)
143
+ actionpack (= 7.0.4.3)
144
+ actiontext (= 7.0.4.3)
145
+ actionview (= 7.0.4.3)
146
+ activejob (= 7.0.4.3)
147
+ activemodel (= 7.0.4.3)
148
+ activerecord (= 7.0.4.3)
149
+ activestorage (= 7.0.4.3)
150
+ activesupport (= 7.0.4.3)
129
151
  bundler (>= 1.15.0)
130
- railties (= 6.1.3.2)
131
- sprockets-rails (>= 2.0.0)
152
+ railties (= 7.0.4.3)
132
153
  rails-dom-testing (2.0.3)
133
154
  activesupport (>= 4.2.0)
134
155
  nokogiri (>= 1.6)
135
- rails-html-sanitizer (1.3.0)
136
- loofah (~> 2.3)
137
- railties (6.1.3.2)
138
- actionpack (= 6.1.3.2)
139
- activesupport (= 6.1.3.2)
156
+ rails-html-sanitizer (1.5.0)
157
+ loofah (~> 2.19, >= 2.19.1)
158
+ railties (7.0.4.3)
159
+ actionpack (= 7.0.4.3)
160
+ activesupport (= 7.0.4.3)
140
161
  method_source
141
- rake (>= 0.8.7)
162
+ rake (>= 12.2)
142
163
  thor (~> 1.0)
143
- rainbow (3.0.0)
144
- rake (13.0.3)
145
- regexp_parser (2.1.1)
164
+ zeitwerk (~> 2.5)
165
+ rainbow (3.1.1)
166
+ rake (13.0.6)
167
+ regexp_parser (2.8.0)
146
168
  rexml (3.2.5)
147
- rubocop (1.17.0)
169
+ ricecream (0.2.1)
170
+ rubocop (1.50.2)
171
+ json (~> 2.3)
148
172
  parallel (~> 1.10)
149
- parser (>= 3.0.0.0)
173
+ parser (>= 3.2.0.0)
150
174
  rainbow (>= 2.2.2, < 4.0)
151
175
  regexp_parser (>= 1.8, < 3.0)
152
- rexml
153
- rubocop-ast (>= 1.7.0, < 2.0)
176
+ rexml (>= 3.2.5, < 4.0)
177
+ rubocop-ast (>= 1.28.0, < 2.0)
154
178
  ruby-progressbar (~> 1.7)
155
- unicode-display_width (>= 1.4.0, < 3.0)
156
- rubocop-ast (1.7.0)
157
- parser (>= 3.0.1.1)
158
- ruby-progressbar (1.11.0)
159
- simplecov (0.21.2)
179
+ unicode-display_width (>= 2.4.0, < 3.0)
180
+ rubocop-ast (1.28.0)
181
+ parser (>= 3.2.1.0)
182
+ ruby-progressbar (1.13.0)
183
+ simplecov (0.22.0)
160
184
  docile (~> 1.1)
161
185
  simplecov-html (~> 0.11)
162
186
  simplecov_json_formatter (~> 0.1)
163
187
  simplecov-html (0.12.3)
164
- simplecov_json_formatter (0.1.3)
165
- slim (4.1.0)
166
- temple (>= 0.7.6, < 0.9)
167
- tilt (>= 2.0.6, < 2.1)
168
- sprockets (4.0.2)
169
- concurrent-ruby (~> 1.0)
170
- rack (> 1, < 3)
171
- sprockets-rails (3.2.2)
172
- actionpack (>= 4.0)
173
- activesupport (>= 4.0)
174
- sprockets (>= 3.0.0)
175
- sqlite3 (1.4.2)
176
- temple (0.8.2)
177
- thor (1.1.0)
178
- tilt (2.0.10)
179
- tzinfo (2.0.4)
188
+ simplecov_json_formatter (0.1.4)
189
+ slim (5.1.0)
190
+ temple (~> 0.10.0)
191
+ tilt (>= 2.0.6, < 2.2)
192
+ spring (4.1.1)
193
+ sqlite3 (1.6.2-x86_64-linux)
194
+ temple (0.10.0)
195
+ thor (1.2.1)
196
+ tilt (2.1.0)
197
+ timeout (0.3.2)
198
+ tzinfo (2.0.6)
180
199
  concurrent-ruby (~> 1.0)
181
- unicode-display_width (2.0.0)
200
+ unicode-display_width (2.4.2)
182
201
  websocket-driver (0.7.5)
183
202
  websocket-extensions (>= 0.1.0)
184
203
  websocket-extensions (0.1.5)
185
204
  xpath (3.2.0)
186
205
  nokogiri (~> 1.8)
187
- zeitwerk (2.4.2)
206
+ zeitwerk (2.6.7)
188
207
 
189
208
  PLATFORMS
190
209
  x86_64-linux
191
210
 
192
211
  DEPENDENCIES
193
212
  appraisal
194
- bundler
195
213
  capybara
196
214
  combustion
197
215
  formie!
198
216
  minitest
199
217
  observr
200
218
  rails
201
- rake
219
+ ricecream
202
220
  rubocop
203
221
  simplecov
204
222
  slim
223
+ spring
205
224
  sqlite3
206
225
 
207
226
  BUNDLED WITH
208
- 2.2.17
227
+ 2.4.10
data/MIT-LICENSE CHANGED
@@ -1,4 +1,6 @@
1
- Copyright 2011-2021 Dittmar Krall - www.matique.com
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2011-2023 Dittmar Krall (www.matiq.com)
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Formie
2
- ======
1
+ # Formie
3
2
 
4
3
  [![Gem Version](https://badge.fury.io/rb/formie.svg)](https://badge.fury.io/rb/formie)
5
4
 
@@ -15,21 +14,14 @@ In short, Formie is like a helper using the notation of a partial.
15
14
 
16
15
  Templates handlers are supported as in partials.
17
16
 
18
-
19
17
  ## Installation
20
18
 
21
19
  As usual:
22
-
23
- $ [sudo] gem install formie
24
-
25
- or:
26
-
27
- # Gemfile
28
- gem 'formie'
29
-
30
- $ bundle
31
-
32
- Use 'gem install formie -v 0.7.1' for Rails 3.2.
20
+ ```ruby
21
+ # Gemfile
22
+ gem "formie"
23
+ ```
24
+ and run "bundle install".
33
25
 
34
26
  ## Description
35
27
 
@@ -42,6 +34,8 @@ Templates for Formie are hosted in:
42
34
  Till Rails 5 <formie_path> is 'app/formies'.
43
35
  Starting at Rails 6 <formie_path> is 'app/views/formies'.
44
36
 
37
+ Version 1.1.0+ is intended for Rails 7
38
+
45
39
  Inside a formie the following locals (as delivered by the
46
40
  controller) are available:
47
41
 
@@ -51,7 +45,7 @@ controller) are available:
51
45
  | args | remainings after extracting options/locals
52
46
  | block | block passed to the formie
53
47
  | controller_name
54
- | form | (available inside form_for (similar to fields_for))
48
+ | form | (available inside form_with (similar to fields_for))
55
49
  | form.object
56
50
  | params
57
51
 
@@ -60,45 +54,55 @@ The controller attributes are available as usual.
60
54
 
61
55
  To avoid a server restart during development of formies you may add to:
62
56
 
63
- # app/controllers/application_controller.rb
64
-
65
- before_filter do
66
- Formie.reload if Rails.env.development?
67
- end
57
+ ```ruby
58
+ # app/controllers/application_controller.rb
68
59
 
60
+ before_filter do
61
+ Formie.reload if Rails.env.development?
62
+ end
63
+ ```
69
64
 
70
- ## Examples
65
+ ## Examples (see also tests)
71
66
 
72
- <%= copyright %>
73
- <%= back %>
74
- <%= show obj: @order %>
67
+ ```ruby
68
+ <%= copyright %>
69
+ <%= back %>
70
+ <%= show obj: @order %>
75
71
 
76
- <%= form_for @order do |f| %>
77
- <%= f.l_text_field :who %>
78
- <%= f.l_text_field :amount %>
79
- <% end %>
72
+ <%= form_with model: Order do |f| %>
73
+ <%= f.l_text_field :who %>
74
+ <%= f.l_text_field :amount %>
75
+ <% end %>
76
+ ```
80
77
 
81
78
  In directory <formie_path> :
82
79
 
83
- # application/copyright.html.erb
84
- <div class="copyright"> Copyright (c) 2009 </div>
80
+ ```ruby
81
+ # application/copyright.html.erb
82
+ <div class="copyright"> Copyright (c) 2009 </div>
83
+
84
+ # application/back.html.erb
85
+ <a href="<%= "/#{h(controller_name)}" %>"> Back </a>
86
+
87
+ # application/show.html.erb
88
+ <a href="<%= "/#{h(controller_name)}/#{obj.id}" %>"> Show </a>
85
89
 
86
- # application/back.html.erb
87
- <a href="<%= "/#{h(controller_name)}" %>"> Back </a>
90
+ # forms/l_text_field.html.erb
91
+ <% field = args.first %>
92
+ <p>
93
+ <%= form.label field %><br />
94
+ <%= form.text_field field %>
95
+ </p>
88
96
 
89
- # application/show.html.erb
90
- <a href="<%= "/#{h(controller_name)}/#{obj.id}" %>"> Show </a>
97
+ # templates/hello.slim
98
+ / a comment
91
99
 
92
- # forms/l_text_field.html.erb
93
- <% field = args.first %>
94
- <p>
95
- <%= form.label field %><br />
96
- <%= form.text_field field %>
97
- </p>
100
+ span Hello Slim
101
+ ```
98
102
 
99
- # templates/hello.slim
100
- / a comment
103
+ ## Miscellaneous
101
104
 
102
- span Hello Slim
105
+ Copyright (c) 2009-2023 Dittmar Krall (www.matiq.com),
106
+ released under the MIT license:
103
107
 
104
- Copyright (c) 2009-2019 Dittmar Krall, released under the MIT license.
108
+ * https://opensource.org/licenses/MIT
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require 'rake/testtask'
1
+ require "rake/testtask"
2
2
 
3
- desc 'Run the tests.'
3
+ desc "Run the tests."
4
4
  Rake::TestTask.new do |t|
5
- t.libs << 'lib'
6
- t.libs << 'test'
7
- t.pattern = 'test/**/*_test.rb'
5
+ t.libs << "lib"
6
+ t.libs << "test"
7
+ t.pattern = "test/**/*_test.rb"
8
8
  t.verbose = false
9
9
  end
10
10
 
data/formie.gemspec CHANGED
@@ -1,33 +1,30 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'formie/version'
3
+ require "formie/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = 'formie'
7
- s.version = Formie::VERSION
8
- s.summary = 'Formie is like a Rails helper, but uses the notation of a partial.'
6
+ s.name = "formie"
7
+ s.version = Formie::VERSION
8
+ s.summary = "Formie is like a Rails helper, but uses the notation of a partial."
9
9
  s.description = <<-'END'
10
10
  Formie implements low level template-based Rails helpers. It injects
11
11
  the formies into the ActionView module. The form-bounded as well as
12
12
  the unbounded templates are supported. Still, the ActionView
13
13
  functionality (e.g. text_field) is kept untouched.
14
14
  END
15
- s.authors = ['Dittmar Krall']
16
- s.email = ['dittmar.krall@matique.de']
17
- s.homepage = 'http://matique.de'
15
+ s.authors = ["Dittmar Krall"]
16
+ s.email = ["dittmar.krall@matiq.com"]
17
+ s.homepage = "http://matiq.com"
18
+ s.license = "MIT"
19
+ s.platform = Gem::Platform::RUBY
18
20
 
19
- s.license = 'MIT'
20
- s.platform = Gem::Platform::RUBY
21
+ s.metadata["source_code_uri"] = "https://github.com/matique/formie"
21
22
 
22
- s.files = `git ls-files -z`.split("\x0")
23
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
24
- s.require_paths = ['lib']
23
+ s.files = `git ls-files -z`.split("\x0")
24
+ s.require_paths = ["lib"]
25
25
 
26
- s.add_development_dependency 'bundler'
27
- s.add_development_dependency 'rake'
28
- s.add_development_dependency 'appraisal'
29
- s.add_development_dependency 'combustion'
30
-
31
- s.add_development_dependency 'minitest'
32
- s.add_development_dependency 'sqlite3'
26
+ s.add_development_dependency "appraisal"
27
+ s.add_development_dependency "combustion"
28
+ s.add_development_dependency "minitest"
29
+ s.add_development_dependency "sqlite3"
33
30
  end
@@ -6,11 +6,13 @@ gem "rails", "~> 6.1"
6
6
  gem "dryer-config", "~> 6.0"
7
7
 
8
8
  group :test do
9
+ gem "capybara"
9
10
  gem "observr"
11
+ gem "ricecream"
10
12
  gem "rubocop", require: false
11
13
  gem "simplecov", require: false
12
- gem "capybara"
13
14
  gem "slim"
15
+ gem "spring"
14
16
  end
15
17
 
16
18
  gemspec path: "../"
@@ -2,14 +2,17 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 6.0"
5
+ gem "rails", "~> 7.0"
6
+ gem "dryer-config", "~> 7.0"
6
7
 
7
8
  group :test do
9
+ gem "capybara"
8
10
  gem "observr"
11
+ gem "ricecream"
9
12
  gem "rubocop", require: false
10
13
  gem "simplecov", require: false
11
- gem "capybara"
12
14
  gem "slim"
15
+ gem "spring"
13
16
  end
14
17
 
15
18
  gemspec path: "../"
@@ -1,9 +1,11 @@
1
1
  # rubocop: disable all
2
2
 
3
3
  module Formie
4
- VERSION = '1.0.4' # 2021-06-20
5
- # VERSION = '1.0.3' # 2020-07-23
6
- # VERSION = '1.0.0' # 2019-09-26
7
- # VERSION = '0.9.16' # 2019-03-05
8
- # VERSION = '0.9.14' # 2019-03-02
4
+ VERSION = "1.1.1" # 2023-04-17
5
+ # VERSION = "1.1.0" # 2022-12-18
6
+ # VERSION = "1.0.4" # 2021-06-20
7
+ # VERSION = "1.0.3" # 2020-07-23
8
+ # VERSION = "1.0.0" # 2019-09-26
9
+ # VERSION = "0.9.16" # 2019-03-05
10
+ # VERSION = "0.9.14" # 2019-03-02
9
11
  end
data/lib/formie.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'formie/engine'
3
+ require "formie/engine"
4
4
 
5
5
  module Formie
6
6
  Rails6 = Rails.version.to_f >= 6.0
7
- PATH = Rails6 ? 'app/views/formies' : 'app/formies'
7
+ PATH = Rails6 ? "app/views/formies" : "app/formies"
8
8
 
9
9
  def self.reload
10
10
  if Rails6 && !File.directory?("#{Rails.root}/app/views/formies")
@@ -14,8 +14,8 @@ module Formie
14
14
  now = Time.now
15
15
  @last_update ||= Time.new(0)
16
16
  load_formies(::ActionView::Helpers::FormBuilder, "#{PATH}/forms")
17
- load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/application")
18
- load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/templates")
17
+ load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/application")
18
+ load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/templates")
19
19
  @last_update = now
20
20
  end
21
21
 
@@ -27,15 +27,15 @@ module Formie
27
27
  params = args.extract_options!
28
28
  options = {}
29
29
  if Rails6
30
- options[:template] = path.sub("#{Rails.root}/app/views", '')
30
+ options[:template] = path.sub("#{Rails.root}/app/views", "")
31
31
  else
32
32
  options[:file] = path
33
33
  end
34
34
  options[:locals] = {}
35
35
  options[:locals].update params
36
36
  options[:locals].update formiename: formiename,
37
- block: block, form: self, args: args
38
- if defined?(controller) == 'method' &&
37
+ block: block, form: self, args: args
38
+ if defined?(controller) == "method" &&
39
39
  controller.respond_to?(:render_to_body) # credits to MARS
40
40
  controller.render_to_body(options)
41
41
  else
@@ -51,8 +51,8 @@ module Formie
51
51
  return unless File.exist?(dir)
52
52
 
53
53
  hsh = {}
54
- Dir.glob(File.join(dir, '**', '**')).sort.each { |path|
55
- base = File.basename(path).split('.').first
54
+ Dir.glob(File.join(dir, "**", "**")).sort.each { |path|
55
+ base = File.basename(path).split(".").first
56
56
  hsh[base] = path unless hsh[base]
57
57
  }
58
58
  hsh.each { |name, path|
@@ -1,16 +1,14 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  class OrdersControllerTest < ActionController::TestCase
4
-
5
- test 'checking formie copyright' do
4
+ test "formie copyright" do
6
5
  get :index
7
6
  assert_response :success
8
- # assert_not_nil assigns(:orders)
7
+ # assert_not_nil assigns(:orders)
9
8
  assert_match(/copyright/, response.body)
10
9
  assert_match(/Copyright/, response.body)
11
- assert_match(/label/ , response.body)
12
- assert_match(/input/ , response.body)
13
- assert_match(/def/ , response.body)
10
+ assert_match(/label/, response.body)
11
+ assert_match(/input/, response.body)
12
+ assert_match(/def/, response.body)
14
13
  end
15
-
16
14
  end
@@ -1,36 +1,40 @@
1
1
  # http://blog.crowdint.com/2013/06/14/testing-rails-with-minitest.html
2
2
 
3
- require 'test_helper'
3
+ require "test_helper"
4
4
 
5
5
  describe "Formie" do
6
6
  include Capybara::DSL
7
7
 
8
8
  before do
9
9
  Order.delete_all
10
- Order.create :name => 'Rumpelstilzchen'
10
+ Order.create name: "Rumpelstilzchen"
11
11
  end
12
12
 
13
- it 'should display copyright' do
13
+ it "should display copyright" do
14
14
  visit "/orders"
15
- assert page.has_content?('Copyright')
15
+ assert page.has_content?("Copyright")
16
16
  end
17
17
 
18
- it 'should list one order' do
18
+ it "should list one order" do
19
19
  order = Order.all.first
20
20
 
21
21
  visit "/orders/#{order.id}"
22
- assert_equal order.name, page.find('form p input#order_name').value
23
- assert_equal 'Hello Slim', page.find('form span').text
22
+ # using form_with:
23
+ fnd = 'form p input[name="order[name]"]'
24
+ assert_equal order.name, page.find(fnd).value
25
+ # using form_for:
26
+ # assert_equal order.name, page.find("form p input#order_name").value
27
+ assert_equal "Hello Slim", page.find("form span").text
24
28
  end
25
29
 
26
- it 'should remove comments in Slim testing full stack' do
30
+ it "should remove comments in Slim testing full stack" do
27
31
  order = Order.all.first
28
32
 
29
33
  visit "/orders/#{order.id}"
30
34
  refute page.has_content?("a comment")
31
35
  end
32
36
 
33
- it 'builtins' do
37
+ it "builtins" do
34
38
  visit "/orders/new"
35
39
  assert page.has_content?("action_name new")
36
40
  assert page.has_content?("args [123, 456]")
@@ -40,5 +44,4 @@ describe "Formie" do
40
44
  assert page.has_content?("form.object Order")
41
45
  assert page.has_content?("params new")
42
46
  end
43
-
44
47
  end
@@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base
2
2
  protect_from_forgery with: :exception
3
3
 
4
4
  before_action do
5
- Formie.reload if 'development' == Rails.env
5
+ Formie.reload if Rails.env == "development"
6
6
  end
7
-
8
7
  end
@@ -1,5 +1,4 @@
1
1
  class OrdersController < ApplicationController
2
-
3
2
  def index
4
3
  @orders = Order.all
5
4
  end
@@ -9,8 +8,7 @@ class OrdersController < ApplicationController
9
8
  end
10
9
 
11
10
  def show
12
- Order.create :name => 'hugo'
11
+ Order.create name: "hugo"
13
12
  @order = Order.find(params[:id])
14
13
  end
15
-
16
14
  end
@@ -1,7 +1,5 @@
1
1
  class Order < ApplicationRecord
2
-
3
2
  before_save do |row|
4
- row.errors.add :base, 'panic' if row.name == 'error'
3
+ row.errors.add :base, "panic" if row.name == "error"
5
4
  end
6
-
7
5
  end
@@ -1,3 +1,3 @@
1
- <%= form_for @order do |f| %>
1
+ <%= form_with model: @order, class: Order do |f| %>
2
2
  <%= render 'new', :f => f %>
3
3
  <% end %>
@@ -1,3 +1,3 @@
1
- <%= form_for @order do |f| %>
1
+ <%= form_with model: @order do |f| %>
2
2
  <%= render 'form', :f => f %>
3
3
  <% end %>
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
2
  resources :orders
3
- root :to => 'orders#index'
3
+ root to: "orders#index"
4
4
  end
@@ -1,10 +1,8 @@
1
1
  ActiveRecord::Schema.define(version: 20141016161801) do
2
-
3
2
  create_table "orders", force: true do |t|
4
- t.string "name"
5
- t.string "qty"
3
+ t.string "name"
4
+ t.string "qty"
6
5
  t.datetime "created_at", null: false
7
6
  t.datetime "updated_at", null: false
8
7
  end
9
-
10
8
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
- if ENV['COVERAGE']
2
- require 'simplecov'
1
+ if ENV["COVERAGE"]
2
+ require "simplecov"
3
3
  SimpleCov.start do
4
- add_filter '/test/'
4
+ add_filter "/test/"
5
5
  end
6
6
  end
7
7
 
@@ -9,7 +9,7 @@ require "combustion"
9
9
  Combustion.path = "test/internal"
10
10
  Combustion.initialize! :active_record
11
11
 
12
- require 'rails/test_help'
13
- require 'minitest/autorun'
14
- require 'minitest/benchmark'
15
- require 'capybara/rails'
12
+ require "rails/test_help"
13
+ require "minitest/autorun"
14
+ require "minitest/benchmark"
15
+ require "capybara/rails"
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dittmar Krall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-20 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: appraisal
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -100,17 +72,15 @@ description: |2
100
72
  the unbounded templates are supported. Still, the ActionView
101
73
  functionality (e.g. text_field) is kept untouched.
102
74
  email:
103
- - dittmar.krall@matique.de
75
+ - dittmar.krall@matiq.com
104
76
  executables: []
105
77
  extensions: []
106
78
  extra_rdoc_files: []
107
79
  files:
108
80
  - ".github/workflows/rake.yml"
109
81
  - ".gitignore"
110
- - ".rubocop.yml"
111
82
  - ".ruby-gemset"
112
83
  - ".ruby-version"
113
- - ".watchr"
114
84
  - Appraisals
115
85
  - Gemfile
116
86
  - Gemfile.lock
@@ -119,8 +89,8 @@ files:
119
89
  - Rakefile
120
90
  - config/initializers/formie.rb
121
91
  - formie.gemspec
122
- - gemfiles/rails_6.0.gemfile
123
92
  - gemfiles/rails_6.1.gemfile
93
+ - gemfiles/rails_7.0.gemfile
124
94
  - lib/formie.rb
125
95
  - lib/formie/engine.rb
126
96
  - lib/formie/version.rb
@@ -155,10 +125,11 @@ files:
155
125
  - test/internal/db/migrate/20141016161801_create_orders.rb
156
126
  - test/internal/db/schema.rb
157
127
  - test/test_helper.rb
158
- homepage: http://matique.de
128
+ homepage: http://matiq.com
159
129
  licenses:
160
130
  - MIT
161
- metadata: {}
131
+ metadata:
132
+ source_code_uri: https://github.com/matique/formie
162
133
  post_install_message:
163
134
  rdoc_options: []
164
135
  require_paths:
@@ -174,39 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
145
  - !ruby/object:Gem::Version
175
146
  version: '0'
176
147
  requirements: []
177
- rubygems_version: 3.2.6
148
+ rubygems_version: 3.4.10
178
149
  signing_key:
179
150
  specification_version: 4
180
151
  summary: Formie is like a Rails helper, but uses the notation of a partial.
181
- test_files:
182
- - test/controllers/orders_test.rb
183
- - test/integration/order_test.rb
184
- - test/internal/app/assets/config/manifest.js
185
- - test/internal/app/controllers/application_controller.rb
186
- - test/internal/app/controllers/orders_controller.rb
187
- - test/internal/app/formies/application/copyright.html.erb
188
- - test/internal/app/formies/forms/builtins.html.erb
189
- - test/internal/app/formies/forms/l_text_field.html.erb
190
- - test/internal/app/formies/templates/hello.slim
191
- - test/internal/app/formies/templates/l_text_field.html.erb
192
- - test/internal/app/formies/templates/labelled.html.erb
193
- - test/internal/app/models/application_record.rb
194
- - test/internal/app/models/order.rb
195
- - test/internal/app/views/formies/application/copyright.html.erb
196
- - test/internal/app/views/formies/forms/builtins.html.erb
197
- - test/internal/app/views/formies/forms/l_text_field.html.erb
198
- - test/internal/app/views/formies/templates/hello.slim
199
- - test/internal/app/views/formies/templates/l_text_field.html.erb
200
- - test/internal/app/views/formies/templates/labelled.html.erb
201
- - test/internal/app/views/layouts/application.html.erb
202
- - test/internal/app/views/orders/_form.html.erb
203
- - test/internal/app/views/orders/_new.html.erb
204
- - test/internal/app/views/orders/index.html.erb
205
- - test/internal/app/views/orders/new.html.erb
206
- - test/internal/app/views/orders/show.html.erb
207
- - test/internal/config/database.yml
208
- - test/internal/config/routes.rb
209
- - test/internal/config/secrets.yml
210
- - test/internal/db/migrate/20141016161801_create_orders.rb
211
- - test/internal/db/schema.rb
212
- - test/test_helper.rb
152
+ test_files: []
data/.rubocop.yml DELETED
@@ -1,18 +0,0 @@
1
- inherit_from:
2
- - '~/configs/.rubocop.yml'
3
-
4
- AllCops:
5
- NewCops: enable
6
- Include:
7
- - 'lib/**/*.rb'
8
- Exclude:
9
- - 'test/**/*'
10
-
11
- Layout/ArgumentAlignment:
12
- Enabled: false
13
-
14
- Metrics/AbcSize:
15
- Enabled: false
16
-
17
- Style/ClassAndModuleChildren:
18
- Enabled: false
data/.watchr DELETED
@@ -1,48 +0,0 @@
1
- HH = '#' * 22 unless defined?(HH)
2
- H = '#' * 5 unless defined?(H)
3
-
4
- def usage
5
- puts <<-EOS
6
- Ctrl-\\ or ctrl-4 Running all tests
7
- Ctrl-C Exit
8
- EOS
9
- end
10
-
11
- def run(cmd)
12
- puts "#{HH} #{Time.now} #{HH}"
13
- puts "#{H} #{cmd}"
14
- system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
15
- end
16
-
17
- def run_it(type, file)
18
- case type
19
- when 'test'; run %(bundle exec ruby -I test #{file})
20
- # when 'spec'; run %(rspec -X #{file})
21
- else; puts "#{H} unknown type: #{type}, file: #{file}"
22
- end
23
- end
24
-
25
- def run_all_tests
26
- puts "\n#{HH} Running all tests #{HH}\n"
27
- %w[test spec].each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
28
- end
29
-
30
- def run_matching_files(base)
31
- base = base.split('_').first
32
- %w[test spec].each { |type|
33
- files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
34
- run_it type, files.join(' ') unless files.empty?
35
- }
36
- end
37
-
38
- %w[test spec].each { |type|
39
- watch("#{type}/#{type}_helper\.rb") { run_all_tests }
40
- watch('lib/.*\.rb') { run_all_tests }
41
- watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
42
- }
43
-
44
- # Ctrl-\ or ctrl-4
45
- Signal.trap('QUIT') { run_all_tests }
46
- # Ctrl-C
47
- Signal.trap('INT') { abort("Interrupted\n") }
48
- usage