class MGit::AppData::LegacyAppData

Original version, plain YAML file containing the repositories hash. #

Public Instance Methods

active?() click to toggle source
# File lib/mgit/appdata.rb, line 75
def active?
  File.file?(repofile)
end
load(key, default) click to toggle source
# File lib/mgit/appdata.rb, line 83
def load(key, default)
  fail ImplementationError, "LegacyAppData::load called with unknown key #{key}." if key != :repositories
  repos = YAML.load_file(repofile)
  repos ? repos : default
end
save!(key, value) click to toggle source
# File lib/mgit/appdata.rb, line 89
def save!(key, value)
  fail ImplementationError, "LegacyAppData::save! called with unknown key #{key}." if key != :repositories
  File.open(repofile, 'w') { |fd| fd.write value.to_yaml }
end
setup!() click to toggle source
# File lib/mgit/appdata.rb, line 79
def setup!
  FileUtils.touch(repofile)
end
version() click to toggle source
# File lib/mgit/appdata.rb, line 71
def version
  0
end

Private Instance Methods

repofile() click to toggle source
# File lib/mgit/appdata.rb, line 96
def repofile
  XDG['CONFIG_HOME'].to_path.join('mgit.yml')
end