X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=lib%2Fredact%2Fapp.rb;h=7c5f39ee69334d8c2533712c142c95e7e32f1353;hb=2b2cd361e8f12e21896cd041f9159743d3c27110;hp=de666280863078905bb9af53c69b31c1b9d34338;hpb=2c25c90e2aaf57a7508a7988f58b2784d5071a7e;p=redact.git diff --git a/lib/redact/app.rb b/lib/redact/app.rb index de66628..7c5f39e 100644 --- a/lib/redact/app.rb +++ b/lib/redact/app.rb @@ -1,5 +1,5 @@ #-- -# $Id: app.rb 1 2005-03-26 01:32:38Z tilman $ +# $Id: app.rb 3 2005-03-26 19:21:15Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -25,6 +25,7 @@ require "redact/redact.rb" require "redact/source.rb" require "ftools" +require "tempfile" require "pathname" require "ostruct" require "optparse" @@ -127,23 +128,23 @@ EOT EDJE.collections.each_value do |col| next unless col.has_embryo? - File.open("/tmp/redact.sma", "w") do |tf| - tf.puts "#include " - dump_sma(tf, col) - tf.flush + Tempfile.open("redact_col#{col.id}.sma") do |tf_in| + tf_in.puts "#include " + dump_sma(tf_in, col) + tf_in.flush - out = "/tmp/redact.amx" - File.rm_f(out) + Tempfile.open("redact_col#{col.id}.amx") do |tf_out| + incl = `edje-config --datadir`.strip - incl = `edje-config --datadir`.strip - c = "embryo_cc " + - "-i #{incl}/include " + - "-o #{out} #{tf.path}" - system(c) + c = "embryo_cc " + + "-i #{incl}/include " + + "-o #{tf_out.path} #{tf_in.path}" + unless system(c) + fail("Cannot compile Embryo code") + end - ret[col.id] = IO.read(out) - File.rm_f(out) - File.unlink(tf.path) + ret[col.id] = tf_out.read + end end end