summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin.rb
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-09 18:44:45 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-09 18:44:47 +0530
commitdf5a8e97044a92965e25a344da89f550ab570956 (patch)
tree895d8d2c292154d6d034a7c37a3cddda340a4244 /lib/bundler/plugin.rb
parent7804310adb9e0b24798ed0cf33f29666a359ea4d (diff)
downloadbundler-df5a8e97044a92965e25a344da89f550ab570956.tar.gz
Added plugin install support for inline Gemfile
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 f97de2b20d..9aabd73a42 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