barista 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/barista.gemspec +1 -1
- data/lib/barista.rb +10 -2
- data/lib/barista/compiler.rb +5 -3
- data/lib/barista/version.rb +1 -1
- metadata +2 -2
data/barista.gemspec
CHANGED
data/lib/barista.rb
CHANGED
@@ -28,7 +28,7 @@ module Barista
|
|
28
28
|
full_path = root.join("#{path.gsub(/(\A\/|\/\Z)/, '')}.coffee")
|
29
29
|
return unless full_path.exist? && full_path.readable?
|
30
30
|
Compiler.compile(full_path.read)
|
31
|
-
rescue
|
31
|
+
rescue SystemCallError
|
32
32
|
nil
|
33
33
|
end
|
34
34
|
|
@@ -42,7 +42,7 @@ module Barista
|
|
42
42
|
f.write Compiler.compile(File.read(file))
|
43
43
|
end
|
44
44
|
true
|
45
|
-
rescue
|
45
|
+
rescue SystemCallError
|
46
46
|
false
|
47
47
|
end
|
48
48
|
|
@@ -60,6 +60,14 @@ module Barista
|
|
60
60
|
Rails.env.test? || Rails.env.development?
|
61
61
|
end
|
62
62
|
|
63
|
+
def no_wrap?
|
64
|
+
defined?(@no_wrap) && @no_wrap
|
65
|
+
end
|
66
|
+
|
67
|
+
def no_wrap=(value)
|
68
|
+
@no_wrap = !!value
|
69
|
+
end
|
70
|
+
|
63
71
|
end
|
64
72
|
|
65
73
|
if defined?(Rails::Engine)
|
data/lib/barista/compiler.rb
CHANGED
@@ -32,12 +32,14 @@ module Barista
|
|
32
32
|
protected
|
33
33
|
|
34
34
|
def coffee_options
|
35
|
-
"-p"
|
35
|
+
["-p"].tap do |options|
|
36
|
+
options << "--no-wrap" if Barista.no_wrap?
|
37
|
+
end.join(" ")
|
36
38
|
end
|
37
39
|
|
38
|
-
def temp_file_for_content
|
40
|
+
def temp_file_for_content(content = @content)
|
39
41
|
tf = Tempfile.new("barista-#{content_hash}.coffee")
|
40
|
-
tf.write
|
42
|
+
tf.write content
|
41
43
|
tf.close
|
42
44
|
tf
|
43
45
|
end
|
data/lib/barista/version.rb
CHANGED