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.
192 193 194 195 196 |
# File 'lib/leeloo/keystore.rb', line 192 def initialize keystore @keystore = keystore Git.init @keystore.path @git = Git.open keystore.path end |
Instance Method Details
#add_key(email) ⇒ Object
210 211 212 213 214 215 |
# File 'lib/leeloo/keystore.rb', line 210 def add_key email @keystore.add_key(email).each do |path| @git.add path @git.commit "#{email} added" end end |
#footprint_of(element) ⇒ Object
237 238 239 |
# File 'lib/leeloo/keystore.rb', line 237 def footprint_of element @keystore.footprint_of element end |
#init ⇒ Object
251 252 253 254 255 |
# File 'lib/leeloo/keystore.rb', line 251 def init @keystore.init @git.add @git.commit "keystore #{@keystore.name} added" end |
#keys ⇒ Object
206 207 208 |
# File 'lib/leeloo/keystore.rb', line 206 def keys @keystore.keys end |
#name ⇒ Object
229 230 231 |
# File 'lib/leeloo/keystore.rb', line 229 def name @keystore.name end |
#path ⇒ Object
233 234 235 |
# File 'lib/leeloo/keystore.rb', line 233 def path @keystore.path end |
#remove_key(email) ⇒ Object
217 218 219 220 221 222 223 |
# File 'lib/leeloo/keystore.rb', line 217 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
241 242 243 |
# File 'lib/leeloo/keystore.rb', line 241 def secret_from_footprint footprint @keystore.secret_from_footprint footprint end |
#secret_from_name(element) ⇒ Object
202 203 204 |
# File 'lib/leeloo/keystore.rb', line 202 def secret_from_name element secret_of @keystore.secret_from_name(element) end |
#secret_of(element) ⇒ Object
198 199 200 |
# File 'lib/leeloo/keystore.rb', line 198 def secret_of element GitSecretDecorator.new(@git, element) end |
#secrets ⇒ Object
225 226 227 |
# File 'lib/leeloo/keystore.rb', line 225 def secrets @keystore.secrets end |
#sync ⇒ Object
245 246 247 248 249 |
# File 'lib/leeloo/keystore.rb', line 245 def sync @git.pull @keystore.sync @git.push end |