rbexy 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,12 +18,12 @@ module Rbexy
18
18
 
19
19
  cache.compute_if_absent(ActionView::TemplatePath.virtual(name, prefix, partial)) do
20
20
  find_templates(name, prefix, partial, details, locals)
21
- end
21
+ end.map { |t| t.bind_locals(locals) }
22
22
  end
23
23
  else
24
24
  # Rails 6 implements caching at the call-site (find_all)
25
25
  def _find_all(name, prefix, partial, details, key, locals)
26
- find_templates(name, prefix, partial, details, locals)
26
+ find_templates(name, prefix, partial, details, locals).map { |t| t.bind_locals(locals) }
27
27
  end
28
28
  end
29
29
 
@@ -50,14 +50,11 @@ module Rbexy
50
50
  Dir["#{templates_path}.*{#{extensions}}"].map do |template_path|
51
51
  source = File.binread(template_path)
52
52
  extension = File.extname(template_path)[1..-1]
53
- handler = ActionView::Template.handler_for_extension(extension)
54
53
 
55
- ActionView::Template.new(
56
- "#{source}#{component_class_cachebuster(component_name, extension)}",
57
- template_path,
58
- handler,
59
- format: extension.to_sym,
60
- locals: [],
54
+ build_template(
55
+ source: "#{source}#{component_class_cachebuster(component_name, extension)}",
56
+ template_path: template_path,
57
+ extension: extension.to_sym,
61
58
  virtual_path: virtual_path
62
59
  )
63
60
  end
@@ -68,17 +65,36 @@ module Rbexy
68
65
  return [] unless component_class && component_class.call_component?
69
66
 
70
67
  [
71
- ActionView::Template.new(
72
- cachebuster_digest_as_comment(component_class.component_file_location, :rbx),
73
- "#{templates_path}.rbexycall",
74
- ActionView::Template.handler_for_extension(:rbx),
75
- format: :rbx,
76
- locals: [],
68
+ build_template(
69
+ source: cachebuster_digest_as_comment(component_class.component_file_location, :rbx),
70
+ template_path: "#{templates_path}.rbexycall",
71
+ extension: :rbx,
77
72
  virtual_path: virtual_path
78
73
  )
79
74
  ]
80
75
  end
81
76
 
77
+ if ActionView.version >= Gem::Version.new("7.0.0")
78
+ def build_template(source:, template_path:, extension:, virtual_path:)
79
+ ActionView::UnboundTemplate.new(
80
+ source,
81
+ template_path,
82
+ details: ActionView::TemplateDetails.new(nil, extension, extension, nil),
83
+ virtual_path: virtual_path
84
+ )
85
+ end
86
+ else
87
+ def build_template(source:, template_path:, extension:, virtual_path:)
88
+ ActionView::UnboundTemplate.new(
89
+ source,
90
+ template_path,
91
+ ActionView::Template.handler_for_extension(extension),
92
+ format: extension.to_sym,
93
+ virtual_path: virtual_path
94
+ )
95
+ end
96
+ end
97
+
82
98
  def component_class_cachebuster(component_name, template_format)
83
99
  component_class = find_component_class(component_name)
84
100
  return unless component_class
data/lib/rbexy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rbexy
2
- VERSION = "2.0.0.rc2"
2
+ VERSION = "2.0.0.rc3"
3
3
  end
data/rbexy.gemspec CHANGED
@@ -25,15 +25,15 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_dependency "activesupport", ">= 6", "< 7.1"
29
- spec.add_dependency "actionview", ">= 6", "< 7.1"
28
+ spec.add_dependency "activesupport", ">= 6", "< 7.2"
29
+ spec.add_dependency "actionview", ">= 6", "< 7.2"
30
30
 
31
31
  spec.add_development_dependency "appraisal", "~> 2.2"
32
- spec.add_development_dependency "rails", ">= 6", "< 7.1"
32
+ spec.add_development_dependency "rails", ">= 6", "< 7.2"
33
33
  spec.add_development_dependency "sprockets-rails", ">= 2", "< 4"
34
- spec.add_development_dependency "rspec", "~> 3.9"
34
+ spec.add_development_dependency "rspec", "~> 3.12"
35
35
  spec.add_development_dependency "guard-rspec", "~> 4.7", ">= 4.7.3"
36
- spec.add_development_dependency "rspec-rails", "~> 4.0", ">= 4.0.1"
36
+ spec.add_development_dependency "rspec-rails", "~> 6.0", ">= 6.0.3"
37
37
  spec.add_development_dependency "rspec-html-matchers", "~> 0.9.3"
38
38
  spec.add_development_dependency "rake"
39
39
  spec.add_development_dependency "pry-byebug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbexy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Giancola
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '6'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '6'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionview
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '6'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7.1'
42
+ version: '7.2'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '6'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7.1'
52
+ version: '7.2'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: appraisal
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,7 @@ dependencies:
73
73
  version: '6'
74
74
  - - "<"
75
75
  - !ruby/object:Gem::Version
76
- version: '7.1'
76
+ version: '7.2'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,7 +83,7 @@ dependencies:
83
83
  version: '6'
84
84
  - - "<"
85
85
  - !ruby/object:Gem::Version
86
- version: '7.1'
86
+ version: '7.2'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: sprockets-rails
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -110,14 +110,14 @@ dependencies:
110
110
  requirements:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: '3.9'
113
+ version: '3.12'
114
114
  type: :development
115
115
  prerelease: false
116
116
  version_requirements: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: '3.9'
120
+ version: '3.12'
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: guard-rspec
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -144,20 +144,20 @@ dependencies:
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
- version: '4.0'
147
+ version: '6.0'
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: 4.0.1
150
+ version: 6.0.3
151
151
  type: :development
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
- version: '4.0'
157
+ version: '6.0'
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: 4.0.1
160
+ version: 6.0.3
161
161
  - !ruby/object:Gem::Dependency
162
162
  name: rspec-html-matchers
163
163
  requirement: !ruby/object:Gem::Requirement
@@ -271,6 +271,8 @@ files:
271
271
  - gemfiles/rails_6_1.gemfile.lock
272
272
  - gemfiles/rails_7_0.gemfile
273
273
  - gemfiles/rails_7_0.gemfile.lock
274
+ - gemfiles/rails_7_1.gemfile
275
+ - gemfiles/rails_7_1.gemfile.lock
274
276
  - gemfiles/rails_master.gemfile
275
277
  - gemfiles/rails_master.gemfile.lock
276
278
  - lib/rbexy.rb