Created
January 20, 2012 22:58
-
-
Save DAddYE/1650084 to your computer and use it in GitHub Desktop.
Fix malformed ruby gemspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Usage: curl -sL https://raw.github.com/gist/1650084/invalid.rb | ruby | |
# | |
require 'open3' | |
stdin, stdout, stderr = Open3.popen3('gem check') | |
invalid = stderr.read | |
errors = invalid.scan(/\[(.+)\]:/).flatten | |
abort 'No errors in your gems specs' if errors.empty? | |
errors.each do |spec| | |
cmd = "gem install %s" % File.basename(spec, '.gemspec').gsub(/-[0-9\.]+[a-z]?$/) { |m| " -v #{m.sub(/^-/,'')}" } | |
puts cmd | |
system "#{cmd} 2> /dev/null" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment