rbexy 2.0.0.beta7 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,252 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails.git
3
+ revision: 54c73577690e1ec81a79472ba98e28bb3e18703f
4
+ branch: main
5
+ specs:
6
+ actioncable (7.1.0.alpha)
7
+ actionpack (= 7.1.0.alpha)
8
+ activesupport (= 7.1.0.alpha)
9
+ nio4r (~> 2.0)
10
+ websocket-driver (>= 0.6.1)
11
+ actionmailbox (7.1.0.alpha)
12
+ actionpack (= 7.1.0.alpha)
13
+ activejob (= 7.1.0.alpha)
14
+ activerecord (= 7.1.0.alpha)
15
+ activestorage (= 7.1.0.alpha)
16
+ activesupport (= 7.1.0.alpha)
17
+ mail (>= 2.7.1)
18
+ net-imap
19
+ net-pop
20
+ net-smtp
21
+ actionmailer (7.1.0.alpha)
22
+ actionpack (= 7.1.0.alpha)
23
+ actionview (= 7.1.0.alpha)
24
+ activejob (= 7.1.0.alpha)
25
+ activesupport (= 7.1.0.alpha)
26
+ mail (~> 2.5, >= 2.5.4)
27
+ net-imap
28
+ net-pop
29
+ net-smtp
30
+ rails-dom-testing (~> 2.0)
31
+ actionpack (7.1.0.alpha)
32
+ actionview (= 7.1.0.alpha)
33
+ activesupport (= 7.1.0.alpha)
34
+ rack (~> 2.0, >= 2.2.0)
35
+ rack-test (>= 0.6.3)
36
+ rails-dom-testing (~> 2.0)
37
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
+ actiontext (7.1.0.alpha)
39
+ actionpack (= 7.1.0.alpha)
40
+ activerecord (= 7.1.0.alpha)
41
+ activestorage (= 7.1.0.alpha)
42
+ activesupport (= 7.1.0.alpha)
43
+ globalid (>= 0.6.0)
44
+ nokogiri (>= 1.8.5)
45
+ actionview (7.1.0.alpha)
46
+ activesupport (= 7.1.0.alpha)
47
+ builder (~> 3.1)
48
+ erubi (~> 1.4)
49
+ rails-dom-testing (~> 2.0)
50
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
+ activejob (7.1.0.alpha)
52
+ activesupport (= 7.1.0.alpha)
53
+ globalid (>= 0.3.6)
54
+ activemodel (7.1.0.alpha)
55
+ activesupport (= 7.1.0.alpha)
56
+ activerecord (7.1.0.alpha)
57
+ activemodel (= 7.1.0.alpha)
58
+ activesupport (= 7.1.0.alpha)
59
+ activestorage (7.1.0.alpha)
60
+ actionpack (= 7.1.0.alpha)
61
+ activejob (= 7.1.0.alpha)
62
+ activerecord (= 7.1.0.alpha)
63
+ activesupport (= 7.1.0.alpha)
64
+ marcel (~> 1.0)
65
+ mini_mime (>= 1.1.0)
66
+ activesupport (7.1.0.alpha)
67
+ concurrent-ruby (~> 1.0, >= 1.0.2)
68
+ i18n (>= 1.6, < 2)
69
+ minitest (>= 5.1)
70
+ tzinfo (~> 2.0)
71
+ rails (7.1.0.alpha)
72
+ actioncable (= 7.1.0.alpha)
73
+ actionmailbox (= 7.1.0.alpha)
74
+ actionmailer (= 7.1.0.alpha)
75
+ actionpack (= 7.1.0.alpha)
76
+ actiontext (= 7.1.0.alpha)
77
+ actionview (= 7.1.0.alpha)
78
+ activejob (= 7.1.0.alpha)
79
+ activemodel (= 7.1.0.alpha)
80
+ activerecord (= 7.1.0.alpha)
81
+ activestorage (= 7.1.0.alpha)
82
+ activesupport (= 7.1.0.alpha)
83
+ bundler (>= 1.15.0)
84
+ railties (= 7.1.0.alpha)
85
+ railties (7.1.0.alpha)
86
+ actionpack (= 7.1.0.alpha)
87
+ activesupport (= 7.1.0.alpha)
88
+ method_source
89
+ rake (>= 12.2)
90
+ thor (~> 1.0)
91
+ zeitwerk (~> 2.5)
92
+
93
+ PATH
94
+ remote: ..
95
+ specs:
96
+ rbexy (2.0.0.beta9)
97
+ actionview (>= 6, < 7.1)
98
+ activesupport (>= 6, < 7.1)
99
+
100
+ GEM
101
+ remote: https://rubygems.org/
102
+ specs:
103
+ appraisal (2.4.1)
104
+ bundler
105
+ rake
106
+ thor (>= 0.14.0)
107
+ builder (3.2.4)
108
+ byebug (11.1.3)
109
+ coderay (1.1.3)
110
+ concurrent-ruby (1.1.9)
111
+ crass (1.0.6)
112
+ diff-lcs (1.5.0)
113
+ digest (3.1.0)
114
+ erubi (1.10.0)
115
+ ffi (1.15.5)
116
+ formatador (1.1.0)
117
+ globalid (1.0.0)
118
+ activesupport (>= 5.0)
119
+ guard (2.18.0)
120
+ formatador (>= 0.2.4)
121
+ listen (>= 2.7, < 4.0)
122
+ lumberjack (>= 1.0.12, < 2.0)
123
+ nenv (~> 0.1)
124
+ notiffany (~> 0.0)
125
+ pry (>= 0.13.0)
126
+ shellany (~> 0.0)
127
+ thor (>= 0.18.1)
128
+ guard-compat (1.2.1)
129
+ guard-rspec (4.7.3)
130
+ guard (~> 2.1)
131
+ guard-compat (~> 1.1)
132
+ rspec (>= 2.99.0, < 4.0)
133
+ i18n (1.10.0)
134
+ concurrent-ruby (~> 1.0)
135
+ io-wait (0.2.1)
136
+ listen (3.7.1)
137
+ rb-fsevent (~> 0.10, >= 0.10.3)
138
+ rb-inotify (~> 0.9, >= 0.9.10)
139
+ loofah (2.14.0)
140
+ crass (~> 1.0.2)
141
+ nokogiri (>= 1.5.9)
142
+ lumberjack (1.2.8)
143
+ mail (2.7.1)
144
+ mini_mime (>= 0.1.1)
145
+ marcel (1.0.2)
146
+ memory_profiler (0.9.14)
147
+ method_source (1.0.0)
148
+ mini_mime (1.1.2)
149
+ minitest (5.15.0)
150
+ nenv (0.3.0)
151
+ net-imap (0.2.3)
152
+ digest
153
+ net-protocol
154
+ strscan
155
+ net-pop (0.1.1)
156
+ digest
157
+ net-protocol
158
+ timeout
159
+ net-protocol (0.1.2)
160
+ io-wait
161
+ timeout
162
+ net-smtp (0.3.1)
163
+ digest
164
+ net-protocol
165
+ timeout
166
+ nio4r (2.5.8)
167
+ nokogiri (1.13.3-x86_64-linux)
168
+ racc (~> 1.4)
169
+ notiffany (0.1.3)
170
+ nenv (~> 0.1)
171
+ shellany (~> 0.0)
172
+ pry (0.13.1)
173
+ coderay (~> 1.1)
174
+ method_source (~> 1.0)
175
+ pry-byebug (3.9.0)
176
+ byebug (~> 11.0)
177
+ pry (~> 0.13.0)
178
+ racc (1.6.0)
179
+ rack (2.2.3)
180
+ rack-test (1.1.0)
181
+ rack (>= 1.0, < 3)
182
+ rails-dom-testing (2.0.3)
183
+ activesupport (>= 4.2.0)
184
+ nokogiri (>= 1.6)
185
+ rails-html-sanitizer (1.4.2)
186
+ loofah (~> 2.3)
187
+ rake (13.0.6)
188
+ rb-fsevent (0.11.1)
189
+ rb-inotify (0.10.1)
190
+ ffi (~> 1.0)
191
+ rspec (3.11.0)
192
+ rspec-core (~> 3.11.0)
193
+ rspec-expectations (~> 3.11.0)
194
+ rspec-mocks (~> 3.11.0)
195
+ rspec-core (3.11.0)
196
+ rspec-support (~> 3.11.0)
197
+ rspec-expectations (3.11.0)
198
+ diff-lcs (>= 1.2.0, < 2.0)
199
+ rspec-support (~> 3.11.0)
200
+ rspec-html-matchers (0.9.4)
201
+ nokogiri (~> 1)
202
+ rspec (>= 3.0.0.a, < 4)
203
+ rspec-mocks (3.11.0)
204
+ diff-lcs (>= 1.2.0, < 2.0)
205
+ rspec-support (~> 3.11.0)
206
+ rspec-rails (4.1.2)
207
+ actionpack (>= 4.2)
208
+ activesupport (>= 4.2)
209
+ railties (>= 4.2)
210
+ rspec-core (~> 3.10)
211
+ rspec-expectations (~> 3.10)
212
+ rspec-mocks (~> 3.10)
213
+ rspec-support (~> 3.10)
214
+ rspec-support (3.11.0)
215
+ shellany (0.0.1)
216
+ sprockets (4.0.3)
217
+ concurrent-ruby (~> 1.0)
218
+ rack (> 1, < 3)
219
+ sprockets-rails (3.4.2)
220
+ actionpack (>= 5.2)
221
+ activesupport (>= 5.2)
222
+ sprockets (>= 3.0.0)
223
+ sqlite3 (1.4.2)
224
+ strscan (3.0.1)
225
+ thor (1.2.1)
226
+ timeout (0.2.0)
227
+ tzinfo (2.0.4)
228
+ concurrent-ruby (~> 1.0)
229
+ websocket-driver (0.7.5)
230
+ websocket-extensions (>= 0.1.0)
231
+ websocket-extensions (0.1.5)
232
+ zeitwerk (2.5.4)
233
+
234
+ PLATFORMS
235
+ x86_64-linux
236
+
237
+ DEPENDENCIES
238
+ appraisal (~> 2.2)
239
+ guard-rspec (~> 4.7, >= 4.7.3)
240
+ memory_profiler (~> 0.9.14)
241
+ pry-byebug
242
+ rails!
243
+ rake
244
+ rbexy!
245
+ rspec (~> 3.9)
246
+ rspec-html-matchers (~> 0.9.3)
247
+ rspec-rails (~> 4.0, >= 4.0.1)
248
+ sprockets-rails (>= 2, < 4)
249
+ sqlite3
250
+
251
+ BUNDLED WITH
252
+ 2.2.3
@@ -9,6 +9,18 @@ module Rbexy
9
9
  def to_s
