liquidscript 0.6.4 → 0.6.5

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: 0f8c6c51fffb0d24bf827a356b8cf8c46e2bed25
4
- data.tar.gz: e67a07ac9bbf1d249dde0b499d334b1084d6fd15
3
+ metadata.gz: 51ca166ca554e616ff1286df7160d3562d17bec9
4
+ data.tar.gz: 014dddad0abfc08a64e106287e9c22913baa407c
5
5
  SHA512:
6
- metadata.gz: 629068c68ffea87eaa555918f770424272be615355651c0e19c81113f6416136d288a99f6ef2c24fb6485e75821a613913437d6c0997f0477787794cb63e2535
7
- data.tar.gz: dba22b9effe63127631a2687961bdb8d4c8b46051430e152bd680eabe573d2c131a4f44bd78a41258a503abcab3445877948e519ea4ada251909f0098e3b6a4a
6
+ metadata.gz: 62a05f026218fb4b63e17bb462da4a52b03a51404daac97aeb3a717995d57c030c819ba77d9af731d58cd4067f32d82ece97cccefc489a4ea321686e5e4ba59e
7
+ data.tar.gz: dbc2e0f247123670a9472e0e507e6c3ea15f42b33f41678423ccdf138806c6793dd64d0617550bc8d1890996d248133fef51787a8e196fb3ea0a574a0c39742d
data/bin/lscript CHANGED
@@ -13,7 +13,7 @@ outfile = ARGV.shift || infile.gsub(/\.liq\Z/, ".js")
13
13
  File.open(infile, "r") do |f|
14
14
 
15
15
  begin
16
- out = Liquidscript::Template.new(f.read).render
16
+ out = Liquidscript.compile(f.read)
17
17
  File.open(outfile, "w") { |o| o.write out }
18
18
  rescue StandardError => e
19
19
  $stderr.puts "ERROR: #{e.class}: #{e.message}"
data/lib/liquidscript.rb CHANGED
@@ -5,7 +5,10 @@ require "liquidscript/version"
5
5
  require "liquidscript/scanner"
6
6
  require "liquidscript/compiler"
7
7
  require "liquidscript/generator"
8
- require "liquidscript/template"
8
+
9
+ if defined? ::Sprockets
10
+ require "liquidscript/template"
11
+ end
9
12
 
10
13
  module Liquidscript
11
14
  def self.compile(data)
@@ -1,18 +1,25 @@
1
- require 'liquidscript/icr/sexp'
1
+ require "liquidscript"
2
+ require "sprockets"
3
+ require "tilt"
2
4
 
3
5
  module Liquidscript
4
- class Template
6
+ class Template < ::Tilt::Template
7
+ self.default_mime_type = 'application/javascript'
5
8
 
6
- def initialize(data)
7
- @data = data
9
+ def self.engine_initialized?
10
+ defined? ::Liquidscript
8
11
  end
9
12
 
10
- def render
11
- @_render ||= begin
12
- compiler = Compiler::ICR.new(Scanner::Liquidscript.new(@data))
13
- compiler.compile
14
- Generator::Javascript.new(compiler.top).generate
15
- end
13
+ def initialize_engine
14
+ require_template_library "liquidscript"
15
+ end
16
+
17
+ def prepare; end
18
+
19
+ def evaluate(scope, locals, &block)
20
+ @output ||= Liquidscript.compile(data)
16
21
  end
17
22
  end
23
+
24
+ Sprockets.register_engine '.liq', Liquidscript::Template
18
25
  end
@@ -1,5 +1,5 @@
1
1
  module Liquidscript
2
2
 
3
3
  # The current version of liquidscript.
4
- VERSION = "0.6.4".freeze
4
+ VERSION = "0.6.5".freeze
5
5
  end
@@ -1,7 +1,7 @@
1
1
  RSpec::Matchers.define :run do
2
2
  command = Command::Runner.new("node", "")
3
3
  match do |data|
4
- @output = Liquidscript::Template.new(data).render
4
+ @output = Liquidscript.compile(data)
5
5
  @message = command.run({}, :input => @output)
6
6
  @message.successful?
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquidscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,7 +155,6 @@ files:
155
155
  - lib/liquidscript/scanner/token.rb
156
156
  - lib/liquidscript/template.rb
157
157
  - lib/liquidscript/version.rb
158
- - lib/sprockets/liquidscript_template.rb
159
158
  - liquidscript.gemspec
160
159
  - spec/fixtures/class.compile.yml
161
160
  - spec/fixtures/class.generate.yml
@@ -1,16 +0,0 @@
1
- require "liquidscript"
2
- require "sprockets"
3
-
4
- module Sprockets
5
- class LiquidscriptTemplate < Template
6
- def self.default_mime_type
7
- 'application/javascript'
8
- end
9
-
10
- def render(context)
11
- @output ||= Liquidscript.compile(data)
12
- end
13
- end
14
-
15
- register_engine '.liq', LiquidscriptTemplate
16
- end