formie 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -0
- data/.ruby-version +1 -1
- data/.travis.yml +3 -1
- data/.watchr +6 -11
- data/Gemfile +2 -0
- data/MIT-LICENSE +1 -1
- data/README.md +2 -1
- data/Rakefile +2 -4
- data/formie.gemspec +4 -6
- data/gemfiles/rails_5.2.gemfile +0 -1
- data/gemfiles/rails_6.0.gemfile +0 -1
- data/lib/formie.rb +25 -25
- data/lib/formie/engine.rb +2 -0
- data/lib/formie/version.rb +9 -5
- data/test/internal/app/assets/config/manifest.js +1 -0
- data/test/test_helper.rb +7 -11
- metadata +20 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11eb2cab3c397141a12277050a9c6e507085371a6683e8aad32d5e9ead345606
|
4
|
+
data.tar.gz: 346d67c443b127c37da3d99c7e722e5be39e87f153fefa6257cca6fc2705df42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be8b57e6ab2141b5368b27a5adfb62755ff8fed7940ff6f6bbd34b500b34d34122933ecb0984b15048633bac5c3ca9b911b6dc972ec1bdba03a1531c5806bbc9
|
7
|
+
data.tar.gz: 0d122795334bb074b70417c270e2475379aed3794bed5aaec4a45b419636ff790e09ee346e497931586b94780ea58cb3952725f3fd02ad9378512837684edbfb
|
data/.rubocop.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.6.
|
1
|
+
ruby-2.6.6
|
data/.travis.yml
CHANGED
data/.watchr
CHANGED
@@ -16,35 +16,30 @@ end
|
|
16
16
|
|
17
17
|
def run_it(type, file)
|
18
18
|
case type
|
19
|
-
when 'test'; run %
|
20
|
-
# when '
|
21
|
-
# when 'spec'; run %Q{rspec -X #{file}}
|
19
|
+
when 'test'; run %(ruby -I test #{file})
|
20
|
+
# when 'spec'; run %(rspec -X #{file})
|
22
21
|
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
25
|
def run_all_tests
|
27
26
|
puts "\n#{HH} Running all tests #{HH}\n"
|
28
|
-
%w
|
27
|
+
%w[test spec].each { |dir| run "rake #{dir}" if File.exist?(dir) }
|
29
28
|
end
|
30
29
|
|
31
30
|
def run_matching_files(base)
|
32
31
|
base = base.split('_').first
|
33
|
-
%w
|
32
|
+
%w[test spec].each { |type|
|
34
33
|
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
|
35
34
|
run_it type, files.join(' ') unless files.empty?
|
36
35
|
}
|
37
36
|
end
|
38
37
|
|
39
|
-
%w
|
38
|
+
%w[test spec].each { |type|
|
40
39
|
watch("#{type}/#{type}_helper\.rb") { run_all_tests }
|
40
|
+
watch('lib/.*\.rb') { run_all_tests }
|
41
41
|
watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
|
42
42
|
}
|
43
|
-
%w{rb erb haml slim}.each { |type|
|
44
|
-
watch("app/.*/.*\.#{type}") { |m|
|
45
|
-
run_matching_files("#{m[0].split('/').at(2).split('.').first}")
|
46
|
-
}
|
47
|
-
}
|
48
43
|
|
49
44
|
# Ctrl-\ or ctrl-4
|
50
45
|
Signal.trap('QUIT') { run_all_tests }
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/formie.gemspec
CHANGED
@@ -23,13 +23,11 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
24
24
|
s.require_paths = ['lib']
|
25
25
|
|
26
|
-
s.add_development_dependency 'bundler'
|
27
|
-
s.add_development_dependency 'rake', '~>
|
26
|
+
s.add_development_dependency 'bundler', '~> 1'
|
27
|
+
s.add_development_dependency 'rake', '~> 13'
|
28
28
|
s.add_development_dependency 'appraisal', '~> 2'
|
29
29
|
s.add_development_dependency 'combustion', '~> 1.1'
|
30
30
|
|
31
|
-
s.add_development_dependency 'minitest'
|
32
|
-
s.add_development_dependency '
|
33
|
-
s.add_development_dependency 'sqlite3'
|
34
|
-
|
31
|
+
s.add_development_dependency 'minitest', '~> 5'
|
32
|
+
s.add_development_dependency 'sqlite3', '~> 1'
|
35
33
|
end
|
data/gemfiles/rails_5.2.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
data/lib/formie.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'formie/engine.rb'
|
2
4
|
|
3
5
|
module Formie
|
4
|
-
|
5
6
|
Rails6 = Rails.version.to_f >= 6.0
|
6
|
-
PATH
|
7
|
+
PATH = Rails6 ? 'app/views/formies' : 'app/formies'
|
7
8
|
|
8
9
|
def self.reload
|
9
10
|
if Rails6 && !File.directory?("#{Rails.root}/app/views/formies")
|
@@ -12,57 +13,56 @@ module Formie
|
|
12
13
|
|
13
14
|
now = Time.now
|
14
15
|
@last_update ||= Time.new(0)
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
load_formies(::ActionView::Helpers::FormBuilder, "#{PATH}/forms")
|
17
|
+
load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/application")
|
18
|
+
load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/templates")
|
18
19
|
@last_update = now
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.define_formie(where, name, path)
|
22
23
|
formiename = name
|
23
24
|
|
24
|
-
where.send(:define_method, formiename, lambda {|*args, &block|
|
25
|
-
#p "** called #{where} #{formiename}", args, block
|
25
|
+
where.send(:define_method, formiename, lambda { |*args, &block|
|
26
|
+
# p "** called #{where} #{formiename}", args, block
|
26
27
|
params = args.extract_options!
|
27
28
|
options = {}
|
28
|
-
|
29
|
-
options[:
|
29
|
+
if Rails6
|
30
|
+
options[:template] = path.sub("#{Rails.root}/app/views", '')
|
30
31
|
else
|
31
|
-
options[:
|
32
|
+
options[:file] = path
|
32
33
|
end
|
33
34
|
options[:locals] = {}
|
34
35
|
options[:locals].update params
|
35
|
-
options[:locals].update :
|
36
|
-
|
37
|
-
defined?(controller) == 'method'
|
38
|
-
|
39
|
-
|
36
|
+
options[:locals].update formiename: formiename,
|
37
|
+
block: block, form: self, args: args
|
38
|
+
if defined?(controller) == 'method'
|
39
|
+
controller.render_to_body(options)
|
40
|
+
else
|
41
|
+
@template.render(options)
|
42
|
+
end
|
40
43
|
})
|
41
|
-
#p "** defined #{where} #{formiename}"
|
44
|
+
# p "** defined #{where} #{formiename}"
|
42
45
|
end
|
43
46
|
|
44
|
-
|
45
|
-
private
|
46
47
|
def self.load_formies(where, dir)
|
47
|
-
|
48
|
+
# avoid Dir.chdir (not thread safe)
|
48
49
|
dir = File.join Rails.root, dir
|
49
|
-
return
|
50
|
+
return unless File.exist?(dir)
|
51
|
+
|
50
52
|
hsh = {}
|
51
|
-
Dir.glob(File.join(dir,'**','**')).sort.each { |path|
|
53
|
+
Dir.glob(File.join(dir, '**', '**')).sort.each { |path|
|
52
54
|
base = File.basename(path).split('.').first
|
53
|
-
hsh[base] = path
|
55
|
+
hsh[base] = path unless hsh[base]
|
54
56
|
}
|
55
57
|
hsh.each { |name, path|
|
56
|
-
next
|
58
|
+
next if File.new(path).mtime < @last_update
|
57
59
|
|
58
60
|
x = File.expand_path(File.dirname(path))
|
59
61
|
where.define_formie name, File.join(x, name)
|
60
62
|
}
|
61
63
|
end
|
62
|
-
|
63
64
|
end
|
64
65
|
|
65
|
-
|
66
66
|
module ActionView::Helpers::TextHelper
|
67
67
|
def self.define_formie(name, txt)
|
68
68
|
Formie.define_formie(self, name, txt)
|
data/lib/formie/engine.rb
CHANGED
data/lib/formie/version.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
# rubocop: disable all
|
2
|
+
|
1
3
|
module Formie
|
2
|
-
VERSION = '1.0.
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
4
|
+
VERSION = '1.0.2' # 2020-07-14
|
5
|
+
# VERSION = '1.0.1' # 2020-04-27
|
6
|
+
# VERSION = '1.0.0' # 2019-09-26
|
7
|
+
# VERSION = '0.9.16' # 2019-03-05
|
8
|
+
# VERSION = '0.9.15' # 2019-03-02
|
9
|
+
# VERSION = '0.9.14' # 2019-03-02
|
10
|
+
# VERSION = '0.9.13'
|
7
11
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_tree ../images
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
if ENV['COVERAGE']
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter '/test/'
|
5
|
+
end
|
6
|
+
end
|
5
7
|
|
6
8
|
require "combustion"
|
7
9
|
Combustion.path = "test/internal"
|
@@ -9,11 +11,5 @@ Combustion.initialize! :all
|
|
9
11
|
|
10
12
|
require 'rails/test_help'
|
11
13
|
require 'minitest/autorun'
|
14
|
+
require 'minitest/benchmark'
|
12
15
|
require 'capybara/rails'
|
13
|
-
|
14
|
-
#class ActiveSupport::TestCase
|
15
|
-
# # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
16
|
-
# fixtures :all
|
17
|
-
#
|
18
|
-
# # Add more helper methods to be used by all tests here...
|
19
|
-
#end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
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: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,44 +70,30 @@ dependencies:
|
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
73
|
+
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '5'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- - "
|
80
|
+
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '5'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: sqlite3
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
89
|
+
version: '1'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
96
|
+
version: '1'
|
111
97
|
description: |2
|
112
98
|
Formie implements low level template-based Rails helpers. It injects
|
113
99
|
the formies into the ActionView module. The form-bounded as well as
|
@@ -120,6 +106,7 @@ extensions: []
|
|
120
106
|
extra_rdoc_files: []
|
121
107
|
files:
|
122
108
|
- ".gitignore"
|
109
|
+
- ".rubocop.yml"
|
123
110
|
- ".ruby-gemset"
|
124
111
|
- ".ruby-version"
|
125
112
|
- ".travis.yml"
|
@@ -142,6 +129,7 @@ files:
|
|
142
129
|
- lib/formie/version.rb
|
143
130
|
- test/controllers/orders_test.rb
|
144
131
|
- test/integration/order_test.rb
|
132
|
+
- test/internal/app/assets/config/manifest.js
|
145
133
|
- test/internal/app/controllers/application_controller.rb
|
146
134
|
- test/internal/app/controllers/orders_controller.rb
|
147
135
|
- test/internal/app/formies/application/copyright.html.erb
|
@@ -189,13 +177,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
177
|
- !ruby/object:Gem::Version
|
190
178
|
version: '0'
|
191
179
|
requirements: []
|
192
|
-
rubygems_version: 3.0.
|
180
|
+
rubygems_version: 3.0.8
|
193
181
|
signing_key:
|
194
182
|
specification_version: 4
|
195
183
|
summary: Formie is like a Rails helper, but uses the notation of a partial.
|
196
184
|
test_files:
|
197
185
|
- test/controllers/orders_test.rb
|
198
186
|
- test/integration/order_test.rb
|
187
|
+
- test/internal/app/assets/config/manifest.js
|
199
188
|
- test/internal/app/controllers/application_controller.rb
|
200
189
|
- test/internal/app/controllers/orders_controller.rb
|
201
190
|
- test/internal/app/formies/application/copyright.html.erb
|