10
10
  self
11
11
  end
12
+
13
+ def split(*args)
14
+ super.map { |s| TemplatePath.new(s) }
15
+ end
16
+
17
+ def gsub(*args)
18
+ super.tap { |s| break TemplatePath.new(s) }
19
+ end
20
+
21
+ def from(*args)
22
+ super.tap { |s| break TemplatePath.new(s) }
23
+ end
12
24
  end
13
25
 
14
26
  class_attribute :component_file_location
@@ -78,8 +90,8 @@ module Rbexy
78
90
  raise error
79
91
  end
80
92
 
81
- def method_missing(meth, *args, &block)
82
- view_context.send(meth, *args, &block)
93
+ def method_missing(meth, *args, **kwargs, &block)
94
+ view_context.send(meth, *args, **kwargs, &block)
83
95
  end
84
96
 
85
97
  def respond_to_missing?(method_name, include_all)
@@ -17,6 +17,7 @@ module Rbexy
17
17
  @compile_context = context
18
18
  children.each { |c| c.inject_compile_context(context) } if respond_to?(:children)
19
19
  members.each { |c| c.inject_compile_context(context) } if respond_to?(:members)
20
+ value.inject_compile_context(context) if respond_to?(:value)
20
21
  end
21
22
 
22
23
  def transform!
