formie 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +10 -6
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.watchr +27 -16
- data/Appraisals +16 -11
- data/Gemfile +9 -7
- data/Gemfile.lock +130 -109
- data/MIT-LICENSE +3 -1
- data/README.md +48 -43
- data/Rakefile +5 -5
- data/formie.gemspec +19 -19
- data/gemfiles/rails_6.1.gemfile +3 -1
- data/gemfiles/{rails_6.0.gemfile → rails_7.0.gemfile} +5 -2
- data/lib/formie/version.rb +6 -5
- data/lib/formie.rb +9 -9
- data/test/controllers/orders_test.rb +6 -8
- data/test/integration/order_test.rb +13 -10
- data/test/internal/app/controllers/application_controller.rb +1 -2
- data/test/internal/app/controllers/orders_controller.rb +1 -3
- data/test/internal/app/models/order.rb +1 -3
- data/test/internal/app/views/orders/new.html.erb +1 -1
- data/test/internal/app/views/orders/show.html.erb +1 -1
- data/test/internal/config/routes.rb +1 -1
- data/test/internal/db/schema.rb +2 -4
- data/test/test_helper.rb +7 -7
- metadata +9 -40
- data/.rubocop.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe4a0b9ed817eb315c1e2a747746a8cbf0089d8f48998df22f1d1bdbab6af9a
|
4
|
+
data.tar.gz: 79b1686a7d0069eb6d5a8fc5efe09d249fba17d52b046cba3a53d42deb5514c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 565548b5914977f2fa2244cc46852f303601a66f446191f52d0f1b19256bbe45f9cc834deeca13b3d7e6f2b40d55e481a31b5579f3b2bd829cf51b5a995a4573
|
7
|
+
data.tar.gz: 5123b2894e320641887f809de931e8bda8e2ef209b470b0d9224d9dc0fec976e671966a06439f515f44359afc11bd1c3d4fad0828b5361aea1e7f272f306860c
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
|
1
2
|
name: Rake
|
2
3
|
|
3
4
|
#on: [push, pull_request]
|
@@ -8,17 +9,20 @@ jobs:
|
|
8
9
|
strategy:
|
9
10
|
fail-fast: false
|
10
11
|
matrix:
|
11
|
-
# os: [ubuntu-latest, macos-latest]
|
12
12
|
os: [ubuntu-latest]
|
13
13
|
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
14
|
-
|
15
|
-
|
14
|
+
ruby: ["2.7", "3.0", "3.1", head]
|
15
|
+
test_command: ["bundle exec rake test"]
|
16
16
|
runs-on: ${{ matrix.os }}
|
17
17
|
|
18
18
|
steps:
|
19
|
-
- uses: actions/checkout@
|
19
|
+
- uses: actions/checkout@v3
|
20
20
|
- uses: ruby/setup-ruby@v1
|
21
21
|
with:
|
22
22
|
ruby-version: ${{ matrix.ruby }}
|
23
|
-
|
24
|
-
|
23
|
+
- name: Bundle install
|
24
|
+
run: |
|
25
|
+
bundle config path /home/runner/bundle
|
26
|
+
bundle install
|
27
|
+
bundle update
|
28
|
+
- run: ${{ matrix.test_command }}
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rails-
|
1
|
+
rails-7.0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-3.1.3
|
data/.watchr
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
TESTING = %w[test]
|
2
|
+
HH = "#" * 22 unless defined?(HH)
|
3
|
+
H = "#" * 5 unless defined?(H)
|
3
4
|
|
4
5
|
def usage
|
5
6
|
puts <<-EOS
|
@@ -16,33 +17,43 @@ end
|
|
16
17
|
|
17
18
|
def run_it(type, file)
|
18
19
|
case type
|
19
|
-
when
|
20
|
-
# when 'spec'; run %(rspec -X #{file})
|
21
|
-
else;
|
20
|
+
when "test" then run %(bundle exec ruby -I test #{file})
|
21
|
+
# when 'spec'; run %(rspec -X #{file})
|
22
|
+
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
def run_all_tests
|
26
27
|
puts "\n#{HH} Running all tests #{HH}\n"
|
27
|
-
|
28
|
+
TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
|
28
29
|
end
|
29
30
|
|
30
31
|
def run_matching_files(base)
|
31
|
-
base = base.split(
|
32
|
-
|
33
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_
|
34
|
-
run_it type, files.join(
|
32
|
+
base = base.split("_").first
|
33
|
+
TESTING.each { |type|
|
34
|
+
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*.rb/ }
|
35
|
+
run_it type, files.join(" ") unless files.empty?
|
35
36
|
}
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
-
watch("#{type}/#{type}_helper
|
40
|
-
watch(
|
41
|
-
watch("#{type}/.*/*_#{type}
|
39
|
+
TESTING.each { |type|
|
40
|
+
watch("#{type}/#{type}_helper.rb") { run_all_tests }
|
41
|
+
watch("lib/.*.rb") { run_all_tests }
|
42
|
+
watch("#{type}/.*/*_#{type}.rb") { |match| run_it type, match[0] }
|
43
|
+
watch("#{type}/data/(.*).rb") { |match|
|
44
|
+
m1 = match[1]
|
45
|
+
run_matching_files("#{type}/#{m1}/#{m1}_#{type}.rb")
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
%w[rb erb haml slim].each { |type|
|
50
|
+
watch(".*/(.*).#{type}") { |match|
|
51
|
+
run_matching_files(match[1])
|
52
|
+
}
|
42
53
|
}
|
43
54
|
|
44
55
|
# Ctrl-\ or ctrl-4
|
45
|
-
|
56
|
+
Signal.trap("QUIT") { run_all_tests }
|
46
57
|
# Ctrl-C
|
47
|
-
|
58
|
+
Signal.trap("INT") { abort("Interrupted\n") }
|
48
59
|
usage
|
data/Appraisals
CHANGED
@@ -1,20 +1,25 @@
|
|
1
|
-
appraise
|
2
|
-
gem
|
3
|
-
gem
|
1
|
+
appraise "rails-7.0" do
|
2
|
+
gem "rails", "~> 7.0"
|
3
|
+
gem "dryer-config", "~> 7.0"
|
4
4
|
end
|
5
5
|
|
6
|
-
appraise
|
7
|
-
gem
|
6
|
+
appraise "rails-6.1" do
|
7
|
+
gem "rails", "~> 6.1"
|
8
|
+
gem "dryer-config", "~> 6.0"
|
8
9
|
end
|
9
10
|
|
10
|
-
#appraise
|
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
|
1
|
+
source "https://rubygems.org"
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem
|
4
|
+
gem "rails"
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
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
@@ -6,185 +6,204 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (
|
10
|
-
actionpack (=
|
11
|
-
activesupport (=
|
9
|
+
actioncable (7.0.4)
|
10
|
+
actionpack (= 7.0.4)
|
11
|
+
activesupport (= 7.0.4)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (
|
15
|
-
actionpack (=
|
16
|
-
activejob (=
|
17
|
-
activerecord (=
|
18
|
-
activestorage (=
|
19
|
-
activesupport (=
|
14
|
+
actionmailbox (7.0.4)
|
15
|
+
actionpack (= 7.0.4)
|
16
|
+
activejob (= 7.0.4)
|
17
|
+
activerecord (= 7.0.4)
|
18
|
+
activestorage (= 7.0.4)
|
19
|
+
activesupport (= 7.0.4)
|
20
20
|
mail (>= 2.7.1)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
net-imap
|
22
|
+
net-pop
|
23
|
+
net-smtp
|
24
|
+
actionmailer (7.0.4)
|
25
|
+
actionpack (= 7.0.4)
|
26
|
+
actionview (= 7.0.4)
|
27
|
+
activejob (= 7.0.4)
|
28
|
+
activesupport (= 7.0.4)
|
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 (
|
29
|
-
actionview (=
|
30
|
-
activesupport (=
|
31
|
-
rack (~> 2.0, >= 2.0
|
34
|
+
actionpack (7.0.4)
|
35
|
+
actionview (= 7.0.4)
|
36
|
+
activesupport (= 7.0.4)
|
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 (
|
36
|
-
actionpack (=
|
37
|
-
activerecord (=
|
38
|
-
activestorage (=
|
39
|
-
activesupport (=
|
41
|
+
actiontext (7.0.4)
|
42
|
+
actionpack (= 7.0.4)
|
43
|
+
activerecord (= 7.0.4)
|
44
|
+
activestorage (= 7.0.4)
|
45
|
+
activesupport (= 7.0.4)
|
46
|
+
globalid (>= 0.6.0)
|
40
47
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (
|
42
|
-
activesupport (=
|
48
|
+
actionview (7.0.4)
|
49
|
+
activesupport (= 7.0.4)
|
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 (
|
48
|
-
activesupport (=
|
54
|
+
activejob (7.0.4)
|
55
|
+
activesupport (= 7.0.4)
|
49
56
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (
|
51
|
-
activesupport (=
|
52
|
-
activerecord (
|
53
|
-
activemodel (=
|
54
|
-
activesupport (=
|
55
|
-
activestorage (
|
56
|
-
actionpack (=
|
57
|
-
activejob (=
|
58
|
-
activerecord (=
|
59
|
-
activesupport (=
|
60
|
-
marcel (~> 1.0
|
61
|
-
mini_mime (
|
62
|
-
activesupport (
|
57
|
+
activemodel (7.0.4)
|
58
|
+
activesupport (= 7.0.4)
|
59
|
+
activerecord (7.0.4)
|
60
|
+
activemodel (= 7.0.4)
|
61
|
+
activesupport (= 7.0.4)
|
62
|
+
activestorage (7.0.4)
|
63
|
+
actionpack (= 7.0.4)
|
64
|
+
activejob (= 7.0.4)
|
65
|
+
activerecord (= 7.0.4)
|
66
|
+
activesupport (= 7.0.4)
|
67
|
+
marcel (~> 1.0)
|
68
|
+
mini_mime (>= 1.1.0)
|
69
|
+
activesupport (7.0.4)
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
appraisal (2.4.0)
|
74
|
+
addressable (2.8.1)
|
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.
|
82
|
+
capybara (3.38.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.
|
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.
|
95
|
+
concurrent-ruby (1.1.10)
|
89
96
|
crass (1.0.6)
|
97
|
+
date (3.3.2)
|
90
98
|
docile (1.4.0)
|
91
|
-
erubi (1.
|
92
|
-
globalid (0.
|
93
|
-
activesupport (>=
|
94
|
-
i18n (1.
|
99
|
+
erubi (1.11.0)
|
100
|
+
globalid (1.0.0)
|
101
|
+
activesupport (>= 5.0)
|
102
|
+
i18n (1.12.0)
|
95
103
|
concurrent-ruby (~> 1.0)
|
96
|
-
|
104
|
+
json (2.6.3)
|
105
|
+
loofah (2.19.1)
|
97
106
|
crass (~> 1.0.2)
|
98
107
|
nokogiri (>= 1.5.9)
|
99
|
-
mail (2.
|
108
|
+
mail (2.8.0)
|
100
109
|
mini_mime (>= 0.1.1)
|
101
|
-
|
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.
|
104
|
-
minitest (5.
|
105
|
-
|
106
|
-
|
116
|
+
mini_mime (1.1.2)
|
117
|
+
minitest (5.16.3)
|
118
|
+
net-imap (0.3.2)
|
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.8)
|
128
|
+
nokogiri (1.13.10-x86_64-linux)
|
107
129
|
racc (~> 1.4)
|
108
130
|
observr (1.0.5)
|
109
|
-
parallel (1.
|
110
|
-
parser (3.
|
131
|
+
parallel (1.22.1)
|
132
|
+
parser (3.1.3.0)
|
111
133
|
ast (~> 2.4.1)
|
112
|
-
public_suffix (
|
113
|
-
racc (1.
|
114
|
-
rack (2.2.
|
115
|
-
rack-test (
|
116
|
-
rack (>= 1.
|
117
|
-
rails (
|
118
|
-
actioncable (=
|
119
|
-
actionmailbox (=
|
120
|
-
actionmailer (=
|
121
|
-
actionpack (=
|
122
|
-
actiontext (=
|
123
|
-
actionview (=
|
124
|
-
activejob (=
|
125
|
-
activemodel (=
|
126
|
-
activerecord (=
|
127
|
-
activestorage (=
|
128
|
-
activesupport (=
|
134
|
+
public_suffix (5.0.1)
|
135
|
+
racc (1.6.1)
|
136
|
+
rack (2.2.4)
|
137
|
+
rack-test (2.0.2)
|
138
|
+
rack (>= 1.3)
|
139
|
+
rails (7.0.4)
|
140
|
+
actioncable (= 7.0.4)
|
141
|
+
actionmailbox (= 7.0.4)
|
142
|
+
actionmailer (= 7.0.4)
|
143
|
+
actionpack (= 7.0.4)
|
144
|
+
actiontext (= 7.0.4)
|
145
|
+
actionview (= 7.0.4)
|
146
|
+
activejob (= 7.0.4)
|
147
|
+
activemodel (= 7.0.4)
|
148
|
+
activerecord (= 7.0.4)
|
149
|
+
activestorage (= 7.0.4)
|
150
|
+
activesupport (= 7.0.4)
|
129
151
|
bundler (>= 1.15.0)
|
130
|
-
railties (=
|
131
|
-
sprockets-rails (>= 2.0.0)
|
152
|
+
railties (= 7.0.4)
|
132
153
|
rails-dom-testing (2.0.3)
|
133
154
|
activesupport (>= 4.2.0)
|
134
155
|
nokogiri (>= 1.6)
|
135
|
-
rails-html-sanitizer (1.
|
136
|
-
loofah (~> 2.
|
137
|
-
railties (
|
138
|
-
actionpack (=
|
139
|
-
activesupport (=
|
156
|
+
rails-html-sanitizer (1.4.4)
|
157
|
+
loofah (~> 2.19, >= 2.19.1)
|
158
|
+
railties (7.0.4)
|
159
|
+
actionpack (= 7.0.4)
|
160
|
+
activesupport (= 7.0.4)
|
140
161
|
method_source
|
141
|
-
rake (>=
|
162
|
+
rake (>= 12.2)
|
142
163
|
thor (~> 1.0)
|
143
|
-
|
144
|
-
|
145
|
-
|
164
|
+
zeitwerk (~> 2.5)
|
165
|
+
rainbow (3.1.1)
|
166
|
+
rake (13.0.6)
|
167
|
+
regexp_parser (2.6.1)
|
146
168
|
rexml (3.2.5)
|
147
|
-
|
169
|
+
ricecream (0.2.1)
|
170
|
+
rubocop (1.40.0)
|
171
|
+
json (~> 2.3)
|
148
172
|
parallel (~> 1.10)
|
149
|
-
parser (>= 3.
|
173
|
+
parser (>= 3.1.2.1)
|
150
174
|
rainbow (>= 2.2.2, < 4.0)
|
151
175
|
regexp_parser (>= 1.8, < 3.0)
|
152
|
-
rexml
|
153
|
-
rubocop-ast (>= 1.
|
176
|
+
rexml (>= 3.2.5, < 4.0)
|
177
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
154
178
|
ruby-progressbar (~> 1.7)
|
155
179
|
unicode-display_width (>= 1.4.0, < 3.0)
|
156
|
-
rubocop-ast (1.
|
157
|
-
parser (>= 3.
|
180
|
+
rubocop-ast (1.24.0)
|
181
|
+
parser (>= 3.1.1.0)
|
158
182
|
ruby-progressbar (1.11.0)
|
159
183
|
simplecov (0.21.2)
|
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.
|
188
|
+
simplecov_json_formatter (0.1.4)
|
165
189
|
slim (4.1.0)
|
166
190
|
temple (>= 0.7.6, < 0.9)
|
167
191
|
tilt (>= 2.0.6, < 2.1)
|
168
|
-
|
169
|
-
|
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)
|
192
|
+
spring (4.1.0)
|
193
|
+
sqlite3 (1.5.4-x86_64-linux)
|
176
194
|
temple (0.8.2)
|
177
|
-
thor (1.1
|
178
|
-
tilt (2.0.
|
179
|
-
|
195
|
+
thor (1.2.1)
|
196
|
+
tilt (2.0.11)
|
197
|
+
timeout (0.3.1)
|
198
|
+
tzinfo (2.0.5)
|
180
199
|
concurrent-ruby (~> 1.0)
|
181
|
-
unicode-display_width (2.
|
200
|
+
unicode-display_width (2.3.0)
|
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.
|
206
|
+
zeitwerk (2.6.6)
|
188
207
|
|
189
208
|
PLATFORMS
|
190
209
|
x86_64-linux
|
@@ -199,10 +218,12 @@ DEPENDENCIES
|
|
199
218
|
observr
|
200
219
|
rails
|
201
220
|
rake
|
221
|
+
ricecream
|
202
222
|
rubocop
|
203
223
|
simplecov
|
204
224
|
slim
|
225
|
+
spring
|
205
226
|
sqlite3
|
206
227
|
|
207
228
|
BUNDLED WITH
|
208
|
-
2.
|
229
|
+
2.3.26
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2011-2022 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
|
-
|
24
|
-
|
25
|
-
|
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
|
48
|
+
| form | (available inside form_with (similar to fields_for))
|
55
49
|
| form.object
|
56
50
|
| params
|
57
51
|
|
@@ -60,45 +54,56 @@ 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
|
-
|
57
|
+
```ruby
|
58
|
+
# app/controllers/application_controller.rb
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
before_filter do
|
61
|
+
Formie.reload if Rails.env.development?
|
62
|
+
end
|
63
|
+
```
|
68
64
|
|
69
65
|
|
70
|
-
## Examples
|
66
|
+
## Examples (see also tests)
|
71
67
|
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
```ruby
|
69
|
+
<%= copyright %>
|
70
|
+
<%= back %>
|
71
|
+
<%= show obj: @order %>
|
75
72
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
<%= form_with model: Order do |f| %>
|
74
|
+
<%= f.l_text_field :who %>
|
75
|
+
<%= f.l_text_field :amount %>
|
76
|
+
<% end %>
|
77
|
+
```
|
80
78
|
|
81
79
|
In directory <formie_path> :
|
82
80
|
|
83
|
-
|
84
|
-
|
81
|
+
```ruby
|
82
|
+
# application/copyright.html.erb
|
83
|
+
<div class="copyright"> Copyright (c) 2009 </div>
|
84
|
+
|
85
|
+
# application/back.html.erb
|
86
|
+
<a href="<%= "/#{h(controller_name)}" %>"> Back </a>
|
87
|
+
|
88
|
+
# application/show.html.erb
|
89
|
+
<a href="<%= "/#{h(controller_name)}/#{obj.id}" %>"> Show </a>
|
85
90
|
|
86
|
-
|
87
|
-
|
91
|
+
# forms/l_text_field.html.erb
|
92
|
+
<% field = args.first %>
|
93
|
+
<p>
|
94
|
+
<%= form.label field %><br />
|
95
|
+
<%= form.text_field field %>
|
96
|
+
</p>
|
88
97
|
|
89
|
-
|
90
|
-
|
98
|
+
# templates/hello.slim
|
99
|
+
/ a comment
|
91
100
|
|
92
|
-
|
93
|
-
|
94
|
-
<p>
|
95
|
-
<%= form.label field %><br />
|
96
|
-
<%= form.text_field field %>
|
97
|
-
</p>
|
101
|
+
span Hello Slim
|
102
|
+
```
|
98
103
|
|
99
|
-
|
100
|
-
/ a comment
|
104
|
+
## Miscellaneous
|
101
105
|
|
102
|
-
|
106
|
+
Copyright (c) 2009-2022 Dittmar Krall (www.matiq.com),
|
107
|
+
released under the MIT license:
|
103
108
|
|
104
|
-
|
109
|
+
* https://opensource.org/licenses/MIT
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "rake/testtask"
|
2
2
|
|
3
|
-
desc
|
3
|
+
desc "Run the tests."
|
4
4
|
Rake::TestTask.new do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.pattern =
|
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,33 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
3
|
+
require "formie/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name
|
7
|
-
s.version
|
8
|
-
s.summary
|
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
|
16
|
-
s.email
|
17
|
-
s.homepage
|
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.
|
20
|
-
s.platform = Gem::Platform::RUBY
|
21
|
+
s.metadata["source_code_uri"] = "https://github.com/matique/formie"
|
21
22
|
|
22
|
-
s.files
|
23
|
-
s.
|
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
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency
|
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
30
|
|
31
|
-
s.add_development_dependency
|
32
|
-
s.add_development_dependency
|
31
|
+
s.add_development_dependency "minitest"
|
32
|
+
s.add_development_dependency "sqlite3"
|
33
33
|
end
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -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", "~>
|
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: "../"
|
data/lib/formie/version.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# rubocop: disable all
|
2
2
|
|
3
3
|
module Formie
|
4
|
-
VERSION =
|
5
|
-
# VERSION =
|
6
|
-
# VERSION =
|
7
|
-
# VERSION =
|
8
|
-
# VERSION =
|
4
|
+
VERSION = "1.1.0" # 2022-12-18
|
5
|
+
# VERSION = "1.0.4" # 2021-06-20
|
6
|
+
# VERSION = "1.0.3" # 2020-07-23
|
7
|
+
# VERSION = "1.0.0" # 2019-09-26
|
8
|
+
# VERSION = "0.9.16" # 2019-03-05
|
9
|
+
# VERSION = "0.9.14" # 2019-03-02
|
9
10
|
end
|
data/lib/formie.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "formie/engine"
|
4
4
|
|
5
5
|
module Formie
|
6
6
|
Rails6 = Rails.version.to_f >= 6.0
|
7
|
-
PATH = Rails6 ?
|
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,
|
18
|
-
load_formies(::ActionView::Helpers::TextHelper,
|
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
|
-
|
38
|
-
if defined?(controller) ==
|
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,
|
55
|
-
base = File.basename(path).split(
|
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
|
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
|
12
|
-
assert_match(/input
|
13
|
-
assert_match(/def
|
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
|
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 :
|
10
|
+
Order.create name: "Rumpelstilzchen"
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "should display copyright" do
|
14
14
|
visit "/orders"
|
15
|
-
assert page.has_content?(
|
15
|
+
assert page.has_content?("Copyright")
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it "should list one order" do
|
19
19
|
order = Order.all.first
|
20
20
|
|
21
21
|
visit "/orders/#{order.id}"
|
22
|
-
|
23
|
-
|
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
|
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
|
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
|
@@ -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 :
|
11
|
+
Order.create name: "hugo"
|
13
12
|
@order = Order.find(params[:id])
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
data/test/internal/db/schema.rb
CHANGED
@@ -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
|
5
|
-
t.string
|
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[
|
2
|
-
require
|
1
|
+
if ENV["COVERAGE"]
|
2
|
+
require "simplecov"
|
3
3
|
SimpleCov.start do
|
4
|
-
add_filter
|
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
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
12
|
+
require "rails/test_help"
|
13
|
+
require "minitest/autorun"
|
14
|
+
require "minitest/benchmark"
|
15
|
+
require "capybara/rails"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formie
|
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
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,13 @@ description: |2
|
|
100
100
|
the unbounded templates are supported. Still, the ActionView
|
101
101
|
functionality (e.g. text_field) is kept untouched.
|
102
102
|
email:
|
103
|
-
- dittmar.krall@
|
103
|
+
- dittmar.krall@matiq.com
|
104
104
|
executables: []
|
105
105
|
extensions: []
|
106
106
|
extra_rdoc_files: []
|
107
107
|
files:
|
108
108
|
- ".github/workflows/rake.yml"
|
109
109
|
- ".gitignore"
|
110
|
-
- ".rubocop.yml"
|
111
110
|
- ".ruby-gemset"
|
112
111
|
- ".ruby-version"
|
113
112
|
- ".watchr"
|
@@ -119,8 +118,8 @@ files:
|
|
119
118
|
- Rakefile
|
120
119
|
- config/initializers/formie.rb
|
121
120
|
- formie.gemspec
|
122
|
-
- gemfiles/rails_6.0.gemfile
|
123
121
|
- gemfiles/rails_6.1.gemfile
|
122
|
+
- gemfiles/rails_7.0.gemfile
|
124
123
|
- lib/formie.rb
|
125
124
|
- lib/formie/engine.rb
|
126
125
|
- lib/formie/version.rb
|
@@ -155,10 +154,11 @@ files:
|
|
155
154
|
- test/internal/db/migrate/20141016161801_create_orders.rb
|
156
155
|
- test/internal/db/schema.rb
|
157
156
|
- test/test_helper.rb
|
158
|
-
homepage: http://
|
157
|
+
homepage: http://matiq.com
|
159
158
|
licenses:
|
160
159
|
- MIT
|
161
|
-
metadata:
|
160
|
+
metadata:
|
161
|
+
source_code_uri: https://github.com/matique/formie
|
162
162
|
post_install_message:
|
163
163
|
rdoc_options: []
|
164
164
|
require_paths:
|
@@ -174,39 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
177
|
+
rubygems_version: 3.3.26
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
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
|
181
|
+
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
|