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)


77
78
79
# File 'lib/mgit/appdata.rb', line 77

def active?
  File.file?(repofile)
end

#load(key, default) ⇒ Object



85
86
87
88
89
# File 'lib/mgit/appdata.rb', line 85

def load(key, default)
  raise ImplementationError.new("LegacyAppData::load called with unknown key #{key}.") if key != :repositories
  repos = YAML.load_file(repofile)
  repos ? repos : default
end

#save!(key, value) ⇒ Object



91
92
93
94
# File 'lib/mgit/appdata.rb', line 91

def save!(key, value)
  raise ImplementationError.new("LegacyAppData::save! called with unknown key #{key}.") if key != :repositories
  File.open(repofile, 'w') { |fd| fd.write value.to_yaml }
end

#setup!Object



81
82
83
# File 'lib/mgit/appdata.rb', line 81

def setup!
  FileUtils.touch(repofile)
end

#versionObject



73
74
75
# File 'lib/mgit/appdata.rb', line 73

def version
  0
end