Sha256: 376015177d4873a19c4e39f0f5df3df1f4526c16ad95023387b5960dcd8642a6

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

module Polytrix
  module Runners
    class WindowsChallengeRunner < ChallengeRunner
      PS_OPTIONS = '-NoProfile -ExecutionPolicy Bypass'
      def script_extension
        'ps1'
      end

      def challenge_command(env_file, challenge_script)
        # I don't know a simple powershell replacement for &&
        # See http://stackoverflow.com/questions/2416662/what-are-the-powershell-equivalent-of-bashs-and-operators
        if File.exist? 'scripts/wrapper.ps1'
          command = ". ./#{env_file}; ./scripts/wrapper.ps1 #{challenge_script}"
        else
          command = ". ./#{env_file}; ./#{challenge_script}"
        end
        "PowerShell #{PS_OPTIONS} -Command \"#{command}\""
      end

      def save_environment_variable(key, value)
        "$Env:#{key}='#{value}'"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polytrix-0.1.2 lib/polytrix/runners/windows_challenge_runner.rb
polytrix-0.1.1 lib/polytrix/runners/windows_challenge_runner.rb
polytrix-0.1.0 lib/polytrix/runners/windows_challenge_runner.rb
polytrix-0.1.0.pre lib/polytrix/runners/windows_challenge_runner.rb
polytrix-0.0.1 lib/polytrix/runners/windows_challenge_runner.rb