Class: BatCave::Command::Test

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/batcave/command/test.rb

Instance Method Summary collapse

Instance Method Details

#executeObject

def root



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/batcave/command/test.rb', line 15

def execute
  # Assume all files are in the same project.
  project_root = gitroot(File.dirname(files.first)) + "/"

  relative_paths = files.collect { |a| File.realpath(a).gsub(project_root, "") }
  success = true
  Dir.chdir(project_root) do
    commands = relative_paths.collect { |p| path_test_command(p) }.select { |p| !p.nil? }
    commands.each do |command|
      system(*command)
      success &&= $?.success?
    end # commands.each
  end
  return success ? 0 : 1
end