diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-06-07 17:36:07 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-06-07 18:58:56 +0530 |
commit | 4a1baea541298628d47b04520f23f9b3c6af0265 (patch) | |
tree | d21d7e9ca15dccdd05d5adb5036066766f670d40 | |
parent | cc6b93bdb8ce39d27b380e527ec6b9ba5007e9cb (diff) | |
download | bundler-4a1baea541298628d47b04520f23f9b3c6af0265.tar.gz |
Minor corrections
-rw-r--r-- | lib/bundler/cli.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 2 | ||||
-rw-r--r-- | lib/bundler/plugin.rb | 2 | ||||
-rw-r--r-- | lib/bundler/plugin/index.rb | 2 | ||||
-rw-r--r-- | spec/bundler/plugin/index_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/plugin_spec.rb | 4 |
6 files changed, 13 insertions, 7 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index aff55737ae..3e5b7e0009 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -82,7 +82,7 @@ module Bundler end def self.handle_no_command_error(command, has_namespace = $thor_runner) - if ENV["BUNDLE_PLUGIN"] && Bundler::Plugin.command?(command) + if Bundler.settings[:plugin] && Bundler::Plugin.command?(command) return Bundler::Plugin.exec_command(command, ARGV[1..-1]) end @@ -437,7 +437,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/install.rb b/lib/bundler/cli/install.rb index 810eb9234c..5db9463cbe 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -56,7 +56,7 @@ module Bundler # rubygems plugins sometimes hook into the gem install process Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) - Plugin.eval_gemfile(Bundler.default_gemfile) if ENV["BUNDLE_PLUGIN"] + Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugin] definition = Bundler.definition definition.validate_ruby! diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 4ff5cb86aa..f7816eab3c 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -40,7 +40,7 @@ module Bundler # specified by plugin method # # @param [Pathname] gemfile path - def eval_gemfile(gemfile) + def gemfile_install(gemfile) definition = DSL.evaluate(gemfile, nil, {}) return unless definition.dependencies.any? diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index 19874a8f74..f06284725d 100644 --- a/lib/bundler/plugin/index.rb +++ b/lib/bundler/plugin/index.rb @@ -30,7 +30,7 @@ module Bundler @plugin_paths[name] = path common = commands & @commands.keys - raise CommandConflict.new(name, common) if common.any? + raise CommandConflict.new(name, common) unless common.empty? commands.each {|c| @commands[c] = name } save_index diff --git a/spec/bundler/plugin/index_spec.rb b/spec/bundler/plugin/index_spec.rb index 71f3adcf02..f969aad12f 100644 --- a/spec/bundler/plugin/index_spec.rb +++ b/spec/bundler/plugin/index_spec.rb @@ -35,5 +35,11 @@ describe Bundler::Plugin::Index do it "returns the plugins name on query" do expect(index.command_plugin("newco")).to eq("cplugin") end + + it "raises error on conflict" do + expect do + index.register_plugin("aplugin", lib_path("aplugin").to_s, ["newco"]) + end.to raise_error(Index::CommandConflict) + end end end diff --git a/spec/bundler/plugin_spec.rb b/spec/bundler/plugin_spec.rb index 166c1efbac..a46e5550c1 100644 --- a/spec/bundler/plugin_spec.rb +++ b/spec/bundler/plugin_spec.rb @@ -63,7 +63,7 @@ describe Bundler::Plugin do allow(definition).to receive(:dependencies) { [] } allow(installer).to receive(:install_definition).never - subject.eval_gemfile(gemfile) + subject.gemfile_install(gemfile) end it "should validate and register the plugins" do @@ -77,7 +77,7 @@ describe Bundler::Plugin do expect(subject).to receive(:validate_plugin!).twice expect(subject).to receive(:register_plugin).twice - subject.eval_gemfile(gemfile) + subject.gemfile_install(gemfile) end end |