class Leeloo::PrivateLocalFileSystemPreferences
Constants
- DEFAULT_PATH
Public Instance Methods
add_keystore(keystore)
click to toggle source
Calls superclass method
Leeloo::Preferences#add_keystore
# File lib/leeloo/preferences.rb, line 87 def add_keystore keystore super keystore FileUtils.mkdir_p keystore["path"] File.write("#{@path}/keystores", @keystores.to_yaml) end
keystore_of(name)
click to toggle source
# File lib/leeloo/preferences.rb, line 74 def keystore_of name keystore = @keystores.find { |keystore| keystore["name"] == name } KeystoreFactory::create keystore end
load(path=DEFAULT_PATH)
click to toggle source
# File lib/leeloo/preferences.rb, line 49 def load(path=DEFAULT_PATH) @path = path if File.exist? "#{path}/keystores" @keystores = YAML.load_file "#{path}/keystores" end if File.exist? "#{path}/config" config = YAML.load_file "#{path}/config" set_default_keystore config["keystore"] else default_keystore = { 'name' => "private", 'path' => "#{path}/private", 'cypher' => "gpg", 'vc' => "git" } add_keystore default_keystore set_default_keystore "private" keystore_of("private").init end self end
remove_keystore(name)
click to toggle source
Calls superclass method
Leeloo::Preferences#remove_keystore
# File lib/leeloo/preferences.rb, line 93 def remove_keystore name super name File.write("#{@path}/keystores", @keystores.to_yaml) end
set_default_keystore(name)
click to toggle source
Calls superclass method
Leeloo::Preferences#set_default_keystore
# File lib/leeloo/preferences.rb, line 79 def set_default_keystore name super name config = { "keystore" => name } File.write("#{@path}/config", config.to_yaml) end