module CityUTC::Sqlite

Private Class Methods

connect_to_db() click to toggle source
# File sources/city_utc/sqlite.rb, line 22
def self.connect_to_db # no-doc
  path_to_database = File.join(__dir__, '..', 'database', 'sqlite.db')

  Sequel.connect "sqlite://#{path_to_database}"
end
restorable?() click to toggle source
# File sources/city_utc/sqlite.rb, line 14
def self.restorable?  # no-doc
  path_to_archive  = File.join(__dir__, '..', 'database', 'sqlite.db.gz')
  path_to_database = File.join(__dir__, '..', 'database', 'sqlite.db')

  File.exist?(path_to_archive) && !File.exist?(path_to_database)
end
restore_database() click to toggle source
# File sources/city_utc/sqlite.rb, line 6
def self.restore_database # no-doc
  path_to_folder = File.join(__dir__, "..", "database")
  path_to_archive = File.join(path_to_folder, 'sqlite.db.gz')

  `gzip -d #{path_to_archive}`
end