diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-06-10 11:21:03 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-06-10 11:21:03 +0530 |
commit | b126b40bbddf8af631b949ffdc7e20ab64f75c6a (patch) | |
tree | 28240c50db01b2667547aa95bd93ac1fa9bfe257 | |
parent | 8b749ee85b04307135d368f05275d50e6cbf76a0 (diff) | |
download | bundler-b126b40bbddf8af631b949ffdc7e20ab64f75c6a.tar.gz |
Using Bundler.settings to enable plugin cli
-rw-r--r-- | lib/bundler.rb | 5 | ||||
-rw-r--r-- | lib/bundler/cli.rb | 3 | ||||
-rw-r--r-- | lib/bundler/cli/plugin.rb | 4 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 45d735da..9cfc7157 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -196,8 +196,7 @@ module Bundler end def settings - return @settings if defined?(@settings) - @settings = Settings.new(app_config_path) + @settings ||= Settings.new(app_config_path) rescue GemfileNotFound @settings = Settings.new(Pathname.new(".bundle").expand_path) end @@ -380,6 +379,8 @@ module Bundler end def reset! + @root = nil + @settings = nil @definition = nil end diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index d8bc93bb..df6c7128 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -16,6 +16,7 @@ module Bundler def initialize(*args) super + Bundler.reset! custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty? @@ -441,7 +442,7 @@ module Bundler Env.new.write($stdout) end - if ENV["BUNDLE_PLUGIN"] + if Bundler.settings[:plugin] require "bundler/cli/plugin" desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins" subcommand "plugin", Plugin diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb index 87a37d98..277822da 100644 --- a/lib/bundler/cli/plugin.rb +++ b/lib/bundler/cli/plugin.rb @@ -4,8 +4,8 @@ module Bundler class CLI::Plugin < Thor desc "install PLUGINS", "Install the plugin from the source" long_desc <<-D - Install plugins either from the rubygems source provided (with --source option) or from a git source provided with (--git option). - D + Install plugins either from the rubygems source provided (with --source option) or from a git source provided with (--git option). If no sources are provided, it uses Gem.sources + D method_option "source", :type => :string, :default => nil, :banner => "URL of the RubyGems source to fetch the plugin from" method_option "version", :type => :string, :default => nil, :banner => diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 01910ce6..5916485a 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -41,7 +41,7 @@ def gemfile(install = false, options = {}, &gemfile) end ENV["BUNDLE_GEMFILE"] ||= "Gemfile" - Bundler::Plugin.gemfile_install(&gemfile) + Bundler::Plugin.gemfile_install(&gemfile) if Bundler.settings[:plugin] builder = Bundler::Dsl.new builder.instance_eval(&gemfile) |