Class: LearnTest::Strategy
- Inherits:
-
Object
- Object
- LearnTest::Strategy
show all
- Defined in:
- lib/learn_test/strategy.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(runner) ⇒ Strategy
Returns a new instance of Strategy.
7
8
9
10
|
# File 'lib/learn_test/strategy.rb', line 7
def initialize(runner)
@runner = runner
@options = runner.options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5
6
7
|
# File 'lib/learn_test/strategy.rb', line 5
def options
@options
end
|
#runner ⇒ Object
Returns the value of attribute runner.
5
6
7
|
# File 'lib/learn_test/strategy.rb', line 5
def runner
@runner
end
|
Instance Method Details
#argv ⇒ Object
50
51
52
|
# File 'lib/learn_test/strategy.rb', line 50
def argv
options[:argv]
end
|
#check_dependencies ⇒ Object
16
|
# File 'lib/learn_test/strategy.rb', line 16
def check_dependencies; end
|
#cleanup ⇒ Object
36
|
# File 'lib/learn_test/strategy.rb', line 36
def cleanup; end
|
18
|
# File 'lib/learn_test/strategy.rb', line 18
def configure; end
|
#die(message) ⇒ Object
54
55
56
57
|
# File 'lib/learn_test/strategy.rb', line 54
def die(message)
puts message.red
exit
end
|
#learn_oauth_token ⇒ Object
#output ⇒ Object
24
25
26
|
# File 'lib/learn_test/strategy.rb', line 24
def output
raise NotImplementedError, 'you must implement how the test gets its raw output'
end
|
#push_results? ⇒ Boolean
32
33
34
|
# File 'lib/learn_test/strategy.rb', line 32
def push_results?
true
end
|
#results ⇒ Object
28
29
30
|
# File 'lib/learn_test/strategy.rb', line 28
def results
output
end
|
#run ⇒ Object
20
21
22
|
# File 'lib/learn_test/strategy.rb', line 20
def run
raise NotImplementedError, 'you must implement how this strategy runs its tests'
end
|
#run_install(command, npm_install: false) ⇒ Object
npm_install option added to fix the proxying of the npm install progress bar output.
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/learn_test/strategy.rb', line 62
def run_install(command, npm_install: false)
if npm_install
system(command)
else
Open3.popen3(command) do |_, stdout, stderr, wait_thr|
while out = stdout.gets do
puts out
end
while err = stderr.gets do
puts err
end
if wait_thr.value.exitstatus != 0
die("There was an error running #{command}")
end
end
end
end
|
#service_endpoint ⇒ Object
12
13
14
|
# File 'lib/learn_test/strategy.rb', line 12
def service_endpoint
raise NotImplementedError, 'you must add the service endpoint to the test strategy'
end
|