#--
-# $Id: app.rb 3 2005-03-26 19:21:15Z tilman $
+# $Id: app.rb 40 2005-05-25 20:19:45Z tilman $
#
# Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
#
amx = compile_embryo
- Eet::File.open(@options.output, "w") do |ef|
- dump_amx(amx, ef)
-
- dump_header(ef)
- dump_collections(ef)
- dump_fonts(ef)
- dump_images(ef)
- dump_source(ef)
- dump_fontmap(ef)
+ begin
+ Eet::File.open(@options.output, "w") do |ef|
+ dump_amx(amx, ef)
+
+ dump_header(ef)
+ dump_collections(ef)
+ dump_fonts(ef)
+ dump_images(ef)
+ dump_source(ef)
+ dump_fontmap(ef)
+ end
+ rescue Exception
+ File.rm_f(@options.output)
+ raise
end
end
end
o.on_tail("--version", "Show version") do
- puts <<EOT
-redact #{Redact::VERSION}
-
-Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
-EOT
+ puts "Redact #{Redact::VERSION}"
exit
end
c = "embryo_cc " +
"-i #{incl}/include " +
"-o #{tf_out.path} #{tf_in.path}"
- unless system(c)
- fail("Cannot compile Embryo code")
+ system(c)
+ unless (0..1).include?($?.exitstatus)
+ raise("Cannot compile Embryo code")
end
ret[col.id] = tf_out.read
method = (sane == @filename) ? :unshift : :push
s.send(method, SourceFile.new(sane, value.join))
- # include files that are with File.read, too
+ # include files that are read with File.read, too
value.join.grep(/File\.read\(\"(.+)\"\)/) do
sane = Pathname.new($1).cleanpath.to_s
s << SourceFile.new(sane, File.read(sane))