Sha256: 717e1f615488c6ee7b9a250a868eece47ecd9d4a27e5fdb6266d61c65d8a3cee
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
module Omnitest class Psychic module Factories class PowerShellTaskFactory < MagicTaskFactory TASK_PRIORITY = 1 EXTENSIONS = ['.ps1'] magic_file 'scripts/*.ps1' register_task_factory 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 def task(task_alias) task = task_alias.to_s script = Dir["#{cwd}/scripts/#{task}{.ps1}"].first relativize_cmd(script) if script end def active? true if psychic.os_family == :windows end private def relativize_cmd(cmd) cmd = Omnitest::Core::FileSystem.relativize(cmd, cwd) "PowerShell -NoProfile -ExecutionPolicy Bypass -File \"#{cmd}\"" end end class PowerShellScriptFactory < ScriptFactory runs '**.ps1', 5 def active? true if psychic.os_family == :windows end def script(script) script = psychic.task('run_script') if script "#{script} #{script.source_file}" else relativize_cmd(script.absolute_source_file) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omnitest-psychic-0.0.9 | lib/omnitest/psychic/factories/powershell_factories.rb |