addressbook_txt 0.2.0 → 0.2.1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/addressbook_txt.rb +15 -4
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e26a9f61a1a9f134d0bce159197382d41a3faab9
|
|
4
|
+
data.tar.gz: c0f83c8ca76827f2ec822d1dcdb15fbd410d0f29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d2275704f49a165e149d09e3d11b9ded04f4aea5b86da68fd93631c4f5ee112335fb8c60bee333515cbf7016295ebc2d4c53e3536a2e68765722d9a62c6f509
|
|
7
|
+
data.tar.gz: 4884dd5e2e0e5299d8105c085cb25f5309c7f23abc4aa6317784ef427fa29fdc38ea8e16874cbf2e15121cd1435b15a0f5b18627ef033d34ed86a55af60c5d7a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/addressbook_txt.rb
CHANGED
|
@@ -14,7 +14,7 @@ require 'rexle-diff'
|
|
|
14
14
|
# [x] create a new addressbook.txt file
|
|
15
15
|
# [x] read an existing addressbook.txt file
|
|
16
16
|
# [x] search each entry using a keyword
|
|
17
|
-
# [
|
|
17
|
+
# [x] archive address entries on an annual basis
|
|
18
18
|
# [ ] search the archive using a keyword
|
|
19
19
|
|
|
20
20
|
|
|
@@ -48,10 +48,21 @@ class AddressbookTxt
|
|
|
48
48
|
File.write File.join(@path, filename), s
|
|
49
49
|
|
|
50
50
|
xml_file = File.join(@path, filename.sub(/\.txt$/,'.xml'))
|
|
51
|
-
xml_buffer = File.read xml_file
|
|
52
|
-
doc = RexleDiff.new(xml_buffer, @dx.to_xml, fuzzy_match: true).to_doc
|
|
53
51
|
|
|
54
|
-
File.
|
|
52
|
+
if File.exists? xml_file then
|
|
53
|
+
xml_buffer = File.read xml_file
|
|
54
|
+
doc = RexleDiff.new(xml_buffer, @dx.to_xml, fuzzy_match: true).to_doc
|
|
55
|
+
|
|
56
|
+
File.write xml_file, doc.xml(pretty: true)
|
|
57
|
+
else
|
|
58
|
+
File.write xml_file, @dx.to_xml(pretty: true)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# write the file to the archive
|
|
62
|
+
archive_file = File.join(@path,'archive','addressbook-' + \
|
|
63
|
+
Date.today.year.to_s + '.xml')
|
|
64
|
+
FileUtils.mkdir_p File.dirname(archive_file)
|
|
65
|
+
FileUtils.cp xml_file, archive_file
|
|
55
66
|
|
|
56
67
|
end
|
|
57
68
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: addressbook_txt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
jBisKlK4NU+/BuE1DGdPIKLX9x3RMlzMmNh+RnQRSO1vZBS7CMIcchEq+TEMHNiW
|
|
32
32
|
0cWS80GYRylyNQ==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2016-07-
|
|
34
|
+
date: 2016-07-24 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: dynarex
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '1.7'
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 1.7.
|
|
45
|
+
version: 1.7.14
|
|
46
46
|
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
version: '1.7'
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 1.7.
|
|
55
|
+
version: 1.7.14
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: rexle-diff
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
|
Binary file
|