Sha256: d179de42e3bfc710549f47e50256f7a5a96fd1bafe89fa822df9aa20cd2f7db4

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

class Jkr
  class Analysis
    def self.analyze(env, resultset_num)
      resultset_num = sprintf "%03d", resultset_num.to_i
      resultset_dir = Dir.glob(File.join(env.jkr_result_dir, resultset_num)+"*")
      if resultset_dir.size != 1
        raise RuntimeError.new "cannot specify resultset dir (#{resultset_dir.join(" ")})"
      end
      resultset_dir = resultset_dir.first

      plan_files = Dir.glob(File.join(resultset_dir, "*.plan"))
      if plan_files.size == 0
        raise RuntimeError.new "cannot find plan file"
      elsif plan_files.size > 1
        raise RuntimeError.new "there are two or more plan files"
      end
      plan_file_path = plan_files.first

      plan = Jkr::Plan.new(env, plan_file_path)

      Jkr::AnalysisUtils.define_analysis_utils(resultset_dir, plan)
      plan.analysis.call(plan)
      Jkr::AnalysisUtils.undef_analysis_utils(plan)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jkr-0.0.1 lib/jkr/analysis.rb