aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2014-09-10 09:50:47 +0100
committerMike McQuaid2014-09-10 13:29:14 +0100
commit6d1a5325a71728ef0d0c4c9a4582087bcada69f5 (patch)
tree6dced498e8aefc3d278b0b04e7beb838688e57ca
parent3a8cc17822a9f2017c6ad50f10529a1b7d4e7c5a (diff)
downloadhomebrew-6d1a5325a71728ef0d0c4c9a4582087bcada69f5.tar.bz2
Use bundler for test gem dependencies.
Closes #31986. References #31981.
-rw-r--r--Library/Homebrew/cmd/tests.rb9
-rw-r--r--Library/Homebrew/test/.gitignore3
-rw-r--r--Library/Homebrew/test/Gemfile5
-rw-r--r--Library/Homebrew/test/Gemfile.lock16
-rw-r--r--Library/Homebrew/test/Rakefile13
5 files changed, 32 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/tests.rb b/Library/Homebrew/cmd/tests.rb
index 5e7445769..623c14f04 100644
--- a/Library/Homebrew/cmd/tests.rb
+++ b/Library/Homebrew/cmd/tests.rb
@@ -2,7 +2,14 @@ module Homebrew
def tests
(HOMEBREW_LIBRARY/'Homebrew/test').cd do
ENV['TESTOPTS'] = '-v' if ARGV.verbose?
- system "rake", "deps", "test"
+ quiet_system("gem", "list", "--installed", "bundler") || \
+ system("gem", "install", "--no-ri", "--no-rdoc",
+ "--user-install", "bundler")
+ require 'rubygems'
+ ENV["PATH"] = "#{Gem.user_dir}/bin:#{ENV["PATH"]}"
+ quiet_system("bundle", "check") || \
+ system("bundle", "install", "--path", "vendor/bundle")
+ system "bundle", "exec", "rake", "test"
exit $?.exitstatus
end
end
diff --git a/Library/Homebrew/test/.gitignore b/Library/Homebrew/test/.gitignore
index f5df6eb3a..ae01bda0f 100644
--- a/Library/Homebrew/test/.gitignore
+++ b/Library/Homebrew/test/.gitignore
@@ -1,2 +1,5 @@
+/.bundle/
+/bin/
/coverage
/prof
+/vendor/
diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile
new file mode 100644
index 000000000..7c224bd61
--- /dev/null
+++ b/Library/Homebrew/test/Gemfile
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gem "mocha", "~> 1.1"
+gem "minitest", "~> 5.3"
+gem "rake", "~> 10.3"
diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock
new file mode 100644
index 000000000..3461b338a
--- /dev/null
+++ b/Library/Homebrew/test/Gemfile.lock
@@ -0,0 +1,16 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ metaclass (0.0.4)
+ minitest (5.4.1)
+ mocha (1.1.0)
+ metaclass (~> 0.0.1)
+ rake (10.3.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ minitest (~> 5.3)
+ mocha (~> 1.1)
+ rake (~> 10.3)
diff --git a/Library/Homebrew/test/Rakefile b/Library/Homebrew/test/Rakefile
index 1f919aab2..b9dfe3ebb 100644
--- a/Library/Homebrew/test/Rakefile
+++ b/Library/Homebrew/test/Rakefile
@@ -3,22 +3,9 @@ require 'rake/testtask'
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
TEST_FILES = Dir["#{TEST_DIRECTORY}/test_*.rb"]
-GEM_DEPS = {
- "mocha" => "~> 1.1",
- "minitest" => "~> 5.3",
- "rake" => "~> 10.3",
-}
task :default => :test
-task :deps do
- GEM_DEPS.each do |dep, version|
- `gem list --installed #{dep} -v '#{version}'`
- next if $?.success?
- sh "gem", "install", "--no-ri", "--no-rdoc", "--user-install", dep, "-v", version
- end
-end
-
Rake::TestTask.new(:test) do |t|
t.libs << TEST_DIRECTORY
t.test_files = TEST_FILES