Class: Crosstest::Psychic::Factories::ShellTaskFactory

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

Constant Summary collapse

TASK_PRIORITY =
1

Constants included from ShellBase

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

Instance Attribute Summary

Attributes inherited from MagicTaskFactory

#hints, #known_tasks, #priority, #psychic, #tasks

Instance Method Summary collapse

Methods included from ShellBase

#active?

Methods inherited from MagicTaskFactory

#active?, #known_task?, known_tasks, magic_env_var, magic_env_vars, magic_file, magic_file_patterns, #priority_for_task, register_task_factory, task, tasks

Constructor Details

#initialize(*args) ⇒ ShellTaskFactory

Returns a new instance of ShellTaskFactory


25
26
27
28
29
30
# File 'lib/crosstest/psychic/factories/shell_factories.rb', line 25

def initialize(*args)
  super
  @known_tasks = Dir.glob("#{cwd}/scripts/*", File::FNM_CASEFOLD).map do | script |
    File.basename(script, File.extname(script)) if EXTENSIONS.include?(File.extname(script))
  end
end

Instance Method Details

#command_for_task(task_alias) ⇒ Object


32
33
34
35
36
# File 'lib/crosstest/psychic/factories/shell_factories.rb', line 32

def command_for_task(task_alias)
  task = task_alias.to_s
  script = Dir.glob("#{cwd}/scripts/#{task}{.sh,}", File::FNM_CASEFOLD).first
  relativize_cmd(script) if script
end