def install(path = nil)
opts = options.dup
opts[:without] ||= []
opts[:without].map! { |g| g.to_sym }
ENV['BUNDLE_GEMFILE'] = opts[:gemfile] if opts[:gemfile]
Bundler.settings[:path] = path if path
Bundler.settings[:disable_shared_gems] = '1' if options["disable-shared-gems"]
Bundler.settings.without = opts[:without]
remove_lockfiles if options[:relock]
begin
Installer.install(Bundler.root, Bundler.definition, opts)
rescue GemfileChanged
raise GemfileChanged, "You changed your Gemfile after locking. " +
"Please run `bundle install --relock`."
end
lock if options[:relock]
cache if Bundler.root.join("vendor/cache").exist? && !options[:no_cache]
Bundler.ui.confirm "Your bundle is complete! " +
"Use `bundle show [gemname]` to see where a bundled gem is installed."
rescue GemNotFound => e
if Bundler.definition.sources.empty?
Bundler.ui.warn "Your Gemfile doesn't have any sources. You can add one with a line like 'source :gemcutter'"
end
raise e
end