Class: Crosstest::Psychic::Factories::PowerShellTaskFactory

Inherits:
MagicTaskFactory show all
Defined in:
lib/crosstest/psychic/factories/powershell_factories.rb

Constant Summary collapse

TASK_PRIORITY =
1
EXTENSIONS =
['.ps1']

Instance Attribute Summary

Attributes inherited from MagicTaskFactory

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

Instance Method Summary collapse

Methods inherited from MagicTaskFactory

#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(psychic, opts = {}) ⇒ PowerShellTaskFactory

Returns a new instance of PowerShellTaskFactory


10
11
12
13
14
15
# File 'lib/crosstest/psychic/factories/powershell_factories.rb', line 10

def initialize(psychic, opts = {})
  super
  @known_tasks = Dir["#{cwd}/scripts/*"].map do | script |
    File.basename(script, File.extname(script)) if EXTENSIONS.include?(File.extname(script))
  end
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/crosstest/psychic/factories/powershell_factories.rb', line 23

def active?
  true if psychic.os_family == :windows
end

#command_for_task(task_alias) ⇒ Object


17
18
19
20
21
# File 'lib/crosstest/psychic/factories/powershell_factories.rb', line 17

def command_for_task(task_alias)
  task = task_alias.to_s
  script = Dir["#{cwd}/scripts/#{task}{.ps1}"].first
  relativize_cmd(script) if script
end