summaryrefslogtreecommitdiff
path: root/spec/support/helpers.rb
diff options
context:
space:
mode:
authorAndre Medeiros <me@andremedeiros.info>2014-05-12 14:14:46 +0100
committerAndre Medeiros <me@andremedeiros.info>2014-05-12 14:14:46 +0100
commitacec7fd69d1c88d3867b77759e28bad7989870a8 (patch)
tree1feb952f9c544fd05b2ba51b69f5f17f2f50b7a2 /spec/support/helpers.rb
parentaac716213549c5c35609de3d7f3a81bba407c59f (diff)
downloadbundler-plugin-system.tar.gz
Implemented a very basic plugin system.plugin-system
The way this works is pretty much the same way as `git` commands work. When invoking `bundler <task>`, if the task isn't defined on Bundler::CLI, Bundler will try and figure out if there is a `bundler-<task>` binary present on the path. If so, it's invoked. Same error message (and error codes) apply when a binary isn't found. Also, this is just a first, simple pass at the problem. @indirect and I had a chat about how it should work, and we should probably think about offering the possibility of loading up Ruby plugins in the already loaded Bundler environment.
Diffstat (limited to 'spec/support/helpers.rb')
-rw-r--r--spec/support/helpers.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index cb09ecf834..a3a4b16aae 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -74,7 +74,6 @@ module Spec
end.join
cmd = "#{env} #{sudo} #{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}"
-
if exitstatus
sys_status(cmd)
else
@@ -83,7 +82,7 @@ module Spec
end
def bundle_ruby(options = {})
- expect_err = options.delete(:expect_err)
+ expect_err = options.delete(:expect_err)
exitstatus = options.delete(:exitstatus)
options["no-color"] = true unless options.key?("no-color")
@@ -218,6 +217,14 @@ module Spec
ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
end
+ def with_path_as(path)
+ old_path = ENV['PATH']
+ ENV['PATH'] = "#{path}:#{ENV['PATH']}"
+ yield
+ ensure
+ ENV['PATH'] = old_path
+ end
+
def break_git!
FileUtils.mkdir_p(tmp("broken_path"))
File.open(tmp("broken_path/git"), "w", 0755) do |f|