Skip to content

Instantly share code, notes, and snippets.

@pochi
Created April 19, 2012 02:17
Show Gist options
  • Save pochi/2417918 to your computer and use it in GitHub Desktop.
Save pochi/2417918 to your computer and use it in GitHub Desktop.
Fetch gem file from Gemfile.lock for can not connect gem server.
# coding: utf-8
# ex) ruby gem_fetcher.rb #{TARGET_Gemfile.lock}
INSTALL_REGEXP = /^ ([a-zA-Z].+) ¥((.+)¥)$/
open(ARGV[0]).each_line do |line|
if match_data = INSTALL_REGEXP.match(line).to_a and !match_data.empty?
gem_file_name = match_data[1]
gem_versin = match_data.last
system "gem fetch #{gem_file_name} -v #{gem_version}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment