kbsecret 0.7.0.pre.3 → 0.7.0
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/record/abstract.rb +10 -0
- data/lib/kbsecret/record/environment.rb +0 -8
- data/lib/kbsecret/record/login.rb +0 -8
- data/lib/kbsecret/record/snippet.rb +0 -8
- data/lib/kbsecret/record/todo.rb +4 -5
- data/lib/kbsecret/record/unstructured.rb +0 -7
- data/lib/kbsecret/session.rb +4 -2
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4688af12e409cc9c13577ff5e2471773504790
|
4
|
+
data.tar.gz: d72010806cfb3e8f132b3aeae87f53664e34235a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c520121a121d1a83583391546502e7491a831d090cfb3edc968ec1a6205639f82cc954e0a9793f6b33764c7e5ee61d94c5d85ef3edab634e43efcaa3953d943e
|
7
|
+
data.tar.gz: 0bbbabee51ef4a1e2676b5251d25bce45157be2d3f69e9c4e34ba82c3cddba779a6b9c247a5f3576444711d8333ba824bacaffc49d1c5b603aa4db521082c7e9
|
@@ -128,6 +128,8 @@ module KBSecret
|
|
128
128
|
@type = self.class.type
|
129
129
|
@data = { @type => body }
|
130
130
|
@path = File.join(session.directory, "#{label}.json")
|
131
|
+
|
132
|
+
populate_internal_fields
|
131
133
|
end
|
132
134
|
|
133
135
|
# Fill in instance fields from a record's hash-representation.
|
@@ -178,6 +180,14 @@ module KBSecret
|
|
178
180
|
|
179
181
|
File.write(path, JSON.pretty_generate(to_h))
|
180
182
|
end
|
183
|
+
|
184
|
+
# Fill in any internal fields that require a default value.
|
185
|
+
# @return [void]
|
186
|
+
# @note This gets called at the end of {#initialize}, and should be overridden by children
|
187
|
+
# of {Abstract} if they need to modify their internal fields during initialization.
|
188
|
+
def populate_internal_fields
|
189
|
+
nil # stub
|
190
|
+
end
|
181
191
|
end
|
182
192
|
end
|
183
193
|
end
|
@@ -9,14 +9,6 @@ module KBSecret
|
|
9
9
|
data_field :variable, sensitive: false
|
10
10
|
data_field :value
|
11
11
|
|
12
|
-
# @param session [Session] the session to associate with
|
13
|
-
# @param label [Symbol] the new record's label
|
14
|
-
# @param variable [String] the new record's variable
|
15
|
-
# @param value [String] the new record's value
|
16
|
-
def initialize(session, label, variable, value)
|
17
|
-
super(session, label, variable: variable.shellescape, value: value.shellescape)
|
18
|
-
end
|
19
|
-
|
20
12
|
# @return [String] a sh-style environment assignment
|
21
13
|
def to_assignment
|
22
14
|
"#{variable}=#{value}"
|
@@ -6,14 +6,6 @@ module KBSecret
|
|
6
6
|
class Login < Abstract
|
7
7
|
data_field :username, sensitive: false
|
8
8
|
data_field :password
|
9
|
-
|
10
|
-
# @param session [Session] the session to associate with
|
11
|
-
# @param label [Symbol] the new record's label
|
12
|
-
# @param user [String] the new record's username
|
13
|
-
# @param pass [String] the new record's password
|
14
|
-
def initialize(session, label, user, pass)
|
15
|
-
super(session, label, username: user, password: pass)
|
16
|
-
end
|
17
9
|
end
|
18
10
|
end
|
19
11
|
end
|
@@ -6,14 +6,6 @@ module KBSecret
|
|
6
6
|
class Snippet < Abstract
|
7
7
|
data_field :code, sensitive: false
|
8
8
|
data_field :description, sensitive: false
|
9
|
-
|
10
|
-
# @param session [Session] the session to associate with
|
11
|
-
# @param label [Symbol] the new record's label
|
12
|
-
# @param code [String] the code
|
13
|
-
# @param description [String] a description of the code
|
14
|
-
def initialize(session, label, code, description)
|
15
|
-
super(session, label, code: code, description: description)
|
16
|
-
end
|
17
9
|
end
|
18
10
|
end
|
19
11
|
end
|
data/lib/kbsecret/record/todo.rb
CHANGED
@@ -21,11 +21,10 @@ module KBSecret
|
|
21
21
|
data_field :start, sensitive: false, internal: true
|
22
22
|
data_field :stop, sensitive: false, internal: true
|
23
23
|
|
24
|
-
# @
|
25
|
-
# @
|
26
|
-
|
27
|
-
|
28
|
-
super(session, label, todo: todo, status: "suspended", start: nil, stop: nil)
|
24
|
+
# @return [void]
|
25
|
+
# @see Abstract#populate_internal_fields
|
26
|
+
def populate_internal_fields
|
27
|
+
self.status = "suspended"
|
29
28
|
end
|
30
29
|
|
31
30
|
# @return [Boolean] whether or not the item is marked as started
|
@@ -5,13 +5,6 @@ module KBSecret
|
|
5
5
|
# Represents a record containing unstructured text.
|
6
6
|
class Unstructured < Abstract
|
7
7
|
data_field :text, sensitive: false
|
8
|
-
|
9
|
-
# @param session [Session] the session to associate with
|
10
|
-
# @param label [Symbol] the new record's label
|
11
|
-
# @param text [String] the new record's unstructured text
|
12
|
-
def initialize(session, label, text)
|
13
|
-
super(session, label, text: text)
|
14
|
-
end
|
15
8
|
end
|
16
9
|
end
|
17
10
|
end
|
data/lib/kbsecret/session.rb
CHANGED
@@ -63,11 +63,13 @@ module KBSecret
|
|
63
63
|
# arguments does not match the record type's constructor
|
64
64
|
def add_record(type, label, *args)
|
65
65
|
klass = Record.class_for(type.to_sym)
|
66
|
-
arity = klass.
|
66
|
+
arity = klass.external_fields.length
|
67
67
|
|
68
68
|
raise RecordCreationArityError.new(arity, args.size) unless arity == args.size
|
69
69
|
|
70
|
-
|
70
|
+
body = klass.external_fields.zip(args).to_h
|
71
|
+
record = klass.new(self, label.to_s, **body)
|
72
|
+
|
71
73
|
records << record
|
72
74
|
record.sync!
|
73
75
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kbsecret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
@@ -220,9 +220,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
220
220
|
version: 2.3.0
|
221
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
222
|
requirements:
|
223
|
-
- - "
|
223
|
+
- - ">="
|
224
224
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
225
|
+
version: '0'
|
226
226
|
requirements: []
|
227
227
|
rubyforge_project:
|
228
228
|
rubygems_version: 2.6.11
|