lib/transcriptic/cli.rb in transcriptic-0.2.3 vs lib/transcriptic/cli.rb in transcriptic-0.2.4

- old
+ new

@@ -119,11 +119,10 @@ def update require_labfile! output_with_arrow "Updating dependencies..." labfile = Transcriptic::Labfile.from_file(Transcriptic.find_labfile) Transcriptic::DependenciesGenerator.new([Dir.pwd, labfile.dependencies], options).invoke_all - Transcriptic::SBT.update end desc "compile", "Compile the project" def compile require_labfile! @@ -131,20 +130,23 @@ Transcriptic::SBT.compile end desc "analyze OBJECTPATH", "Analyze a protocol. Object path is of the form edu.foo.bar where bar is the name of your Protocol object." method_options :raw => :boolean, :iterations => :numeric, :linearize => :boolean - def analyze(object_path) + def analyze(object_path, *params) raw = options.raw ? "--raw" : "" linearize = options.linearize ? "--linearize" : "" iterations = options.iterations ? options.iterations : 5 require_labfile! update Transcriptic::SBT.stage - data = `target/start #{object_path} --verify #{raw} #{linearize} --iterations #{iterations}` + data = `target/start #{object_path} --verify #{raw} #{linearize} --iterations #{iterations} #{params.join(" ")}` if not options.raw + File.open("logs/#{object_path}", 'w') { |file| file.write(data) } + data = data.split("\n")[-1] json = json_decode(data) output_with_arrow "Verification successful for #{object_path}" + output_with_arrow "Logged output during verification to logs/#{object_path}" output_with_indent "Expected cost: $#{json["price_avg"]}, maximum observed cost: $#{json["price_max"]}" else say data end end