Skip to content

Instantly share code, notes, and snippets.

@regularfry
Created October 10, 2013 01:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save regularfry/6911623 to your computer and use it in GitHub Desktop.
Save regularfry/6911623 to your computer and use it in GitHub Desktop.
Poor Man's Bundle Install
#!/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
@regularfry
Copy link
Author

Want to install gems? Got a Gemfile.lock? Can't be having with that newfound "bundler" malarkey? Give pmbi a try! All* the powers of bundle 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment