Method: PostRunner::FitFileStore#restore

Defined in:
lib/postrunner/FitFileStore.rb

#restoreObject

Setup non-persistent variables.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/postrunner/FitFileStore.rb', line 45

def restore
  @data_dir = @store['config']['data_dir']
  # Ensure that we have an Array in the store to hold all known devices.
  @store['devices'] = @store.new(PEROBS::Hash) unless @store['devices']

  @devices_dir = File.join(@data_dir, 'devices')
  # It's generally not a good idea to store absolute file names in the
  # database. We'll make an exception here as this is the only way to
  # propagate this path to FFS_Activity or FFS_Monitoring objects. The
  # store entry is updated on each program run, so the DB can be moved
  # safely to another directory.
  @store['config']['devices_dir'] = @devices_dir
  create_directory(@devices_dir, 'devices')
  unless @store['fit_file_md5sums']
    @store['fit_file_md5sums'] = @store.new(PEROBS::Array)
  end

  # Define which View objects the HTML output will consist of. This
  # doesn't really belong in this class but for now it's the best place
  # to put it.
  @views = ViewButtons.new([
    NavButtonDef.new('activities.png', 'index.html'),
    NavButtonDef.new('record.png', "records-0.html")
  ])
end