Skip to content

Instantly share code, notes, and snippets.

@pmeinhardt
Created January 15, 2013 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmeinhardt/4543330 to your computer and use it in GitHub Desktop.
Save pmeinhardt/4543330 to your computer and use it in GitHub Desktop.
ruby wrapper script for google closure compiler
#!/usr/bin/env ruby
begin
require 'closure-compiler'
rescue LoadError => e
puts e.message
puts "to fix: gem install 'closure-compiler'"
exit 1
end
if ARGV.count != 1
puts "usage: #{File.basename($0)} <path>"
exit 0
end
path = ARGV.first
unless File.exists?(path)
puts "file not found: #{path}"
exit 1
end
compiler = Closure::Compiler.new
puts compiler.compile(File.open(path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment