Skip to content

Commit 79b9e37

Browse files
committed
Add --script-cmd opt
Allows configuring a custom script to be executed for running the specs. In this scenario, if this is specific to a particular TEST_REPO, then this will only work with said repo and the user will have to configure the cross repo run for that test in particular, and leave the others as the default.
1 parent 1b9e19f commit 79b9e37

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

exe/manageiq-cross_repo

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ opts = Optimist.options do
3131
Can also be passed as a REPOS environment variable.
3232
EOS
3333

34+
opt :script_cmd, <<~EOS, :type => :string, :default => ENV["SCRIPT_CMD"].presence || ""
35+
Optional, a command string for running the specs. Defaults to `bundle exec rake`.
36+
EOS
37+
3438
# Manually add these so they appear in the right order in the help output
3539
banner ""
3640
opt :version, "Print version and exit"
@@ -86,7 +90,7 @@ end
8690
opts[:repos] = opts[:repos].flatten.flat_map { |repo| repo.split(",").map(&:strip) }
8791

8892
begin
89-
ManageIQ::CrossRepo.run(opts[:test_repo], opts[:repos])
93+
ManageIQ::CrossRepo.run(opts[:test_repo], opts[:repos], opts[:script_cmd])
9094
rescue ArgumentError => e
9195
Optimist.die e
9296
end

lib/manageiq/cross_repo/runner.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
module ManageIQ::CrossRepo
55
class Runner
6-
attr_reader :test_repo, :core_repo, :gem_repos
6+
attr_reader :test_repo, :core_repo, :gem_repos, :script_cmd
77

8-
def initialize(test_repo, repos)
8+
def initialize(test_repo, repos, script_cmd = "")
99
@test_repo = Repository.new(test_repo || "ManageIQ/manageiq@master")
1010

1111
core_repos, @gem_repos = Array(repos).collect { |repo| Repository.new(repo) }.partition(&:core?)
@@ -20,6 +20,8 @@ def initialize(test_repo, repos)
2020

2121
@core_repo ||= Repository.new("ManageIQ/manageiq@master")
2222
end
23+
24+
@script_cmd = script_cmd.presence || "bundle exec rake"
2325
end
2426

2527
def run
@@ -35,7 +37,7 @@ def run_tests
3537
with_test_env do
3638
system!({"TRAVIS_BUILD_DIR" => test_repo.path.to_s}, "bash", "tools/ci/before_install.sh") if ENV["CI"] && File.exist?("tools/ci/before_install.sh")
3739
system!(env_vars, "bin/setup")
38-
system!("bundle exec rake")
40+
system!(script_cmd)
3941
end
4042
end
4143

0 commit comments

Comments
 (0)