@@ -24,6 +25,7 @@ module Rbexy
24
25
  ast_transformer.transform(self, compile_context)
25
26
  children.each(&:transform!) if respond_to?(:children)
26
27
  members.each(&:transform!) if respond_to?(:members)
28
+ value.transform! if respond_to?(:value)
27
29
  end
28
30
 
29
31
  private
@@ -7,19 +7,27 @@ module Rbexy
7
7
  attr_accessor :members
8
8
  attr_reader :outer_template, :inner_template
9
9
 
10
+ DEBUGGERS = %w[debugger binding.pry]
11
+
10
12
  OUTPUT_UNSAFE = "@output_buffer.concat(Rbexy::Runtime.expr_out(%s));"
11
13
  OUTPUT_SAFE = "@output_buffer.safe_concat(Rbexy::Runtime.expr_out(%s));"
12
- SUB_EXPR = "%s"
14
+ RAW = "%s"
15
+ DEBUGGER = "#{RAW}\n"
16
+ SUB_EXPR = RAW
13
17
  SUB_EXPR_OUT = "Rbexy::Runtime.expr_out(%s)"
14
18
 
15
- def initialize(members, outer_template: OUTPUT_UNSAFE, inner_template: "%s")
19
+ def initialize(members, outer_template: OUTPUT_UNSAFE, inner_template: RAW)
16
20
  @members = members
