summaryrefslogtreecommitdiff
path: root/lib/bundler/inline.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-01 11:47:23 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-01 11:47:23 -0800
commit9e76b9b401b0d9e18777e2196966ef856866f7cf (patch)
tree2c3d354fe69512325708e9a05c0fcfdb51f3516d /lib/bundler/inline.rb
parent9fd53751e9f22f803d76ec1066a239c89ba0bd77 (diff)
downloadbundler-9e76b9b401b0d9e18777e2196966ef856866f7cf.tar.gz
Fixes per code review
- validate the options in the options hash - move the default ui option into options processing - preserve the users options hash
Diffstat (limited to 'lib/bundler/inline.rb')
-rw-r--r--lib/bundler/inline.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index b9b2d1705b..7d21684b83 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -28,9 +28,12 @@
# puts Pod::VERSION # => "0.34.4"
#
def gemfile(install = false, options = {}, &gemfile)
- ui = options[:ui]
-
require "bundler"
+
+ opts = options.dup
+ ui = opts.delete(:ui) { Bundler::UI::Shell.new }
+ raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
+
old_root = Bundler.method(:root)
def Bundler.root
Bundler::SharedHelpers.pwd.expand_path
@@ -45,7 +48,7 @@ def gemfile(install = false, options = {}, &gemfile)
definition.validate_ruby!
if install
- Bundler.ui = ui || Bundler::UI::Shell.new
+ Bundler.ui = ui
Bundler::Installer.install(Bundler.root, definition, :system => true)
Bundler::Installer.post_install_messages.each do |name, message|
Bundler.ui.info "Post-install message from #{name}:\n#{message}"