class Leeloo::PrivateLocalFileSystemKeystore
Attributes
path[R]
Public Class Methods
new(name, path)
click to toggle source
Calls superclass method
Leeloo::Keystore::new
# File lib/leeloo/keystore.rb, line 72 def initialize name, path super name @path = path FileUtils.mkdir_p "#{@path}/secrets" end
Public Instance Methods
==(keystore)
click to toggle source
# File lib/leeloo/keystore.rb, line 91 def == keystore self.name == keystore.name && self.path == keystore.path end
find_secrets(path)
click to toggle source
# File lib/leeloo/keystore.rb, line 82 def find_secrets path elements = [] Dir.glob("#{path}/**") do |element| elements << secret_of(element) unless Dir.exist? element elements << find_secrets(element) if Dir.exist? element end return elements.flatten end
footprint_of(name)
click to toggle source
# File lib/leeloo/keystore.rb, line 104 def footprint_of name secret = secret_from_name name { "footprint" => secret.footprint, "keystore" => self.name, "secret" => secret.name } end
secret_from_footprint(footprint)
click to toggle source
# File lib/leeloo/keystore.rb, line 109 def secret_from_footprint footprint secret = secret_from_name footprint["secret"] unless secret.footprint == footprint["footprint"] raise "footprint is not valid" end secret end
secret_from_name(name)
click to toggle source
# File lib/leeloo/keystore.rb, line 100 def secret_from_name name secret_of "#{path}/secrets/#{name}" end
secret_of(path)
click to toggle source
# File lib/leeloo/keystore.rb, line 95 def secret_of path name = path.gsub("#{@path}/secrets/", "") LocalFileSystemSecret.new path, name end
secrets()
click to toggle source
# File lib/leeloo/keystore.rb, line 78 def secrets find_secrets "#{@path}/secrets" end