class Retest::Command

Attributes

options[RW]
setup[RW]

Public Class Methods

for_options(options) click to toggle source
# File lib/retest/command.rb, line 10
def self.for_options(options)
  new(options: options).command
end
for_setup(setup) click to toggle source
# File lib/retest/command.rb, line 14
def self.for_setup(setup)
  new(setup: setup).command
end
new(options: Options.new, setup: Setup.new, output_stream: STDOUT) click to toggle source
# File lib/retest/command.rb, line 22
def initialize(options: Options.new, setup: Setup.new, output_stream: STDOUT)
  @options = options
  @setup = setup
  @output_stream = output_stream
end

Public Instance Methods

command() click to toggle source
# File lib/retest/command.rb, line 28
def command
  return default_command if auto?
  options_command || default_command
end
default_command() click to toggle source
# File lib/retest/command.rb, line 54
def default_command
  @output_stream.puts "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'"
  setup_command
end
options_command() click to toggle source
# File lib/retest/command.rb, line 33
def options_command
  return params[:command] if params[:command]

  if    params[:rspec] then rspec_command
  elsif params[:rails] then rails_command
  elsif params[:ruby]  then ruby_command
  elsif params[:rake]  then rake_command
  else
  end
end
setup_command() click to toggle source
# File lib/retest/command.rb, line 44
def setup_command
  case type
  when :rake  then rake_command
  when :rspec then rspec_command
  when :rails then rails_command
  when :ruby  then ruby_command
  else             ruby_command
  end
end

Private Instance Methods

rails_command() click to toggle source
# File lib/retest/command.rb, line 65
def rails_command
  Rails.new(all: full_suite?)
end
rake_command() click to toggle source
# File lib/retest/command.rb, line 69
def rake_command
  Rake.new(all: full_suite?)
end
rspec_command() click to toggle source
# File lib/retest/command.rb, line 61
def rspec_command
  Rspec.new(all: full_suite?)
end
ruby_command() click to toggle source
# File lib/retest/command.rb, line 73
def ruby_command
  Ruby.new(all: full_suite?)
end