17
21
  @outer_template = outer_template
18
22
  @inner_template = inner_template
19
23
  end
20
24
 
21
25
  def precompile
22
- [ExpressionGroup.new(precompile_members, outer_template: outer_template, inner_template: inner_template)]
26
+ [if debugger?
27
+ ExpressionGroup.new(precompile_members, outer_template: DEBUGGER, inner_template: RAW)
28
+ else
29
+ ExpressionGroup.new(precompile_members, outer_template: outer_template, inner_template: inner_template)
30
+ end]
23
31
  end
24
32
 
25
33
  def compile
@@ -50,6 +58,12 @@ module Rbexy
50
58
  Expression.new("+")
51
59
  end
52
60
  end
61
+
62
+ def debugger?
63
+ members.length == 1 &&
64
+ members.first.is_a?(Expression) &&
65
+ DEBUGGERS.include?(members.first.content.strip)
66
+ end
53
67
  end
54
68
  end
55
69
  end
@@ -1,7 +1,11 @@
1
1
  module Rbexy
2
2
  module Nodes
3
3
  class HTMLElement < AbstractElement
4
- KNOWN_VOID_ELEMENTS = ActionView::Helpers::TagHelper::TagBuilder::VOID_ELEMENTS.map(&:to_s).to_set
4
+ if ActionView.version >= Gem::Version.new("7.0.0")
5
+ KNOWN_VOID_ELEMENTS = ActionView::Helpers::TagHelper::TagBuilder::HTML_VOID_ELEMENTS.map(&:to_s).to_set
6
+ else
7
+ KNOWN_VOID_ELEMENTS = ActionView::Helpers::TagHelper::TagBuilder::VOID_ELEMENTS.map(&:to_s).to_set
8
+ end
5
9
 
6
10
  def precompile
7
11
  nodes = []
@@ -2,7 +2,7 @@ module Rbexy
2
2
  module Nodes
3
3
  module Util
4
4
  def self.escape_string(str)
5
- str.gsub('"', '\\"').gsub("'", "\\'")
5
+ str.gsub('"', '\\"').gsub("'", "\\\\'")
6
6
  end
7
7
  end
8
8
  end
data/lib/rbexy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rbexy
2
- VERSION = "2.0.0.beta7"
2
+ VERSION = "2.0.0.rc1"
3
3
  end
data/lib/rbexy.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rbexy/version"
2
2
  require "active_support/inflector"
3
3
  require "active_support/concern"
4
+ require "active_support/core_ext/enumerable"
4
5
  require "action_view/helpers/output_safety_helper"
5
6
  require "action_view/helpers/capture_helper"
6
7
  require "action_view/helpers/tag_helper"
data/rbexy.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = "A Ruby template language inspired by JSX"
10
10
  spec.homepage = "https://github.com/patbenatar/rbexy"
11
11
  spec.license = "MIT"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
13
13
 
14
14
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
15
15
 
