opal-haml 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 305b113a6fa5548f1271669bd052274214b8f7f9
4
- data.tar.gz: 6cc024e7ba8431aefb07c7c9626f83602e2cd951
3
+ metadata.gz: e33b7eaf522a6cecf841934bcef00144f3cd5594
4
+ data.tar.gz: acc6c1d3be312df2dd0224685ac09d9084762017
5
5
  SHA512:
6
- metadata.gz: bd48d21852e5aacb70297f5377e6703fdd1df259b6f94b4e8d14a092e854ab9d43aa35a15689bc51ea96f024eef9d37fc575664215c5a621e94b4ede7dadafb7
7
- data.tar.gz: 186b45f6dff3b65a3bbfdf83375d56497b195a868314ece2b6de7a125f099ce2262fd22651f2b4052f7a9e4ed03cff2a8a5c7713f53e76070c00bdd9d4657165
6
+ metadata.gz: de66f0e58bdddfadc3423c8259abc289a08630e8084a5af14c27d38e27a9b7b9060e34fe15888e52bc03ab2b9a10545eb996c3394fd72f083866a411906ae941
7
+ data.tar.gz: 91d0745a2c2202cc4b113bf9059fc70bdf355b551463b272fb5efe0ef5d13b6e98ebef205f04b02e7a1c83c1828f8bd4476a2392c467ba9c74a37368fe652aaf
data/CHANGELOG.md CHANGED
@@ -1,10 +1,18 @@
1
+ ## 0.3.0 2015-08-07
2
+
3
+ * Add support for Opal 0.8.
4
+
5
+ * Update the processor to reuse the good stuff from the Opal::Processor.
6
+
7
+ * Now each compiled template automatically requires `opal-haml` with the new module system.
8
+
1
9
  ## 0.3.0 2015-02-03
2
10
 
3
11
  * Add support for new opal Builder processors.
4
12
 
5
13
  * Implicitly require `opal-haml` when any haml template is required
6
14
 
7
- * Cleanup generated code to be use Opal ERB runtime directly
15
+ * Cleanup generated code to be use Opal ERB runtime directly.
8
16
 
9
17
  ## 0.2.0 2013-12-17
10
18
 
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler'
2
2
  Bundler.require
3
+ Bundler::GemHelper.install_tasks
3
4
 
4
5
  require 'opal/rspec/rake_task'
5
6
  Opal::RSpec::RakeTask.new(:default)
@@ -3,23 +3,17 @@ require 'sprockets'
3
3
 
4
4
  module Opal
5
5
  module Haml
6
- class Processor < Tilt::Template
6
+ class Processor < ::Opal::Processor
7
7
  self.default_mime_type = 'application/javascript'
8
8
 
9
- def self.engine_initialized?
10
- true
11
- end
12
-
13
- def initialize_engine
14
- require_template_library 'opal'
15
- end
16
-
17
- def prepare
9
+ def evaluate(context, locals, &block)
10
+ @data = Opal::Haml.compile_haml @data, context.logical_path.sub(/^templates\//, '')
11
+ super
18
12
  end
19
13
 
20
- def evaluate(context, locals, &block)
21
- context.require_asset 'opal-haml'
22
- Opal::Haml.compile data, context.logical_path.sub(/^templates\//, '')
14
+ def self.compiler_options
15
+ # otherwise would check current class `attr_accessor`s
16
+ ::Opal::Processor.compiler_options
23
17
  end
24
18
  end
25
19
  end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Haml
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
data/lib/opal/haml.rb CHANGED
@@ -6,13 +6,18 @@ require 'opal/haml/version'
6
6
  module Opal
7
7
  module Haml
8
8
  def self.compile(source, file = '(haml)')
9
+ Opal.compile(compile_haml(source, file))
10
+ end
11
+
12
+ def self.compile_haml(source, file)
9
13
  haml = ::Haml::Engine.new(source, :ugly => true).precompiled
10
14
  haml = haml.gsub('_hamlout.buffer', '_hamlout')
11
- Opal.compile(wrap(haml, file))
15
+ wrap(haml, file)
12
16
  end
13
17
 
14
18
  def self.wrap(haml, file)
15
19
  <<-EOS
20
+ require 'opal-haml'
16
21
  Template.new('#{file}') do |_hamlout|
17
22
  #{haml}
18
23
  _hamlout.join
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.4.5
121
+ rubygems_version: 2.4.6
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Run Haml templates client-side with Opal
@@ -129,4 +129,3 @@ test_files:
129
129
  - spec/output_buffer_spec.rb
130
130
  - spec/simple.haml
131
131
  - spec/spec_helper.rb
132
- has_rdoc: