ruby-keepassx 0.2.1 → 0.2.2beta1
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/README.md +1 -2
- data/lib/keepassx.rb +1 -0
- data/lib/keepassx/database.rb +10 -2
- data/lib/keepassx/group.rb +3 -2
- data/lib/keepassx/utilities.rb +6 -4
- data/ruby-keepassx.gemspec +2 -2
- data/spec/keepassx/entry_spec.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 163fb7eb543e7245dc9810fbcbf6275b8e36476c
|
4
|
+
data.tar.gz: a9ce724799482165199926d416aee783b58d8346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d822481998706e868eedd5771dbe2f2e54b829b63824505663c16d2271296431a1ce0377f21c4f33eca4916d97e88981c69b577a670ae95f5d8f4aa7f1a31392
|
7
|
+
data.tar.gz: bd2fc142df812540c6fa022aeeee1fb71b1af6b8bd8e62fedb36f71908f758e70f9bbb8bd77575f182e416c9e40f1f7b64b6a8cb9e21846e90f30e7112ef4ea0
|
data/README.md
CHANGED
@@ -28,5 +28,4 @@ puts database.entry("entry's title").password
|
|
28
28
|
No attempt is made to protect the memory used by this library; there may be something we can do with libgcrypt's secure-malloc functions, but right now your master password is unencrypted in ram that could possibly be paged to disk.
|
29
29
|
|
30
30
|
|
31
|
-
[](https://travis-ci.org/tioteath/ruby-keepassx)
|
31
|
+
[](https://travis-ci.org/tioteath/ruby-keepassx)
|
data/lib/keepassx.rb
CHANGED
data/lib/keepassx/database.rb
CHANGED
@@ -11,7 +11,7 @@ module Keepassx
|
|
11
11
|
|
12
12
|
def self.open opts
|
13
13
|
path = opts.to_s
|
14
|
-
fail "File #{path} does not exist." unless File.exist? path
|
14
|
+
fail IOError, "File #{path} does not exist." unless File.exist? path
|
15
15
|
db = self.new path
|
16
16
|
return db unless block_given?
|
17
17
|
yield db
|
@@ -119,7 +119,7 @@ module Keepassx
|
|
119
119
|
items = item_list
|
120
120
|
|
121
121
|
else
|
122
|
-
opts = {:title => opts.to_s} if opts.is_a? String or opts.is_a? Symbol
|
122
|
+
opts = { :title => opts.to_s } if opts.is_a? String or opts.is_a? Symbol
|
123
123
|
|
124
124
|
match_number = opts.length
|
125
125
|
items = []
|
@@ -234,6 +234,7 @@ module Keepassx
|
|
234
234
|
opts = deep_copy opts
|
235
235
|
opts[:id] = next_group_id unless opts.has_key? :id
|
236
236
|
|
237
|
+
# Replace parent, which is specified by symbol with actual group
|
237
238
|
if opts[:parent].is_a? Symbol
|
238
239
|
group = self.group opts[:parent]
|
239
240
|
fail "Group #{opts[:parent].inspect} does not exist" if group.nil?
|
@@ -464,5 +465,12 @@ module Keepassx
|
|
464
465
|
result
|
465
466
|
end
|
466
467
|
|
468
|
+
|
469
|
+
# Dump YAML representation of database.
|
470
|
+
#
|
471
|
+
# @return [String]
|
472
|
+
def to_yaml
|
473
|
+
YAML.dump to_a
|
474
|
+
end
|
467
475
|
end
|
468
476
|
end
|
data/lib/keepassx/group.rb
CHANGED
@@ -92,11 +92,12 @@ module Keepassx
|
|
92
92
|
|
93
93
|
def parent= v
|
94
94
|
if v.is_a? Keepassx::Group
|
95
|
-
self.level = v.level + 1
|
95
|
+
self.level = v.level + 1
|
96
96
|
@parent = v
|
97
97
|
|
98
98
|
elsif v.nil?
|
99
|
-
|
99
|
+
# Assume, group is located at the top level, in case it has no parent
|
100
|
+
self.level = 0
|
100
101
|
|
101
102
|
else
|
102
103
|
fail "Expected Keepassx::Group, got #{v.class}"
|
data/lib/keepassx/utilities.rb
CHANGED
@@ -182,21 +182,23 @@ module Keepassx
|
|
182
182
|
# FIXME: Rename the method
|
183
183
|
# See spec/fixtures/test_data_array.yaml for data example
|
184
184
|
def parse_data_array opts
|
185
|
-
groups, entries = opts[:groups], opts[:entries]
|
185
|
+
groups, entries, parent = opts[:groups], opts[:entries], opts[:parent]
|
186
186
|
|
187
187
|
# Remove groups and entries from options, so new group could be
|
188
188
|
# initialized from incoming Hash
|
189
189
|
fields = Keepassx::Group.fields
|
190
190
|
group_opts = opts.reject { |k, _| !fields.include? k }
|
191
191
|
group = add_group group_opts
|
192
|
+
group.parent = parent unless parent.nil?
|
192
193
|
|
193
194
|
entries.each do |e|
|
194
|
-
|
195
|
-
add_entry entry.merge(:group => group)
|
195
|
+
add_entry e.merge(:group => group)
|
196
196
|
end unless entries.nil?
|
197
197
|
|
198
198
|
# Recursively proceed each child group
|
199
|
-
groups.each
|
199
|
+
groups.each do |g|
|
200
|
+
parse_data_array g.merge(:parent => group)
|
201
|
+
end unless groups.nil?
|
200
202
|
|
201
203
|
end
|
202
204
|
|
data/ruby-keepassx.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = 'Ruby API access for KeePassX databases'
|
4
4
|
s.description = 'This is fork of Tony Pitluga\'s ' \
|
5
5
|
'Ruby API for keepassx with read-write support.'
|
6
|
-
s.version = '0.2.
|
6
|
+
s.version = '0.2.2beta1'
|
7
7
|
s.authors = ['Tony Pitluga', 'Paul Hinze', 'Tio Teath']
|
8
8
|
s.email = ['tony.pitluga@gmail.com', 'paul.t.hinze@gmail.com',
|
9
9
|
'tioteath@gmail.com']
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
s.add_development_dependency 'rspec', '~> 3.0'
|
19
|
-
s.add_development_dependency 'pry', '~> 0'
|
19
|
+
s.add_development_dependency 'pry', '~> 0.10'
|
20
20
|
s.add_development_dependency 'rake', '~> 0.8', '>= 0.8.7'
|
21
21
|
s.add_development_dependency 'respect', '~> 0.1', '>= 0.1.1'
|
22
22
|
# s.add_development_dependency 'rspec-prof', '~> 0'
|
data/spec/keepassx/entry_spec.rb
CHANGED
@@ -61,7 +61,7 @@ describe Keepassx::Entry do
|
|
61
61
|
|
62
62
|
it 'returns Hash entry representation' do
|
63
63
|
expect(entry_schema.validate? test_entry.to_hash).to be true
|
64
|
-
end
|
64
|
+
end unless RUBY_VERSION =~ /1.8/ # Respect does not support ruby 1.8.x
|
65
65
|
|
66
66
|
it 'set timestamps properly' do
|
67
67
|
expect(test_entry.to_hash[:creation]).to eq test_date
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-keepassx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitluga
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
35
|
+
version: '0.10'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
42
|
+
version: '0.10'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,9 +130,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- - "
|
133
|
+
- - ">"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
135
|
+
version: 1.3.1
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
138
|
rubygems_version: 2.2.2
|