kbsecret 0.7.0.pre.1 → 0.7.0.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kbsecret.rb +1 -1
- data/lib/kbsecret/config.rb +81 -81
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 880375c3b35cffd81cc94adba77037fb59fdbeaa
|
4
|
+
data.tar.gz: 05c2e322dfe48b7fa3b526b32c7233d6778c0651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33a12d9bc5c28081e036a546ee05256dadfde708fe6dafd9ad211174cbf97f5efdd455e36f0b2d3a479a42aa4a46e920d88878c78bdab6bf461642032c8295d8
|
7
|
+
data.tar.gz: a068a60e73e107793ffee460cc86524f701a87dae2b4a987789f1d5f9c882a9a4284fd95b9dc532284f5c2769a15019b37cb5bb728fa640f9184252b72cbfe49
|
data/lib/kbsecret.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require "keybase"
|
4
4
|
|
5
5
|
require_relative "version"
|
6
|
-
require_relative "kbsecret/config"
|
7
6
|
require_relative "kbsecret/exceptions"
|
7
|
+
require_relative "kbsecret/config"
|
8
8
|
require_relative "kbsecret/record"
|
9
9
|
require_relative "kbsecret/session"
|
10
10
|
require_relative "kbsecret/generator"
|
data/lib/kbsecret/config.rb
CHANGED
@@ -14,6 +14,20 @@ module KBSecret
|
|
14
14
|
# @api private
|
15
15
|
CONFIG_FILE = File.join(CONFIG_DIR, "config.yml").freeze
|
16
16
|
|
17
|
+
# Configuration facets used for method generation.
|
18
|
+
# @api private
|
19
|
+
CONFIG_FACETS = {
|
20
|
+
session: {
|
21
|
+
plural: :sessions,
|
22
|
+
except: SessionUnknownError,
|
23
|
+
},
|
24
|
+
|
25
|
+
generator: {
|
26
|
+
plural: :generators,
|
27
|
+
except: GeneratorUnknownError,
|
28
|
+
},
|
29
|
+
}.freeze
|
30
|
+
|
17
31
|
# The default session configuration.
|
18
32
|
DEFAULT_SESSION = {
|
19
33
|
default: {
|
@@ -55,87 +69,73 @@ module KBSecret
|
|
55
69
|
@config[key]
|
56
70
|
end
|
57
71
|
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
#
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
#
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
# @param label [String, Symbol] the generator label (profile name)
|
126
|
-
# @param hsh [Hash] the generator configuration
|
127
|
-
# @return [void]
|
128
|
-
def self.configure_generator(label, **hsh)
|
129
|
-
@config[:generators][label.to_sym] = hsh
|
130
|
-
sync!
|
131
|
-
end
|
132
|
-
|
133
|
-
# Deconfigure a generator.
|
134
|
-
# @param label [String, Symbol] the generator label (profile name)
|
135
|
-
# @return [void]
|
136
|
-
def self.deconfigure_generator(label)
|
137
|
-
@config[:generators].delete(label.to_sym)
|
138
|
-
sync!
|
72
|
+
# @!method session
|
73
|
+
# Retrieve a session's configuration.
|
74
|
+
# @param label [String, Symbol] the session's label
|
75
|
+
# @return [Hash] the session configuration
|
76
|
+
# @raise [SessionUnknownError] if no such session exists
|
77
|
+
# @!method session_labels
|
78
|
+
# @return [Array<Symbol>] all configured session labels
|
79
|
+
# @!method session?
|
80
|
+
# @param label [String, Symbol] the session label
|
81
|
+
# @return [Boolean] whether or not the given session is configured
|
82
|
+
# @!method configure_session
|
83
|
+
# Configure a session.
|
84
|
+
# @param label [String, Symbol] the session label
|
85
|
+
# @param hsh [Hash] the session configuration
|
86
|
+
# @return [void]
|
87
|
+
# @!method deconfigure_session
|
88
|
+
# Deconfigure a session.
|
89
|
+
# @param label [String, Symbol] the session label
|
90
|
+
# @return [void]
|
91
|
+
# @note This only removes the given session from the configuration, making
|
92
|
+
# it "invisible" to `kbsecret`. To actually remove all files associated
|
93
|
+
# with a session, see {KBSecret::Session#unlink!}.
|
94
|
+
# @!method generator
|
95
|
+
# Retrieve a generator's configuration.
|
96
|
+
# @param gen [String, Symbol] the generator's label
|
97
|
+
# @return [Hash] the generator configuration
|
98
|
+
# @raise [GeneratorUnknownError] if no such generator exists
|
99
|
+
# @!method generator_labels
|
100
|
+
# @return [Array<Symbol>] all configured session labels
|
101
|
+
# @!method generator?
|
102
|
+
# @param gen [String, Symbol] the generator label
|
103
|
+
# @return [Boolean] whether or not the given generator is configured
|
104
|
+
# @!method configure_generator
|
105
|
+
# Configure a secret generator.
|
106
|
+
# @param label [String, Symbol] the generator label (profile name)
|
107
|
+
# @param hsh [Hash] the generator configuration
|
108
|
+
# @return [void]
|
109
|
+
# @!method deconfigure_generator
|
110
|
+
# Deconfigure a generator.
|
111
|
+
# @param label [String, Symbol] the generator label (profile name)
|
112
|
+
# @return [void]
|
113
|
+
CONFIG_FACETS.each do |facet, data|
|
114
|
+
define_singleton_method facet do |label|
|
115
|
+
hsh = @config[data[:plural]][label.to_sym]
|
116
|
+
|
117
|
+
raise data[:except], label unless hsh
|
118
|
+
|
119
|
+
hsh
|
120
|
+
end
|
121
|
+
|
122
|
+
define_singleton_method "#{facet}_labels" do
|
123
|
+
@config[data[:plural]].keys
|
124
|
+
end
|
125
|
+
|
126
|
+
define_singleton_method "#{facet}?" do |label|
|
127
|
+
@config[data[:plural]].keys.include? label.to_sym
|
128
|
+
end
|
129
|
+
|
130
|
+
define_singleton_method "configure_#{facet}" do |label, **hsh|
|
131
|
+
@config[data[:plural]][label.to_sym] = hsh
|
132
|
+
sync!
|
133
|
+
end
|
134
|
+
|
135
|
+
define_singleton_method "deconfigure_#{facet}" do |label|
|
136
|
+
@config[data[:plural]].delete(label.to_sym)
|
137
|
+
sync!
|
138
|
+
end
|
139
139
|
end
|
140
140
|
|
141
141
|
if File.exist?(CONFIG_FILE)
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kbsecret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.pre.
|
4
|
+
version: 0.7.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fpm
|