Class: Crosstest::Psychic::Factories::ShellScriptFactory

Inherits:
ScriptFactory show all
Includes:
ShellBase
Defined in:
lib/crosstest/psychic/factories/shell_factories.rb

Constant Summary

Constants included from ShellBase

Crosstest::Psychic::Factories::ShellBase::EXTENSIONS

Constants inherited from ScriptFactory

ScriptFactory::TASK_PRIORITY

Constants inherited from Crosstest::Psychic::FactoryManager

Crosstest::Psychic::FactoryManager::BUILT_IN_DIR

Instance Attribute Summary

Attributes inherited from ScriptFactory

#priority, #psychic, #run_patterns

Attributes inherited from Crosstest::Psychic::FactoryManager

#factories

Instance Method Summary collapse

Methods included from ShellBase

#active?

Methods inherited from ScriptFactory

#active?, #cwd, #initialize, #known_script?, #known_scripts, priority_for_script, register_script_factory, run_patterns, runs

Methods inherited from Crosstest::Psychic::FactoryManager

#active?, #active_factories, autoload_factories!, clear, factory_classes, #initialize, register_factory

Constructor Details

This class inherits a constructor from Crosstest::Psychic::ScriptFactory

Instance Method Details

#command_for_script(script) ⇒ Object


61
62
63
64
65
66
67
68
# File 'lib/crosstest/psychic/factories/shell_factories.rb', line 61

def command_for_script(script)
  base_command = run_script_command
  if base_command
    "#{base_command} #{script.source_file}"
  else
    relativize_cmd(script.absolute_source_file)
  end
end

#priority_for_script(script) ⇒ Object


48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/crosstest/psychic/factories/shell_factories.rb', line 48

def priority_for_script(script)
  return 7 if shell_task_factory.known_task? :run_script

  case script.extname
  when '.sh'
    9
  when ''
    7
  else
    5 if shebang?(script)
  end
end

#shell_task_factoryObject


44
45
46
# File 'lib/crosstest/psychic/factories/shell_factories.rb', line 44

def shell_task_factory
  psychic.task_factory_manager.active? ShellTaskFactory
end