summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-13 13:42:56 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-14 10:29:52 -0500
commit0560c9c673f5792f002265ed88987b83685168d5 (patch)
tree0cb804e2a63005e9945382af6ff3d493edeab43e
parent9e1e5e1273e929543b5d6ed43df108dd4fb8ea25 (diff)
downloadbundler-0560c9c673f5792f002265ed88987b83685168d5.tar.gz
[RubyGemsIntegration] Implement #matches_for_glob for RG < 1.8
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--lib/bundler/rubygems_integration.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 813edbcda9..b5d528d865 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -174,7 +174,7 @@ module Bundler
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
path_plugin_files = requested_path_gems.map do |spec|
- spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
+ Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
end.flatten
Bundler.rubygems.load_plugin_files(path_plugin_files)
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 7bd49a5cfb..edc931e79f 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -84,6 +84,14 @@ module Bundler
spec.respond_to?(:default_gem?) && spec.default_gem?
end
+ def spec_matches_for_glob(spec, glob)
+ return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
+
+ spec.load_paths.map do |lp|
+ Dir["#{lp}/#{glob}#{suffix_pattern}"]
+ end.flatten(1)
+ end
+
def stub_set_spec(stub, spec)
stub.instance_variable_set(:@spec, spec)
end