rbexy 2.0.0.rc1 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,9 +10,21 @@ module Rbexy
10
10
  slim: "/ %s"
11
11
  }
12
12
 
13
- # Rails 6 requires us to override `_find_all` in order to hook
14
- def _find_all(name, prefix, partial, details, key, locals)
15
- find_templates(name, prefix, partial, details, locals)
13
+ # Rails 6 and 7 require us to override `_find_all` in order to hook
14
+ if ActionView.version >= Gem::Version.new("7.0.0")
15
+ # Rails 7 implements caching internally to _find_all
16
+ def _find_all(name, prefix, partial, details, key, locals)
17
+ cache = key ? @unbound_templates : Concurrent::Map.new
18
+
19
+ cache.compute_if_absent(ActionView::TemplatePath.virtual(name, prefix, partial)) do
20
+ find_templates(name, prefix, partial, details, locals)
21
+ end.map { |t| t.bind_locals(locals) }
22
+ end
23
+ else
24
+ # Rails 6 implements caching at the call-site (find_all)
25
+ def _find_all(name, prefix, partial, details, key, locals)
26
+ find_templates(name, prefix, partial, details, locals).map { |t| t.bind_locals(locals) }
27
+ end
16
28
  end
17
29
 
18
30
  # Rails 5 only requires `find_templates` (which tbh is the proper way
@@ -38,14 +50,11 @@ module Rbexy
38
50
  Dir["#{templates_path}.*{#{extensions}}"].map do |template_path|
39
51
  source = File.binread(template_path)
40
52
  extension = File.extname(template_path)[1..-1]
41
- handler = ActionView::Template.handler_for_extension(extension)
42
53
 
43
- ActionView::Template.new(
44
- "#{source}#{component_class_cachebuster(component_name, extension)}",
45
- template_path,
46
- handler,
47
- format: extension.to_sym,
48
- locals: [],
54
+ build_template(
55
+ source: "#{source}#{component_class_cachebuster(component_name, extension)}",
56
+ template_path: template_path,
57
+ extension: extension.to_sym,
49
58
  virtual_path: virtual_path
50
59
  )
51
60
  end
@@ -56,17 +65,36 @@ module Rbexy
56
65
  return [] unless component_class && component_class.call_component?
57
66
 
58
67
  [
59
- ActionView::Template.new(
60
- cachebuster_digest_as_comment(component_class.component_file_location, :rbx),
61
- "#{templates_path}.rbexycall",
62
- ActionView::Template.handler_for_extension(:rbx),
63
- format: :rbx,
64
- 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,
65
72
  virtual_path: virtual_path
66
73
  )
67
74
  ]
68
75
  end
69
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
+
70
98
  def component_class_cachebuster(component_name, template_format)
71
99
  component_class = find_component_class(component_name)
72
100
  return unless component_class
data/lib/rbexy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rbexy
2
- VERSION = "2.0.0.rc1"
2
+ VERSION = "2.0.0.rc3"
3
3
  end
data/rbexy.gemspec CHANGED
@@ -25,18 +25,19 @@ 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"
40
40
  spec.add_development_dependency "sqlite3"
41
+ spec.add_development_dependency "puma"
41
42
  spec.add_development_dependency "memory_profiler", "~> 0.9.14"
42
43
  end
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.rc1
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-11 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
@@ -214,6 +214,20 @@ dependencies:
214
214
  - - ">="
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
+ - !ruby/object:Gem::Dependency
218
+ name: puma
219
+ requirement: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ version: '0'
224
+ type: :development
225
+ prerelease: false
226
+ version_requirements: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
217
231
  - !ruby/object:Gem::Dependency
218
232
  name: memory_profiler
219
233
  requirement: !ruby/object:Gem::Requirement
@@ -257,6 +271,8 @@ files:
257
271
  - gemfiles/rails_6_1.gemfile.lock
258
272
  - gemfiles/rails_7_0.gemfile
259
273
  - gemfiles/rails_7_0.gemfile.lock
274
+ - gemfiles/rails_7_1.gemfile
275
+ - gemfiles/rails_7_1.gemfile.lock
260
276
  - gemfiles/rails_master.gemfile
261
277
  - gemfiles/rails_master.gemfile.lock
262
278
  - lib/rbexy.rb