class GitSpec::CLI

Public Instance Methods

spec() click to toggle source
# File lib/git_spec/cli.rb, line 10
def spec
  GitSpec.configure do |config|
    config.src_root = options.src_root
    config.log_level = options.log_level
  end

  files, missing_files = GitSpec.changed_files
  missing_files_banner(missing_files) if missing_files.any?
  filtered_to_banner(files) if files.any?

  if options.dry_run
    say("Dry run enabled. Would have sent the following files to the spec runner:", :yellow)
    say(files.join(' '), :yellow)
  else
    system "#{options.command} #{files.join(' ')}"
  end

end

Private Instance Methods

filtered_to_banner(files) click to toggle source
# File lib/git_spec/cli.rb, line 41
def filtered_to_banner(files)
  say("Executing the spec runner for:", :green)

  files.each do |filename|
    say("  * #{filename}", :green)
  end
  puts
  puts
end
missing_files_banner(missing_files) click to toggle source
# File lib/git_spec/cli.rb, line 31
def missing_files_banner(missing_files)
  say("Expected specs at the following locations but they could not be found:", :red)

  missing_files.each do |filename|
    say("  * #{filename}", :red)
  end
  puts
  puts
end