Class: Retest::Command
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/retest/command.rb,
lib/retest/command/rake.rb,
lib/retest/command/ruby.rb,
lib/retest/command/rails.rb,
lib/retest/command/rspec.rb
Defined Under Namespace
Classes: Rails, Rake, Rspec, Ruby
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options: Options.new, setup: Setup.new, stdout: $stdout) ⇒ Command
Returns a new instance of Command.
22
23
24
25
26
|
# File 'lib/retest/command.rb', line 22
def initialize(options: Options.new, setup: Setup.new, stdout: $stdout)
@options = options
@setup = setup
@stdout = stdout
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
21
22
23
|
# File 'lib/retest/command.rb', line 21
def options
@options
end
|
#setup ⇒ Object
Returns the value of attribute setup.
21
22
23
|
# File 'lib/retest/command.rb', line 21
def setup
@setup
end
|
Class Method Details
.for_options(options) ⇒ Object
10
11
12
|
# File 'lib/retest/command.rb', line 10
def self.for_options(options)
new(options: options).command
end
|
.for_setup(setup) ⇒ Object
14
15
16
|
# File 'lib/retest/command.rb', line 14
def self.for_setup(setup)
new(setup: setup).command
end
|
Instance Method Details
#command ⇒ Object
28
29
30
|
# File 'lib/retest/command.rb', line 28
def command
options_command || default_command
end
|
#default_command ⇒ Object
53
54
55
56
|
# File 'lib/retest/command.rb', line 53
def default_command
@stdout.puts "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'"
setup_command
end
|
#options_command ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/retest/command.rb', line 32
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 ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/retest/command.rb', line 43
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
|