-
-
Save regularfry/6911623 to your computer and use it in GitHub Desktop.
Poor Man's Bundle Install
This file contains 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 | |
lockfile=ARGV.shift | |
sources=[] | |
gems=[] | |
File.foreach(lockfile) do |line| | |
case line | |
when /^ remote: (.*)$/ | |
sources << $1 | |
when /^ (\S+) \((.*)\)$/ | |
gems << [$1, $2] | |
end | |
end | |
IO.popen("parallel -j4", "w") do |io| | |
gems.each do |g,v| | |
io.puts "gem install '#{g}' --version='#{v}' " + | |
" --clear-sources " + | |
sources.map{|s| "--source='#{s}'"}.join(" ") + | |
" --ignore-dependencies " + | |
ARGV.join(" ") | |
end | |
io.close_write | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Want to install gems? Got a Gemfile.lock? Can't be having with that newfound "bundler" malarkey? Give
pmbi
a try! All* the powers ofbundle install
in 24 lines of ruby!* May not contain all the powers of
bundle install
. Not certified for use in humans. Avoid skin contact. Do not look into editor with remaining eye. Consult a medical professional if symptoms persist. Max height 8'2". Do not exceed rated wind loading. Load average may go down as well as up.