Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion exe/manageiq-cross_repo
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ opts = Optimist.options do
Optional, a command string for running the specs. Defaults to `bundle exec rake`.
EOS

opt :debug, "Print extra debugging output", :default => ENV["DEBUG"].presence || false

# Manually add these so they appear in the right order in the help output
banner ""
opt :version, "Print version and exit"
Expand Down Expand Up @@ -90,7 +92,7 @@ end
opts[:repos] = opts[:repos].flatten.flat_map { |repo| repo.split(",").map(&:strip) }

begin
ManageIQ::CrossRepo.run(opts[:test_repo], opts[:repos], opts[:script_cmd])
ManageIQ::CrossRepo.run(opts[:test_repo], opts[:repos], opts[:script_cmd], opts[:debug])
rescue ArgumentError => e
Optimist.die e
end
19 changes: 16 additions & 3 deletions lib/manageiq/cross_repo/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

module ManageIQ::CrossRepo
class Runner
attr_reader :test_repo, :core_repo, :gem_repos, :script_cmd
attr_reader :test_repo, :core_repo, :gem_repos, :script_cmd, :debug

def initialize(test_repo, repos, script_cmd = "")
def initialize(test_repo, repos, script_cmd = "", debug = false)
@test_repo = Repository.new(test_repo || "ManageIQ/manageiq@master")

core_repos, @gem_repos = Array(repos).collect { |repo| Repository.new(repo) }.partition(&:core?)
Expand All @@ -22,6 +22,7 @@ def initialize(test_repo, repos, script_cmd = "")
end

@script_cmd = script_cmd.presence || "bundle exec rake"
@debug = debug
end

def run
Expand Down Expand Up @@ -54,7 +55,7 @@ def with_test_env
end

def system!(*args)
if ENV["DEBUG"]
if debug
repo = Dir.pwd.split("/").last(2).join("/")
puts "\e[36mDEBUG: #{repo} - #{args.join(" ")}\e[0m"
end
Expand All @@ -76,6 +77,18 @@ def generate_bundler_d
FileUtils.mkdir_p(bundler_d_path)

File.write(override_path, content)

if debug
puts
puts "*" * 80
puts
puts "Contents of #{override_path}"
puts
puts File.read(override_path)
puts
puts "*" * 80
puts
end
end
end

Expand Down