Class: Polytrix::ChallengeRunner
- Inherits:
-
Thor::Shell::Color
- Object
- Thor::Shell::Color
- Polytrix::ChallengeRunner
- Defined in:
- lib/polytrix/challenge_runner.rb
Direct Known Subclasses
Runners::LinuxChallengeRunner, Runners::WindowsChallengeRunner
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
Attributes included from Runners::Executor
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Runners::Executor
Methods included from Polytrix::Core::FileSystemHelper
#find_file, #recursive_parent_search
Methods included from StringHelpers
Methods included from StringHelpers::ClassMethods
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
14 15 16 |
# File 'lib/polytrix/challenge_runner.rb', line 14 def env @env end |
Class Method Details
.create_runner ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/polytrix/challenge_runner.rb', line 16 def self.create_runner case RbConfig::CONFIG['host_os'] when /mswin(\d+)|mingw/i Runners::WindowsChallengeRunner.new else Runners::LinuxChallengeRunner.new end end |
Instance Method Details
#run_challenge(challenge) ⇒ Object
34 35 36 37 |
# File 'lib/polytrix/challenge_runner.rb', line 34 def run_challenge(challenge) middleware.call(challenge) challenge.result end |
#run_command(command) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/polytrix/challenge_runner.rb', line 25 def run_command(command) if Polytrix.configuration.dry_run puts "Would have run #{command}" else say_status 'polytrix:execute', command execute command end end |