Class: Leeloo::GitKeystoreDecorator
- Defined in:
- lib/leeloo/keystore.rb
Instance Method Summary collapse
- #add_key(email) ⇒ Object
- #footprint_of(element) ⇒ Object
- #init ⇒ Object
-
#initialize(keystore) ⇒ GitKeystoreDecorator
constructor
A new instance of GitKeystoreDecorator.
- #keys ⇒ Object
- #name ⇒ Object
- #path ⇒ Object
- #remove_key(email) ⇒ Object
- #secret_from_footprint(footprint) ⇒ Object
- #secret_from_name(element) ⇒ Object
- #secret_of(element) ⇒ Object
- #secrets ⇒ Object
- #sync ⇒ Object
Methods inherited from Keystore
Constructor Details
#initialize(keystore) ⇒ GitKeystoreDecorator
Returns a new instance of GitKeystoreDecorator.
191 192 193 194 195 |
# File 'lib/leeloo/keystore.rb', line 191 def initialize keystore @keystore = keystore Git.init @keystore.path @git = Git.open keystore.path end |
Instance Method Details
#add_key(email) ⇒ Object
209 210 211 212 213 214 |
# File 'lib/leeloo/keystore.rb', line 209 def add_key email @keystore.add_key(email).each do |path| @git.add path @git.commit "#{email} added" end end |
#footprint_of(element) ⇒ Object
236 237 238 |
# File 'lib/leeloo/keystore.rb', line 236 def footprint_of element @keystore.footprint_of element end |
#init ⇒ Object
250 251 252 253 254 |
# File 'lib/leeloo/keystore.rb', line 250 def init @keystore.init @git.add @git.commit "keystore #{@keystore.name} added" end |
#keys ⇒ Object
205 206 207 |
# File 'lib/leeloo/keystore.rb', line 205 def keys @keystore.keys end |
#name ⇒ Object
228 229 230 |
# File 'lib/leeloo/keystore.rb', line 228 def name @keystore.name end |
#path ⇒ Object
232 233 234 |
# File 'lib/leeloo/keystore.rb', line 232 def path @keystore.path end |
#remove_key(email) ⇒ Object
216 217 218 219 220 221 222 |
# File 'lib/leeloo/keystore.rb', line 216 def remove_key email deleted = @keystore.remove_key email if deleted @git.add deleted @git.commit "#{email} removed" end end |
#secret_from_footprint(footprint) ⇒ Object
240 241 242 |
# File 'lib/leeloo/keystore.rb', line 240 def secret_from_footprint footprint @keystore.secret_from_footprint footprint end |
#secret_from_name(element) ⇒ Object
201 202 203 |
# File 'lib/leeloo/keystore.rb', line 201 def secret_from_name element secret_of @keystore.secret_from_name(element) end |
#secret_of(element) ⇒ Object
197 198 199 |
# File 'lib/leeloo/keystore.rb', line 197 def secret_of element GitSecretDecorator.new(@git, element) end |
#secrets ⇒ Object
224 225 226 |
# File 'lib/leeloo/keystore.rb', line 224 def secrets @keystore.secrets end |
#sync ⇒ Object
244 245 246 247 248 |
# File 'lib/leeloo/keystore.rb', line 244 def sync @git.pull @keystore.sync @git.push end |