Sha256: e6e77ca5915ceade8c0c1ebf770adcd74ff2b451deb188e075ae06d667cdd233

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

# -*- mode: ruby -*-

TERMWIDTH = 80

title "Default experiment plan"
description "This is a default experiment plan specification file."

def_parameters do
  # use 'variable' for defining variables
  variable :foo => ["fooA", "fooB"]
  variable :bar => 1..5

  # use 'parameter' for defining static parameters
  parameter :baz => "baz"
end

# preparation
def_prep do |plan|
  puts '*' * TERMWIDTH
  puts "Start execution: #{plan.title}"
end

# routine executed for each combination of values of variables
def_routine do |plan, params|
  puts '-' * TERMWIDTH

  # the value of "parameter/variable :foo" can be obtained by
  # "param[:foo]"
  puts "hello world, #{params[:foo]}"
  puts "hello world, #{params[:bar]}"

  puts(params[:foo] + params[:baz])

  touch = touch_result_file("touched-file.log")

  with_result_file("test.log") do |test_log|
    test_log.puts "hello world, #{params[:foo]}"
    test_log.puts "hello world, #{params[:bar]}"
    test_log.puts(params[:foo] + params[:baz])
    [$stdout, test_log].map{|io| io.puts "touched #{touch}"}
  end

  puts '-' * TERMWIDTH
end

# cleanup
def_cleanup do |plan|
  puts '*' * TERMWIDTH
  puts "Finished execution: #{plan.title}"
  puts "FileUtils.remove(#{plan.file_path.inspect})"
  # FileUtils.remove(plan.file_path)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jkr-0.2.2 sample-jkr.plan
jkr-0.2.1 sample-jkr.plan
jkr-0.1.0 sample-jkr.plan