Class: MGit::AppData::LegacyAppData

Inherits:
AppDataVersion show all
Defined in:
lib/mgit/appdata.rb

Overview

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

Instance Method Summary collapse

Methods inherited from AppDataVersion

#<=>, active, inherited, latest, sorted, updates

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/mgit/appdata.rb', line 75

def active?
  File.file?(repofile)
end

#load(key, default) ⇒ Object



83
84
85
86
87
# 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) ⇒ Object



89
90
91
92
# 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!Object



79
80
81
# File 'lib/mgit/appdata.rb', line 79

def setup!
  FileUtils.touch(repofile)
end

#versionObject



71
72
73
# File 'lib/mgit/appdata.rb', line 71

def version
  0
end