Sha256: 49e592f30ff0dc2ec4bc2b1d9d929269b4e813db61c6e2d7aa5221c810b7fa05

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

module Specimen
  module Command
    class TestRunner < BaseGroup
      class ProfileDataNilError < RuntimeError
        def initialize(profile_name, yml_name)
          @msg = "No data found in '#{yml_name}' for profile: '#{profile_name}'"
          super(@msg)
        end
      end

      class_option :tags, aliases: ['-t'], type: :string, repeatable: true, default: []
      class_option :debug, type: :boolean, default: false
      class_option :verbose, type: :boolean, default: false

      no_commands do
        def perform
          runtime.set_testrunner!(specimen_config, specimen_profile, self)

          inside runtime.wd_path do
            ENV['SPECIMEN_CONFIG_NAME'] = runtime.specimen_config
            ENV['SPECIMEN_PROFILE_NAME'] = runtime.specimen_profile

            ENV['DEBUG'] = 'true' if options[:debug]
            ENV['VERBOSE'] = 'true' if options[:verbose]

            @success = run(exec_cmd)
          end

          @success == true ? exit(0) : exit(1)
        end

        def runtime
          Specimen.runtime
        end

        def specimen_config
          options[:specimen_config]
        end

        def specimen_profile
          options[:specimen_profile]
        end

        def exec_cmd
          ExecCommandBuilder.build_exec_cmd!
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specimen-0.0.4.alpha lib/specimen/command/test_runner.rb