aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/plugin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/plugin.rb')
-rw-r--r--lib/bundler/plugin.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index f97de2b2..9aabd73a 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -36,8 +36,14 @@ module Bundler
# specified by plugin method
#
# @param [Pathname] gemfile path
- def gemfile_install(gemfile)
- definition = DSL.evaluate(gemfile, nil, {})
+ def gemfile_install(gemfile = nil, &inline)
+ if block_given?
+ builder = DSL.new
+ builder.instance_eval(&inline)
+ definition = builder.to_definition(nil, true)
+ else
+ definition = DSL.evaluate(gemfile, nil, {})
+ end
return unless definition.dependencies.any?
plugins = Installer.new.install_definition(definition)
@@ -80,6 +86,13 @@ module Bundler
@commands[command].new.exec(command, args)
end
+ # currently only intended for specs
+ #
+ # @return [String, nil] installed path
+ def installed?(plugin)
+ Index.new.installed?(plugin)
+ end
+
# Post installation processing and registering with index
#
# @param [Hash] plugins mapped to their installtion path