opal-erubi 1.0.0 → 2.0.1

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: 35e34135f5807bdf36e91274c136327fa1b07b8dc42fc0ccdc6c5e62699dca0a
4
- data.tar.gz: 1c2e6408c3e1e3325804be36bf34ee1dedbd390456492f7955765c461979590c
3
+ metadata.gz: 5cadf4867967a859635dc70b213f9d80cae3b32cb8b55e1bfe5c62bbd8105bcc
4
+ data.tar.gz: 459de9e8cc8c3fdbc9abb5a382f2d3aadc72379298e222f75d983d6e8fc57fe2
5
5
  SHA512:
6
- metadata.gz: 98cc6019078284497b51bcf856efe1bf579a90f8b72350f4abd96699f099ba317d8a1e0fd09e88ce951e19fc22c3390402c7efac8f5af4d4bc44ec3b82dabbaf
7
- data.tar.gz: dc4a8744f13a87b6f56f598144c4a880e1963521c87570fa9e0e230a5208860e4bc4319d2c28af765377dc868d888565f0457e05d9305d9eaa76d6aa9fd48afa
6
+ metadata.gz: dcd1991528f3cb4c0068cbf4610dc196d79b1ca412ed6295e72aaa3c9aa2d0621587f71881742cbbe761e10c57b576544a67e7ea838bdcba3dbc7f96f54cf762
7
+ data.tar.gz: 8293bb3f2ae2be604f61afbb34349a7437a32e39c084786387d0ff9bd52ec5cf1bff1c5637f56635df1bffb5a6c5f163f1b5012d572b342256dc489ffdf118f0
data/Gemfile CHANGED
@@ -16,3 +16,4 @@ end
16
16
 
17
17
  gem "erubi"
18
18
 
19
+ gem "pry"
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ require 'opal/rspec/rake_task'
7
7
  Opal::RSpec::RakeTask.new(:default) do |_, task|
8
8
  task.default_path = 'spec-opal'
9
9
  task.pattern = 'spec-opal/**/*_spec.{rb,opal}'
10
- end
10
+ end
@@ -7,6 +7,7 @@ module Opal
7
7
 
8
8
  def initialize(*args)
9
9
  super
10
+ @filename = ::Opal::Compiler.module_name(@filename)
10
11
  @source = prepare(@source, @filename)
11
12
  end
12
13
 
@@ -21,8 +22,4 @@ module Opal
21
22
  end
22
23
  end
23
24
  end
24
-
25
- # You could do this if you wanted to reclaim "erb" extension but I'm afraid
26
- # it may cause some problems. ERB is used for preprocessing (Opal) Ruby code.
27
- #Builder.processors.delete(BuilderProcessors::ERBProcessor)
28
25
  end
@@ -4,31 +4,15 @@ require 'opal-sprockets'
4
4
 
5
5
  module Opal
6
6
  module Erubi
7
- class Processor < ::Opal::Processor
8
- self.default_mime_type = 'application/javascript'
9
-
10
- def evaluate(context, locals, &block)
11
- @data = Opal::Erubi.compile_erubi @data, context.logical_path.gsub(/\Atemplates\//, '')
7
+ class Processor < Opal::Sprockets::Processor
8
+ def call
9
+ @data = Opal::Erubi.compile_erubi @data, context.logical_path.sub(/#{Opal::REGEXP_START}templates\//, '')
12
10
  super
13
11
  end
14
-
15
- def self.compiler_options
16
- # otherwise would check current class `attr_accessor`s
17
- ::Opal::Processor.compiler_options
18
- end
19
12
  end
20
13
  end
21
14
  end
22
15
 
23
- if Opal::Sprockets.respond_to? :register_mime_type # Sprockets 4.0 support
24
- Sprockets.register_mime_type 'application/html+erubi', extensions: ['.erubi']
25
- Sprockets.register_transformer 'application/html+erubi', 'application/javascript', Opal::Erubi::Processor
26
- Opal::Sprockets.register_mime_type 'application/html+erubi'
27
- else
28
- if Sprockets.respond_to? :register_transformer
29
- extra_args = [{mime_type: 'application/javascript', silence_deprecation: true}]
30
- else
31
- extra_args = []
32
- end
33
- Sprockets.register_engine '.erubi', Opal::Erubi::Processor, *extra_args
34
- end
16
+ Sprockets.register_mime_type 'application/html+erubi', extensions: ['.erubi']
17
+ Sprockets.register_transformer 'application/html+erubi', 'application/javascript', Opal::Erubi::Processor
18
+ Opal::Sprockets.register_mime_type 'application/html+erubi'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Erubi
3
- VERSION = '1.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
data/lib/opal/erubi.rb CHANGED
@@ -5,12 +5,12 @@ require 'opal/erubi/builder'
5
5
 
6
6
  #require 'opal/erubi/processor' <<< sprockets support, disabled by default
7
7
 
8
- Opal.append_path File.expand_path('../../../lib-opal', __FILE__).untaint
8
+ Opal.append_path File.expand_path('../../../lib-opal', __FILE__)
9
9
 
10
10
  module Opal
11
11
  module Erubi
12
12
  def self.compile_erubi(source, path)
13
- ::Erubi::Engine.new(source.to_s,
13
+ ::Erubi::Engine.new(source.to_s,
14
14
  bufval: "__buf",
15
15
  postamble: "_buf.join }",
16
16
  escape: true,
@@ -18,4 +18,4 @@ module Opal
18
18
  filename: path).src.dup
19
19
  end
20
20
  end
21
- end
21
+ end
data/opal-erubi.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ['lib']
18
18
 
19
19
  s.add_dependency 'opal', ['>= 0.11', '< 2']
20
+ s.add_dependency 'opal-sprockets', '>= 0.5.0'
20
21
  s.add_dependency 'erubi'
21
22
 
22
23
  s.add_development_dependency 'opal-rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-erubi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hmdne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: opal-sprockets
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 0.5.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.5.0
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: erubi
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +129,7 @@ homepage: https://github.com/hmdne/opal-erubi
115
129
  licenses:
116
130
  - MIT
117
131
  metadata: {}
118
- post_install_message:
132
+ post_install_message:
119
133
  rdoc_options: []
120
134
  require_paths:
121
135
  - lib
@@ -130,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  requirements: []
133
- rubygems_version: 3.1.2
134
- signing_key:
147
+ rubygems_version: 3.4.6
148
+ signing_key:
135
149
  specification_version: 4
136
150
  summary: Run Erubi templates client-side with Opal
137
151
  test_files: []