dusty_rails_renderer 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dusty_rails_renderer/version.rb +1 -1
- data/lib/dusty_rails_renderer.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5e52b87519c6a042b560e7dd0fb68d7b9f2a34b
|
4
|
+
data.tar.gz: fd730bd2f33c1dcc598824aeafbcc01fd0a473b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b147a2101e86b9e2f34e159196dfb7619205db337289b049fcea4f7334a096eae23aae5d2ff3d015d554306a76e2db0d689d0248109555007294dd58b1443412
|
7
|
+
data.tar.gz: 8d562cd2e90ccd8c122ef51760445db462cdd8e82eac83a26440b0995d7189175944e54b6c8fdf63bcd1a71fc8a500838e44e2318f81859f02ed665902796cd0
|
data/lib/dusty_rails_renderer.rb
CHANGED
@@ -41,11 +41,23 @@ module DustyRailsRenderer
|
|
41
41
|
command = "dustc --name=#{template_name} #{file_url}"
|
42
42
|
template = Open3.capture3("bash","-l","-c",command)
|
43
43
|
escaped_template = escape_javascript(template[0])
|
44
|
+
|
45
|
+
if self.configuration.logging
|
46
|
+
puts "template name = #{template_name}"
|
47
|
+
puts "compiled template = #{escaped_template}"
|
48
|
+
end
|
49
|
+
|
44
50
|
@context.eval("dust.loadSource(\"#{escaped_template}\")")
|
45
51
|
@precompiled_templates[template_name] = template[0]
|
46
52
|
else
|
47
53
|
contents = File.read(file_url).gsub("\n","").gsub("\"","'").gsub("\t","")
|
48
54
|
template = @context.eval("(function() {var template = dust.compile(\"#{contents}\",'#{template_name}'); dust.loadSource(template); return template; })()")
|
55
|
+
|
56
|
+
if self.configuration.logging
|
57
|
+
puts "template name = #{template_name}"
|
58
|
+
puts "compiled template = #{escaped_template}"
|
59
|
+
end
|
60
|
+
|
49
61
|
@precompiled_templates[template_name] = template
|
50
62
|
end
|
51
63
|
end
|
@@ -66,6 +78,7 @@ module DustyRailsRenderer
|
|
66
78
|
attr_accessor :production
|
67
79
|
attr_accessor :dust_template_base_path
|
68
80
|
attr_accessor :node_dust_compiler
|
81
|
+
attr_accessor :logging
|
69
82
|
|
70
83
|
def initialize
|
71
84
|
@dust_config_path = "config/dust_initializer.yml"
|
@@ -73,6 +86,7 @@ module DustyRailsRenderer
|
|
73
86
|
@dust_template_base_path = "app/assets/javascripts/dust/"
|
74
87
|
@production = false
|
75
88
|
@node_dust_compiler = false
|
89
|
+
@logging = true
|
76
90
|
end
|
77
91
|
end
|
78
92
|
|