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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5878d573d23b1a772241aa460263fcc1151eab9d
4
- data.tar.gz: 64c8518ce259cfbf4433a48291f391d0942c728a
3
+ metadata.gz: e26a9f61a1a9f134d0bce159197382d41a3faab9
4
+ data.tar.gz: c0f83c8ca76827f2ec822d1dcdb15fbd410d0f29
5
5
  SHA512:
6
- metadata.gz: 1d1f75cbdb70e44f02533e81e00bc582358c375b25fb1df67635e8182dc95ae3da12e043b8983d920a0ae19152aca57e57c399e67e619deda4f8666218725e05
7
- data.tar.gz: a7377981ea9e9b4371ff6d5d4bbfbf82eb376864b773b19791c8cb9eca1c7c3842ef1f06928aceaedeb4ad7cc33981a8f077dc903b9fad93024db9302b751dae
6
+ metadata.gz: 4d2275704f49a165e149d09e3d11b9ded04f4aea5b86da68fd93631c4f5ee112335fb8c60bee333515cbf7016295ebc2d4c53e3536a2e68765722d9a62c6f509
7
+ data.tar.gz: 4884dd5e2e0e5299d8105c085cb25f5309c7f23abc4aa6317784ef427fa29fdc38ea8e16874cbf2e15121cd1435b15a0f5b18627ef033d34ed86a55af60c5d7a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- # [ ] archive address entries on an annual basis
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.write xml_file, doc.xml(pretty: true)
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.0
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-23 00:00:00.000000000 Z
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.12
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.12
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