spec/support/helpers.rb in bundler-1.3.0.pre.3 vs spec/support/helpers.rb in bundler-1.3.0.pre.4
- old
+ new
@@ -79,9 +79,35 @@
else
sys_exec(cmd, expect_err){|i| yield i if block_given? }
end
end
+ def bundle_ruby(options = {})
+ expect_err = options.delete(:expect_err)
+ exitstatus = options.delete(:exitstatus)
+ options["no-color"] = true unless options.key?("no-color")
+
+ bundle_bin = File.expand_path('../../../bin/bundle_ruby', __FILE__)
+
+ requires = options.delete(:requires) || []
+ requires << File.expand_path('../fakeweb/'+options.delete(:fakeweb)+'.rb', __FILE__) if options.key?(:fakeweb)
+ requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice)
+ requires_str = requires.map{|r| "-r#{r}"}.join(" ")
+
+ env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
+ args = options.map do |k,v|
+ v == true ? " --#{k}" : " --#{k} #{v}" if v
+ end.join
+
+ cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin}"
+
+ if exitstatus
+ sys_status(cmd)
+ else
+ sys_exec(cmd, expect_err){|i| yield i if block_given? }
+ end
+ end
+
def ruby(ruby, options = {})
expect_err = options.delete(:expect_err)
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
ruby.gsub!(/["`\$]/) {|m| "\\#{m}" }
lib_option = options[:no_lib] ? "" : " -I#{lib}"