diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..a160faf --- /dev/null +++ b/.hgignore @@ -0,0 +1,3 @@ +syntax: glob + +lib/*.min.js diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..29853fd --- /dev/null +++ b/Rakefile @@ -0,0 +1,24 @@ +require "net/http" +require "uri" + +version = File.read("VERSION").strip + +file "lib/runtime-#{version}.min.js" => "lib/runtime.js" do |t| + response = Net::HTTP.post_form( + URI.parse("http://closure-compiler.appspot.com/compile"), + { + "js_code" => File.read(t.prerequisites.first), + "compilation_level" => "SIMPLE_OPTIMIZATIONS", + "output_format" => "text", + "output_info" => "compiled_code" + } + ) + + if response.code != "200" + abort "Error calling Google Closure Compiler API: #{response.message}" + end + + File.open(t.name, "w") { |f| f.write(response.body) } +end + +task :default => "lib/runtime-#{version}.min.js"