summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-10-21 09:19:46 +0900
committerHomu <homu@barosl.com>2016-10-21 09:19:46 +0900
commit542594a8cc278799a3c465eb478fe17b3c5661d1 (patch)
treeceaf68c7102e8b9e6600ed2f855413c8e955b152
parent3ae014f0dedc5979956b411d022c4874be76619d (diff)
parent25166ae962c07afddd8b2387af61749f6a59c261 (diff)
downloadbundler-542594a8cc278799a3c465eb478fe17b3c5661d1.tar.gz
Auto merge of #5071 - bundler:seg-use-gemdeps, r=indirect
[RubyGemsIntegration] Add a single method for #use_gemdeps Closes #5040 \c @indirect
-rw-r--r--lib/bundler/gemdeps.rb28
-rw-r--r--lib/bundler/rubygems_integration.rb8
2 files changed, 36 insertions, 0 deletions
diff --git a/lib/bundler/gemdeps.rb b/lib/bundler/gemdeps.rb
new file mode 100644
index 0000000000..8595b8c7ea
--- /dev/null
+++ b/lib/bundler/gemdeps.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+module Bundler
+ class Gemdeps
+ def initialize(runtime)
+ @runtime = runtime
+ end
+
+ def requested_specs
+ @runtime.requested_specs
+ end
+
+ def specs
+ @runtime.specs
+ end
+
+ def dependencies
+ @runtime.dependencies
+ end
+
+ def current_dependencies
+ @runtime.current_dependencies
+ end
+
+ def requires
+ @runtime.requires
+ end
+ end
+end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 90da0b4645..488aa8b9a4 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -751,6 +751,14 @@ module Bundler
end.map(&:to_spec)
end
end
+
+ def use_gemdeps(gemfile)
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
+ runtime = Bundler.setup
+ Bundler.ui = nil
+ activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
+ [Gemdeps.new(runtime), activated_spec_names]
+ end
end
end