class Omnitest::Psychic::Factories::ShellScriptFactory
Public Instance Methods
priority_for_script(script)
click to toggle source
# File lib/omnitest/psychic/factories/shell_factories.rb, line 48 def priority_for_script(script) return 8 if shell_task_factory.known_task? :run_script case script.extname when '.sh' 9 when '' 7 else 5 if shebang?(script) end end
script(script)
click to toggle source
# File lib/omnitest/psychic/factories/shell_factories.rb, line 61 def script(script) base_command = run_script_command if base_command "#{base_command} #{script.source_file}" else relativize_cmd(script.absolute_source_file) end end
shell_task_factory()
click to toggle source
# File lib/omnitest/psychic/factories/shell_factories.rb, line 44 def shell_task_factory psychic.task_factory_manager.active? ShellTaskFactory end
Protected Instance Methods
run_script_command()
click to toggle source
# File lib/omnitest/psychic/factories/shell_factories.rb, line 72 def run_script_command psychic.task('run_script') rescue TaskNotImplementedError nil end
shebang?(script)
click to toggle source
# File lib/omnitest/psychic/factories/shell_factories.rb, line 78 def shebang?(script) first_line = script.source.lines.first first_line && first_line.match(/\#\!/) rescue => e logger.warn("Could not read #{script.source_file}: #{e.message}") # Could be binary, unknown encoding, ... false end