Skip to content

Instantly share code, notes, and snippets.

@webmat
Created October 10, 2008 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save webmat/16042 to your computer and use it in GitHub Desktop.
Save webmat/16042 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# An improved GitHub gemspec checker.
# GitHub accepts YAML dumps for the gemspecs, which helps keep your gem generation tasks DRY
if ARGV.size < 1
puts "Usage: github-test.rb my-project.gemspec"
exit
end
require 'rubygems/specification'
data = File.read(ARGV[0])
spec = nil
begin
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
rescue SyntaxError
#Output in YAML format, then?
require 'yaml'
spec = YAML.load(data)
end
puts spec
puts "OK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment