Permalink
Browse files

user tempfile for temporary soy compilation.

  • Loading branch information...
1 parent 8fc1c5b commit 35b476536b31b528c990c1a3b730765194300068 alitn committed Jan 22, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/yellow-brick-road/soy_processor.rb
@@ -1,4 +1,5 @@
require 'tilt'
+require 'tempfile'
module YellowBrickRoad
class SoyProcessor < Tilt::Template
@@ -36,13 +37,14 @@ def evaluate scope, locals, &block
# Since SoyToJsSrcCompiler does not provide a stdout access to
# the output, the output is written to a tempfile.
- tempoutput = Rails.root.join 'tmp', "soy-#{Time.now.to_i.to_s}.js"
- compiler_options= @compiler_options.merge outputPathFormat: tempoutput
+ # tempoutput = Rails.root.join 'tmp', "soy-#{Time.now.to_i.to_s}.js"
+ tempfile = Tempfile.new 'soy'
+ compiler_options = @compiler_options.merge outputPathFormat: tempfile.path
compile compiler_options
- @output = IO.read tempoutput
- File.delete tempoutput
+ @output = IO.read tempfile.path
+ tempfile.unlink
@output
end

0 comments on commit 35b4765

Please sign in to comment.