leeloo 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/leeloo/command.rb +7 -2
- data/lib/leeloo/config.rb +10 -6
- data/lib/leeloo/secret.rb +10 -2
- data/lib/leeloo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce89a8b48445f8a5afe2487a5ed49a8d0c3ec44c
|
4
|
+
data.tar.gz: 268ef25fd70970d0d19e0426b062ed104d0ae362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6038afa0d03ed117af88448ed7d234e60f3a16804c02ca5261f431671da6f134cfad761bcb31e98b6d8c782775b74ba2cbcc40ab5cc7eaf4a217bcc282d96b4f
|
7
|
+
data.tar.gz: 3cb154d289f0f9a97641c2a4a480de6963ed784642372501dbafe56181655d3c88f5c4c088c9494f7f4702a29a11578e743e471fa1f8912df2e07af5be3cb5c9
|
data/lib/leeloo/command.rb
CHANGED
@@ -32,9 +32,11 @@ module Leeloo
|
|
32
32
|
command :"list-keystore" do |c|
|
33
33
|
c.syntax = 'leeloo list'
|
34
34
|
c.description = "Display keystores list"
|
35
|
+
c.option '--ascii', nil, 'display secrets without unicode tree'
|
36
|
+
|
35
37
|
c.action do |args, options|
|
36
38
|
|
37
|
-
Config::list_keystores
|
39
|
+
Config::list_keystores options.ascii
|
38
40
|
end
|
39
41
|
end
|
40
42
|
alias_command :keystore, :"list-keystore"
|
@@ -43,13 +45,16 @@ module Leeloo
|
|
43
45
|
c.syntax = 'leeloo list secret [options]'
|
44
46
|
c.description = "Display secrets list of keystore"
|
45
47
|
c.option '--keystore STRING', String, 'a selected keystore'
|
48
|
+
c.option '--ascii', nil, 'display secrets without unicode tree'
|
46
49
|
|
47
50
|
c.action do |args, options|
|
48
51
|
options.default :keystore => Config.default['keystore']
|
49
|
-
|
52
|
+
|
53
|
+
Secret::list Config.get_keystore(options.keystore), options.ascii
|
50
54
|
end
|
51
55
|
end
|
52
56
|
alias_command :list, :"list-secret"
|
57
|
+
alias_command :secrets, :"list-secret"
|
53
58
|
|
54
59
|
command :"add-keystore" do |c|
|
55
60
|
c.syntax = 'leeloo add keystore <name> <path>'
|
data/lib/leeloo/config.rb
CHANGED
@@ -19,13 +19,17 @@ module Leeloo
|
|
19
19
|
Config::add_keystore "private", "#{PATH}/private"
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.list_keystores
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
rows
|
22
|
+
def self.list_keystores(ascii)
|
23
|
+
if ascii
|
24
|
+
@@keystores.each { |keystore| puts keystore['name'] }
|
25
|
+
else
|
26
|
+
rows = []
|
27
|
+
@@keystores.each do |keystore|
|
28
|
+
is_default = '*' if keystore['name'] == @@default['keystore']
|
29
|
+
rows << [keystore['name'], keystore['path'], is_default ]
|
30
|
+
end
|
31
|
+
say Terminal::Table.new :headings => ['Name', 'Path', 'Default'], :rows => rows
|
27
32
|
end
|
28
|
-
say Terminal::Table.new :headings => ['Name', 'Path', 'Default'], :rows => rows
|
29
33
|
end
|
30
34
|
|
31
35
|
def self.load
|
data/lib/leeloo/secret.rb
CHANGED
@@ -4,10 +4,18 @@ require 'git'
|
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
6
|
module Leeloo
|
7
|
+
|
7
8
|
class Secret
|
8
9
|
|
9
|
-
def self.list(keystore)
|
10
|
-
|
10
|
+
def self.list(keystore, ascii)
|
11
|
+
if ascii
|
12
|
+
secrets = Dir.glob("#{keystore}/secrets/**/*.gpg")
|
13
|
+
.sort
|
14
|
+
.reject { |path| File.directory? path }
|
15
|
+
.each { |secret| puts secret.gsub(/#{keystore}\/secrets\//, '').gsub(/\.gpg/, '') }
|
16
|
+
else
|
17
|
+
puts TTY::Tree.new("#{keystore}/secrets").render.gsub(/\.gpg/, '')
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
def self.add_secret(keystore, name, secret)
|
data/lib/leeloo/version.rb
CHANGED