tilt-jadeite 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tilt-jadeite.rb +3 -9
- data/lib/tilt-jadeite/version.rb +1 -1
- data/spec/fixtures/approvals/sinatra_helper_handles_includes_from_a_jade_template_in_the_sinatra_route.approved.html +3 -0
- data/spec/fixtures/approvals/{sinatra_helper_it_handles_includes_of_other_jade_files.approved.html → sinatra_helper_handles_includes_of_other_jade_files.approved.html} +0 -0
- data/spec/fixtures/approvals/{sinatra_helper_it_renders_a_simple_jade_template_passing_a_couple_of_variables.approved.html → sinatra_helper_renders_a_simple_jade_template_passing_a_couple_of_variables.approved.html} +0 -0
- data/spec/fixtures/approvals/sinatra_helper_renders_a_string.approved.html +1 -0
- data/spec/sinatra_spec.rb +24 -2
- metadata +9 -5
data/lib/tilt-jadeite.rb
CHANGED
@@ -15,18 +15,12 @@ module Tilt
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def prepare
|
18
|
-
|
19
|
-
|
20
|
-
@precompiled = @environment.compile_file(@file)
|
21
|
-
end
|
18
|
+
env = ::Jadeite::Environment.new
|
19
|
+
@compiled = env.compile(data, :filename => eval_file)
|
22
20
|
end
|
23
21
|
|
24
22
|
def evaluate(scope, locals, &block)
|
25
|
-
|
26
|
-
@precompiled.render(locals.merge(scope.is_a?(Hash) ? scope : {}))
|
27
|
-
else
|
28
|
-
@environment.render(data.to_s, locals.merge(scope.is_a?(Hash) ? scope : {}))
|
29
|
-
end
|
23
|
+
@compiled.render(locals.merge(scope.is_a?(Hash) ? scope : {}))
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
data/lib/tilt-jadeite/version.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>this is soo freakin awesome</p>
|
data/spec/sinatra_spec.rb
CHANGED
@@ -10,6 +10,10 @@ class JadeApp < Sinatra::Base
|
|
10
10
|
|
11
11
|
helpers Sinatra::Jade
|
12
12
|
|
13
|
+
get "/string" do
|
14
|
+
jade 'p this is soo #{adjective.substring(0,5) + "in awesome"}', :locals => {:adjective => "freaky"}
|
15
|
+
end
|
16
|
+
|
13
17
|
get "/simple" do
|
14
18
|
jade :simple, :locals => { :pageTitle => "Jade", :youAreUsingJade => true }
|
15
19
|
end
|
@@ -18,6 +22,10 @@ class JadeApp < Sinatra::Base
|
|
18
22
|
jade :include
|
19
23
|
end
|
20
24
|
|
25
|
+
get "/include_from_route" do
|
26
|
+
jade "include fixtures/views/includes/head"
|
27
|
+
end
|
28
|
+
|
21
29
|
end
|
22
30
|
|
23
31
|
describe "Sinatra helper" do
|
@@ -27,18 +35,32 @@ describe "Sinatra helper" do
|
|
27
35
|
JadeApp
|
28
36
|
end
|
29
37
|
|
30
|
-
it "
|
38
|
+
it "renders a string" do
|
39
|
+
verify :format => :html do
|
40
|
+
get "/string"
|
41
|
+
last_response.body
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "renders a simple Jade template passing a couple of variables" do
|
31
46
|
verify :format => :html do
|
32
47
|
get "/simple"
|
33
48
|
last_response.body
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
37
|
-
it "
|
52
|
+
it "handles includes of other Jade files" do
|
38
53
|
verify :format => :html do
|
39
54
|
get "/include"
|
40
55
|
last_response.body
|
41
56
|
end
|
42
57
|
end
|
43
58
|
|
59
|
+
it "handles includes from a jade template in the Sinatra route" do
|
60
|
+
verify :format => :html do
|
61
|
+
get "/include_from_route"
|
62
|
+
last_response.body
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
44
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilt-jadeite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -125,8 +125,10 @@ files:
|
|
125
125
|
- lib/tilt-jadeite.rb
|
126
126
|
- lib/tilt-jadeite/sinatra.rb
|
127
127
|
- lib/tilt-jadeite/version.rb
|
128
|
-
- spec/fixtures/approvals/
|
129
|
-
- spec/fixtures/approvals/
|
128
|
+
- spec/fixtures/approvals/sinatra_helper_handles_includes_from_a_jade_template_in_the_sinatra_route.approved.html
|
129
|
+
- spec/fixtures/approvals/sinatra_helper_handles_includes_of_other_jade_files.approved.html
|
130
|
+
- spec/fixtures/approvals/sinatra_helper_renders_a_simple_jade_template_passing_a_couple_of_variables.approved.html
|
131
|
+
- spec/fixtures/approvals/sinatra_helper_renders_a_string.approved.html
|
130
132
|
- spec/fixtures/views/include.jade
|
131
133
|
- spec/fixtures/views/includes/foot.jade
|
132
134
|
- spec/fixtures/views/includes/head.jade
|
@@ -159,8 +161,10 @@ signing_key:
|
|
159
161
|
specification_version: 3
|
160
162
|
summary: Also adds Jade support to Sinatra
|
161
163
|
test_files:
|
162
|
-
- spec/fixtures/approvals/
|
163
|
-
- spec/fixtures/approvals/
|
164
|
+
- spec/fixtures/approvals/sinatra_helper_handles_includes_from_a_jade_template_in_the_sinatra_route.approved.html
|
165
|
+
- spec/fixtures/approvals/sinatra_helper_handles_includes_of_other_jade_files.approved.html
|
166
|
+
- spec/fixtures/approvals/sinatra_helper_renders_a_simple_jade_template_passing_a_couple_of_variables.approved.html
|
167
|
+
- spec/fixtures/approvals/sinatra_helper_renders_a_string.approved.html
|
164
168
|
- spec/fixtures/views/include.jade
|
165
169
|
- spec/fixtures/views/includes/foot.jade
|
166
170
|
- spec/fixtures/views/includes/head.jade
|