Sha256: e42c05cf0887f93cbe4b0690bd33b29ad91f88ed0c009db90d69a236b3430491

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'benchmark_driver/struct'

module BenchmarkDriver
  DefaultJob = ::BenchmarkDriver::Struct.new(
    :name,       # @param [String] name - This is mandatory for all runner
    :metrics,    # @param [Array<BenchmarkDriver::Metric>] - This is mandatory for all runner too, set by job parser.
    :script,     # @param [String] benchmark
    :prelude,    # @param [String,nil] prelude (optional)
    :teardown,   # @param [String,nil] after (optional)
    :loop_count, # @param [Integer,nil] loop_count (optional)
    :required_ruby_version, # @param [String,nil] required_ruby_version (optional)
    defaults: { prelude: '', teardown: '' },
  ) do
    def runnable_execs(executables)
      if required_ruby_version
        executables.select do |executable|
          Gem::Version.new(executable.version) >= Gem::Version.new(required_ruby_version)
        end.tap do |result|
          if result.empty?
            raise "No Ruby executables conforming required_ruby_version (#{required_ruby_version}) are specified"
          end
        end
      else
        executables
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark_driver-0.12.0 lib/benchmark_driver/default_job.rb