Class: Leeloo::PrivateLocalFileSystemKeystore
Instance Attribute Summary collapse
Attributes inherited from Keystore
#name
Instance Method Summary
collapse
Methods inherited from Keystore
#init, #sync
Constructor Details
Returns a new instance of PrivateLocalFileSystemKeystore.
63
64
65
66
67
|
# File 'lib/leeloo/keystore.rb', line 63
def initialize name, path
super name
@path = path
FileUtils.mkdir_p "#{@path}/secrets"
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
61
62
63
|
# File 'lib/leeloo/keystore.rb', line 61
def path
@path
end
|
Instance Method Details
#==(keystore) ⇒ Object
82
83
84
|
# File 'lib/leeloo/keystore.rb', line 82
def == keystore
self.name == keystore.name && self.path == keystore.path
end
|
#find_secrets(path) ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/leeloo/keystore.rb', line 73
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
|
#secret_from_name(name) ⇒ Object
91
92
93
|
# File 'lib/leeloo/keystore.rb', line 91
def secret_from_name name
secret_of "#{path}/secrets/#{name}"
end
|
#secret_of(path) ⇒ Object
86
87
88
89
|
# File 'lib/leeloo/keystore.rb', line 86
def secret_of path
name = path.gsub("#{@path}/secrets/", "")
LocalFileSystemSecret.new path, name
end
|
#secrets ⇒ Object
69
70
71
|
# File 'lib/leeloo/keystore.rb', line 69
def secrets
find_secrets "#{@path}/secrets"
end
|