Module: Fiveruns::Tuneup::Runs

Included in:
Fiveruns::Tuneup
Defined in:
lib/fiveruns/tuneup/runs.rb

Instance Method Summary collapse

Instance Method Details

#last_filename_for_run_uri(uri) ⇒ Object



24
25
26
# File 'lib/fiveruns/tuneup/runs.rb', line 24

def last_filename_for_run_uri(uri)
  filename_for(last_run_id_for(uri))
end

#last_runObject



28
29
30
31
# File 'lib/fiveruns/tuneup/runs.rb', line 28

def last_run
  last_file = sorted_run_files.last
  load_from_file(last_file)
end

#load_from_file(filename) ⇒ Object



19
20
21
22
# File 'lib/fiveruns/tuneup/runs.rb', line 19

def load_from_file(filename)
  decompressed = Zlib::Inflate.inflate(File.open(filename, 'rb') { |f| f.read })        
  YAML.load(decompressed)
end

#retrieve_run(run_id) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fiveruns/tuneup/runs.rb', line 9

def retrieve_run(run_id)
  filename = filename_for(run_id)
  if File.file?(filename)
    load_from_file(filename)
  else
    log :error, "Couldn't find filename: #{filename}"
    nil
  end
end

#run_dirObject



5
6
7
# File 'lib/fiveruns/tuneup/runs.rb', line 5

def run_dir
  @run_dir ||= File.join(RAILS_ROOT, 'tmp', 'tuneup', 'runs', RAILS_ENV)
end