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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f549e073b8de681eddff1ad40c41872f63ed92f69ee365a8425a64438837ed7b
4
- data.tar.gz: 89061cdce94b4f76ff3c10c2a814a6a7f66e4d2ee88c53364d1f7999c1c54eaf
3
+ metadata.gz: 11eb2cab3c397141a12277050a9c6e507085371a6683e8aad32d5e9ead345606
4
+ data.tar.gz: 346d67c443b127c37da3d99c7e722e5be39e87f153fefa6257cca6fc2705df42
5
5
  SHA512:
6
- metadata.gz: 458c621e7acb2413926cc3070a77edf58d0d96e418e800553ab9f1d5215a7bf89b3af28e0d1ade853ad400945986d64902f403828bcbb0a3dda410b7b5d05846
7
- data.tar.gz: 02f57fe42549d4e63359b17e2f519d299fd94e0f5216fc30f88101540057fdf4fa2b2315d8062b98c7fc98a6024fad900745fb0643137b29904116e9d8263923
6
+ metadata.gz: be8b57e6ab2141b5368b27a5adfb62755ff8fed7940ff6f6bbd34b500b34d34122933ecb0984b15048633bac5c3ca9b911b6dc972ec1bdba03a1531c5806bbc9
7
+ data.tar.gz: 0d122795334bb074b70417c270e2475379aed3794bed5aaec4a45b419636ff790e09ee346e497931586b94780ea58cb3952725f3fd02ad9378512837684edbfb
@@ -0,0 +1,14 @@
1
+ inherit_from:
2
+ - ~/configs/.rubocop.yml
3
+
4
+ AllCops:
5
+ Include:
6
+ - 'lib/**/*.rb'
7
+ Exclude:
8
+ - 'test/**/*'
9
+
10
+ Metrics/AbcSize:
11
+ Enabled: false
12
+
13
+ Style/ClassAndModuleChildren:
14
+ Enabled: false
@@ -1 +1 @@
1
- ruby-2.6.4
1
+ ruby-2.6.6
@@ -6,7 +6,9 @@ bundler_args: --without production
6
6
  script: 'bundle exec rake test'
7
7
 
8
8
  rvm:
9
- - 2.6.4
9
+ - 2.6.6
10
+ # - 2.6.5
11
+ # - 2.6.4
10
12
  # - 2.6.3
11
13
  # - 2.6.1
12
14
  # - 2.5.1
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 %Q{ruby -I"lib:test" -r rubygems #{file}}
20
- # when 'test'; run %Q{rails test #{file}}
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{test spec}.each { |dir| run "rake #{dir} RAILS_ENV=test" if File.exists?(dir) }
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{test spec}.each { |type|
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{test spec}.each { |type|
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
@@ -5,6 +5,8 @@ gem 'rails'
5
5
 
6
6
  group :test do
7
7
  gem 'observr'
8
+ gem 'rubocop', require: false
9
+ gem 'simplecov', require: false
8
10
  gem 'capybara'
9
11
  gem 'slim'
10
12
  end
@@ -1,4 +1,4 @@
1
- Copyright 2012-2019 Dittmar Krall - http://matique.de
1
+ Copyright 2011-2020 Dittmar Krall - www.matique.com
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -98,7 +98,8 @@ In directory :
98
98
  </p>
99
99
 
100
100
  # templates/hello.slim
101
+ / a comment
102
+
101
103
  span Hello Slim
102
- # a comment
103
104
 
104
105
  Copyright (c) 2009-2019 Dittmar Krall, released under the MIT license.
data/Rakefile CHANGED
@@ -1,9 +1,7 @@
1
- require 'bundler/setup'
2
- Bundler::GemHelper.install_tasks
3
-
4
1
  require 'rake/testtask'
5
2
 
6
- Rake::TestTask.new(:test) do |t|
3
+ desc 'Run the tests.'
4
+ Rake::TestTask.new do |t|
7
5
  t.libs << 'lib'
8
6
  t.libs << 'test'
9
7
  t.pattern = 'test/**/*_test.rb'
@@ -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', '~> 12'
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 'simplecov'
33
- s.add_development_dependency 'sqlite3'
34
-
31
+ s.add_development_dependency 'minitest', '~> 5'
32
+ s.add_development_dependency 'sqlite3', '~> 1'
35
33
  end
@@ -7,7 +7,6 @@ gem "rails", "~> 5.2.0"
7
7
  group :test do
8
8
  gem "observr"
9
9
  gem "capybara"
10
- gem "sqlite3", "!= 1.4.0"
11
10
  gem "slim"
12
11
  end
13
12
 
@@ -7,7 +7,6 @@ gem "rails", "~> 6.0.0"
7
7
  group :test do
8
8
  gem "observr"
9
9
  gem "capybara"
10
- gem "sqlite3", "!= 1.4.0"
11
10
  gem "slim"
12
11
  end
13
12
 
@@ -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 = Rails6 ? 'app/views/formies' : 'app/formies'
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
- self.load_formies(::ActionView::Helpers::FormBuilder, "#{PATH}/forms")
16
- self.load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/application")
17
- self.load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/templates")
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
- unless Rails6
29
- options[:file] = path
29
+ if Rails6
30
+ options[:template] = path.sub("#{Rails.root}/app/views", '')
30
31
  else
31
- options[:template] = path.sub("#{Rails.root}/app/views", "")
32
+ options[:file] = path
32
33
  end
33
34
  options[:locals] = {}
34
35
  options[:locals].update params
35
- options[:locals].update :formiename => formiename,
36
- :block => block, :form => self, :args => args
37
- defined?(controller) == 'method' ?
38
- controller.render_to_body(options) :
39
- @template.render(options)
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
- # avoid Dir.chdir (not thread safe)
48
+ # avoid Dir.chdir (not thread safe)
48
49
  dir = File.join Rails.root, dir
49
- return unless File.exist?(dir)
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 unless hsh[base]
55
+ hsh[base] = path unless hsh[base]
54
56
  }
55
57
  hsh.each { |name, path|
56
- next if File.new(path).mtime < @last_update
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)
@@ -1,3 +1,5 @@
1
+ # rubocop: disable all
2
+
1
3
  module Formie
2
4
  class Engine < Rails::Engine
3
5
  end
@@ -1,7 +1,11 @@
1
+ # rubocop: disable all
2
+
1
3
  module Formie
2
- VERSION = '1.0.0' # 2019-09-26
3
- # VERSION = '0.9.16' # 2019-03-05
4
- # VERSION = '0.9.15' # 2019-03-02
5
- # VERSION = '0.9.14' # 2019-03-02
6
- # VERSION = '0.9.13'
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
@@ -1,7 +1,9 @@
1
- #require 'simplecov'
2
- #SimpleCov.start do
3
- # add_filter '/test/'
4
- #end
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.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: 2019-09-26 00:00:00.000000000 Z
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: '0'
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: '0'
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: '12'
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: '12'
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: '0'
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: '0'
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: '0'
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: '0'
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.6
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