Sha256: d73148537a20c712c444cf477163dd910165e94406881362e7f4c9e49124187c

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

module Report

  class Json < Reporter
  
    def print(data)
      Dir.mkdir 'tmp' unless File.exist? 'tmp'
      Dir.mkdir ENV['ws.test.reports.path'] unless File.exist? ENV['ws.test.reports.path']
      
      file = "#{ENV['ws.test.reports.path']}/report.json"
      json = ((data.nil?) ? {} : data.to_hash.to_json)
      File.open(file, 'w') {|file| file.write json }
      
      puts " -- JSON report saved to #{file}" unless ENV['ENVIRONMENT'] == 'test'
      file
    end
  
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
theotokos-0.1.1 lib/report/json.rb