Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bogdanRada/e3787ccd82d1e9089cb3d1de49789758 to your computer and use it in GitHub Desktop.
Save bogdanRada/e3787ccd82d1e9089cb3d1de49789758 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
# Take a copy of the arguments as rubygems or bundler modifies them
args = ARGV.dup
begin
gem "bundler"
rescue Gem::LoadError
require "rubygems/dependency_installer"
installer = Gem::DependencyInstaller.new :document => []
installer.install "bundler"
end
require "bundler"
require "bundler/cli"
Bundler::CLI.new.invoke :install, [], :path => "managed_libs", :quiet => true
require "bundler/setup"
require "bozo"
# Assign the command line arguments back so Bozo can inspect them
ARGV.clear.push *args
Bozo.hello
@bogdanRada
Copy link
Author

This is exactly what i needed. I was searching for a way to invoke the install method on Bundler::CLI for days...and this saved my day :) Thank you very much.

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