secret_hub 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/secret_hub/commands/bulk.rb +19 -12
- data/lib/secret_hub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba608183188fcc510b16eebb1b02a0a426c69e638f52656c64335ec467ea5042
|
4
|
+
data.tar.gz: 78788d64bdbe84fa632fd2d0fd675622b01fd953ccc1c8c3f2787d4106c2a112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae95b5ab77f112281debf4a46194aad8aad1fedfd71bcd78c64913a2d8a98b695099a6aceb8b83c3a7096896d3e9487a687cb910c6b3be1a72016cc6127efd4
|
7
|
+
data.tar.gz: 44f948f6467d1d6207204d63bd898603dba654ed298c9af3e2fe91531d844e27b086715158b43fc084efea5f8f11052685a6ef4ba1a6c54dba5b94bbdd9de405
|
@@ -11,8 +11,8 @@ module SecretHub
|
|
11
11
|
usage "secrethub bulk init [CONFIG]"
|
12
12
|
usage "secrethub bulk show [CONFIG --visible]"
|
13
13
|
usage "secrethub bulk list [CONFIG]"
|
14
|
-
usage "secrethub bulk save [CONFIG --clean]"
|
15
|
-
usage "secrethub bulk clean [CONFIG]"
|
14
|
+
usage "secrethub bulk save [CONFIG --clean --dry]"
|
15
|
+
usage "secrethub bulk clean [CONFIG --dry]"
|
16
16
|
usage "secrethub bulk (-h|--help)"
|
17
17
|
|
18
18
|
command "init", "Create a sample configuration file in the current directory"
|
@@ -23,6 +23,7 @@ module SecretHub
|
|
23
23
|
|
24
24
|
option "-c, --clean", "Also delete any other secret not defined in the configuration file"
|
25
25
|
option "-v, --visible", "Also show secret values"
|
26
|
+
option "-d, --dry", "Dry run"
|
26
27
|
|
27
28
|
param "CONFIG", "Path to the configuration file [default: secrethub.yml]"
|
28
29
|
|
@@ -30,7 +31,7 @@ module SecretHub
|
|
30
31
|
example "secrethub bulk show --visible"
|
31
32
|
example "secrethub bulk clean"
|
32
33
|
example "secrethub bulk list mysecrets.yml"
|
33
|
-
example "secrethub bulk save mysecrets.yml"
|
34
|
+
example "secrethub bulk save mysecrets.yml --dry"
|
34
35
|
example "secrethub bulk save --clean"
|
35
36
|
|
36
37
|
def init_command
|
@@ -58,45 +59,51 @@ module SecretHub
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def save_command
|
61
|
-
|
62
|
+
dry = args['--dry']
|
62
63
|
skipped = 0
|
63
64
|
|
64
65
|
config.each do |repo, secrets|
|
65
66
|
say "!txtblu!#{repo}"
|
66
|
-
skipped += update_repo repo, secrets
|
67
|
-
clean_repo repo, secrets.keys if clean
|
67
|
+
skipped += update_repo repo, secrets, dry
|
68
|
+
clean_repo repo, secrets.keys, dry if args['--clean']
|
68
69
|
end
|
69
70
|
|
70
|
-
|
71
|
+
puts "\n" if skipped > 0 or dry
|
72
|
+
say "Skipped #{skipped} missing secrets" if skipped > 0
|
73
|
+
say "Dry run, nothing happened" if dry
|
71
74
|
end
|
72
75
|
|
73
76
|
def clean_command
|
77
|
+
dry = args['--dry']
|
78
|
+
|
74
79
|
config.each do |repo, secrets|
|
75
80
|
say "!txtblu!#{repo}"
|
76
|
-
clean_repo repo, secrets.keys
|
81
|
+
clean_repo repo, secrets.keys, dry
|
77
82
|
end
|
83
|
+
|
84
|
+
say "\nDry run, nothing happened" if dry
|
78
85
|
end
|
79
86
|
|
80
87
|
private
|
81
88
|
|
82
|
-
def clean_repo(repo, keys)
|
89
|
+
def clean_repo(repo, keys, dry)
|
83
90
|
repo_keys = github.secrets repo
|
84
91
|
delete_candidates = repo_keys - keys
|
85
92
|
|
86
93
|
delete_candidates.each do |key|
|
87
94
|
say "delete !txtpur!#{key} "
|
88
|
-
|
95
|
+
github.delete_secret repo, key unless dry
|
89
96
|
say "!txtgrn!OK"
|
90
97
|
end
|
91
98
|
end
|
92
99
|
|
93
|
-
def update_repo(repo, secrets)
|
100
|
+
def update_repo(repo, secrets, dry)
|
94
101
|
skipped = 0
|
95
102
|
|
96
103
|
secrets.each do |key, value|
|
97
104
|
say "save !txtpur!#{key} "
|
98
105
|
if value
|
99
|
-
github.put_secret repo, key, value
|
106
|
+
github.put_secret repo, key, value unless dry
|
100
107
|
say "!txtgrn!OK"
|
101
108
|
else
|
102
109
|
say "!txtred!MISSING"
|
data/lib/secret_hub/version.rb
CHANGED