@@ -25,10 +25,12 @@ 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.0", "< 7.0"
29
- spec.add_dependency "actionview", ">= 6.0", "< 7.0"
28
+ spec.add_dependency "activesupport", ">= 6", "< 7.1"
29
+ spec.add_dependency "actionview", ">= 6", "< 7.1"
30
30
 
31
- spec.add_development_dependency "rails", ">= 6.0", "< 7.0"
31
+ spec.add_development_dependency "appraisal", "~> 2.2"
32
+ spec.add_development_dependency "rails", ">= 6", "< 7.1"
33
+ spec.add_development_dependency "sprockets-rails", ">= 2", "< 4"
32
34
  spec.add_development_dependency "rspec", "~> 3.9"
33
35
  spec.add_development_dependency "guard-rspec", "~> 4.7", ">= 4.7.3"
34
36
  spec.add_development_dependency "rspec-rails", "~> 4.0", ">= 4.0.1"
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.beta7
4
+ version: 2.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Giancola
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,60 +16,94 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '6'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.0'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '6.0'
29
+ version: '6'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.0'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionview
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '6.0'
39
+ version: '6'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7.0'
42
+ version: '7.1'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '6.0'
49
+ version: '6'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7.0'
52
+ version: '7.1'
53
+ - !ruby/object:Gem::Dependency
54
+ name: appraisal
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '2.2'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.2'
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: rails
55
69
  requirement: !ruby/object:Gem::Requirement
56
70
  requirements:
57
71
  - - ">="
58
72
  - !ruby/object:Gem::Version
59
- version: '6.0'
73
+ version: '6'
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: '7.1'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '6'
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '7.1'
87
+ - !ruby/object:Gem::Dependency
88
+ name: sprockets-rails
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '2'
60
94
  - - "<"
61
95
  - !ruby/object:Gem::Version
62
- version: '7.0'
96
+ version: '4'
63
97
  type: :development
64
98
  prerelease: false
65
99
  version_requirements: !ruby/object:Gem::Requirement
66
100
  requirements:
67
101
  - - ">="
68
102
  - !ruby/object:Gem::Version
69
- version: '6.0'
103
+ version: '2'
70
104
  - - "<"
71
105
  - !ruby/object:Gem::Version
72
- version: '7.0'
106
+ version: '4'
73
107
  - !ruby/object:Gem::Dependency
74
108
  name: rspec
75
109
  requirement: !ruby/object:Gem::Requirement
@@ -201,9 +235,11 @@ executables: []
201
235
  extensions: []
202
236
  extra_rdoc_files: []
203
237
  files:
238
+ - ".github/workflows/main.yml"
204
239
  - ".gitignore"
205
240
  - ".rspec"
206
241
  - ".travis.yml"
242
+ - Appraisals
207
243
  - CODE_OF_CONDUCT.md
208
244
  - Dockerfile
209
245
  - Gemfile
@@ -214,7 +250,15 @@ files:
214
250
  - Rakefile
215
251
  - bin/console
216
252
  - bin/setup
253
+ - bin/test
217
254
  - docker-compose.yml
255
+ - gemfiles/.bundle/config
256
+ - gemfiles/rails_6_1.gemfile
257
+ - gemfiles/rails_6_1.gemfile.lock
258
+ - gemfiles/rails_7_0.gemfile
259
+ - gemfiles/rails_7_0.gemfile.lock
260
+ - gemfiles/rails_master.gemfile
261
+ - gemfiles/rails_master.gemfile.lock
218
262
  - lib/rbexy.rb
219
263
  - lib/rbexy/ast_transformer.rb
220
264
  - lib/rbexy/cache_component.rb
@@ -270,14 +314,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
314
  requirements:
271
315
  - - ">="
272
316
  - !ruby/object:Gem::Version
273
- version: 2.3.0
317
+ version: 2.7.0
274
318
  required_rubygems_version: !ruby/object:Gem::Requirement
275
319
  requirements:
276
320
  - - ">"
277
321
  - !ruby/object:Gem::Version
278
322
  version: 1.3.1
279
323
  requirements: []
280
- rubygems_version: 3.1.2
324
+ rubygems_version: 3.3.7
281
325
  signing_key:
282
326
  specification_version: 4
283
327
  summary: A Ruby template language inspired by JSX