diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-06-30 18:01:43 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-07-03 09:41:58 +0530 |
commit | c71165c7915350c1630fd118c963fcd481fefb5c (patch) | |
tree | 871999af7c14d96a2d92cdb0b4b3d3157e387a77 | |
parent | c2154b0a44a71611c0aee9c4a6b8d6bd38973ecd (diff) | |
download | bundler-c71165c7915350c1630fd118c963fcd481fefb5c.tar.gz |
Mixed SharedHelpers with Plugin::API
-rw-r--r-- | lib/bundler/plugin/api.rb | 21 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 1 | ||||
-rw-r--r-- | lib/bundler/source/path/installer.rb | 2 | ||||
-rw-r--r-- | spec/bundler/plugin/api_spec.rb | 12 | ||||
-rw-r--r-- | spec/plugins/source/example_spec.rb | 4 |
5 files changed, 20 insertions, 20 deletions
diff --git a/lib/bundler/plugin/api.rb b/lib/bundler/plugin/api.rb index 6fa8874310..9ff4b7385b 100644 --- a/lib/bundler/plugin/api.rb +++ b/lib/bundler/plugin/api.rb @@ -59,24 +59,17 @@ module Bundler Bundler.tmp(["plugin", *names].join("-")) end - # Change directory helper that provides thread safety - # - # Sources should use this since, if possible, they are run in parallel - # threads - # - # @param [String] directory - # @param [Proc] block to execute - def chdir(dir, &blk) - SharedHelpers.chdir(dir, &blk) - end - def method_missing(name, *args, &blk) - super unless Bundler.respond_to?(name) - Bundler.send(name, *args, &blk) + return Bundler.send(name, *args, &blk) if Bundler.respond_to?(name) + + return SharedHelpers.send(name, *args, &blk) if SharedHelpers.respond_to?(name) + + super end def respond_to_missing?(name, include_private = false) - Bundler.respond_to?(name, include_private) || super + SharedHelpers.respond_to?(name, include_private) || + Bundler.respond_to?(name, include_private) || super end end end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index cc97f26a15..3c4d914fb3 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -218,7 +218,6 @@ module Bundler Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}" end - end end end diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb index 4fc5c807a5..abc46d5a04 100644 --- a/lib/bundler/source/path/installer.rb +++ b/lib/bundler/source/path/installer.rb @@ -24,7 +24,7 @@ module Bundler end def post_install - SharedHelpers.chdir(gem_dir) do + SharedHelpers.chdir(@gem_dir) do run_hooks(:pre_install) unless @disable_extentions diff --git a/spec/bundler/plugin/api_spec.rb b/spec/bundler/plugin/api_spec.rb index d1c12b9485..4c9c9bbc94 100644 --- a/spec/bundler/plugin/api_spec.rb +++ b/spec/bundler/plugin/api_spec.rb @@ -48,8 +48,16 @@ describe Bundler::Plugin::API do subject(:api) { UserPluginClass.new } # A test of delegation - it "provides the bundler settings" do - expect(api.settings).to eq(Bundler.settings) + it "provides the Bundler's functions", :focused do + expect(Bundler).to receive(:an_unkown_function).once + + api.an_unkown_function + end + + it "includes Bundler::SharedHelpers' functions", :focused do + expect(Bundler::SharedHelpers).to receive(:an_unkown_helper).once + + api.an_unkown_helper end context "#tmp" do diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb index b21ac1f638..ead24e0d37 100644 --- a/spec/plugins/source/example_spec.rb +++ b/spec/plugins/source/example_spec.rb @@ -97,7 +97,7 @@ describe "real source plugins" do expect(out).to eq(bundle("show a-path-gem")) end - it "installs the gem executables", :focused do + it "installs the gem executables" do build_lib "gem-with-bin" do |s| s.executables = ["foo"] end @@ -228,7 +228,7 @@ describe "real source plugins" do `git reset --hard \#{revision}` end - post_install + post_install(spec) nil end |