daily_planner 0.1.0 → 0.1.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: 58fac8df0728281c5c090e5c9708c5ff93e88596
4
- data.tar.gz: 49e16b68d676cc2899bf49badc9472956b160b98
3
+ metadata.gz: 1d58b6a0721e04c206913343c2ab860ce837f752
4
+ data.tar.gz: b9b43c23a70ad631b36bbbbec900ab9ff9fadce2
5
5
  SHA512:
6
- metadata.gz: e5c99f5ec3ac4eac4db66f02e4e2dc937d2499a8c46d403bb4176a62f49c61c738f833aa185e0ef32395763ad307d2eee3e830cbb429b3faa5117688d5a77f33
7
- data.tar.gz: 8d8d3c63ba04442b739ee6a64fe78db5cb98c7c438f7d2f404065c498c32b16cc74096efdaa6ecba8f69c592254db6325f53d3824ae0339550e19d28e10c980c
6
+ metadata.gz: ac30b235e8a1afe78441e175716b6860a6db68202965f7d409caa4c37c3cef1def9801bd50856005acb6dd920099b5242ca6d9ba97b93b934b937b438d0819fc
7
+ data.tar.gz: 5c05bcd0ebbe61274630dbfe759ee9357cef834de30e9c4c2a6e18ae8060b758908056e55593b076730eec17e5e558c4f23642930da5d15e006fa7ff35c83462
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ʈ3B34���8I�� k���DF���Y
2
- ��O�%�O����M�lWv~.LJ�%e���HnG�,�g[f��:?�U���~�<�Gp%����&�tJd��K�n9KMδŇ�ں��1_�-s�:��g������}m`��K��� FW���^�x�Y%l)��pk�)�����f>uA�%�w�
1
+ QN�ʃbS�w�#c�t\R#�э��1���F����i��W�S2����|��e���߂hd�iauq?V?���ie\dq�^��ɡ��-� ��P�`=�6���Tk�!* ?��Ob6��́��q���[.F�"%S���H�$�W�g�g2r"82�%.U���|=�~����W*}n���@���Iy"��\��I@c��O�
2
+ J~w�!�rE�D��m�s�%����Xi&��7dc+P!��
data/lib/daily_planner.rb CHANGED
@@ -18,7 +18,14 @@ class DailyPlanner
18
18
  fpath = File.join(path, filename)
19
19
 
20
20
  if File.exists?(fpath) then
21
+
21
22
  @rx = import_to_rx(File.read(fpath))
23
+ @d = Date.parse(@rx.date)
24
+ archive()
25
+
26
+ # if the date isn't today then update it to today
27
+ refresh() if @d != DateTime.now.to_date
28
+
22
29
  else
23
30
  @rx = new_rx
24
31
  end
@@ -42,7 +49,19 @@ class DailyPlanner
42
49
 
43
50
  private
44
51
 
45
-
52
+ def archive()
53
+
54
+ # archive the daily planner
55
+ # e.g. dailyplanner/2015/d121215.xml
56
+
57
+ archive_path = File.join(@path, @d.year.to_s)
58
+ FileUtils.mkdir_p archive_path
59
+ filename = @d.strftime("d%d%m%Y.xml")
60
+
61
+ File.write File.join(archive_path, filename), rx.to_xml
62
+
63
+ end
64
+
46
65
  def import_to_rx(s)
47
66
 
48
67
  rx = new_rx()
@@ -84,16 +103,21 @@ class DailyPlanner
84
103
 
85
104
  end
86
105
 
87
- def new_rx()
106
+ def new_rx(today: '', tomorrow: '')
88
107
 
89
108
  title = "Daily Planner"
90
109
  date = DateTime.now
91
- rx = RecordX.new({title: title, date: date, today: '', tomorrow: ''})
92
-
110
+ rx = RecordX.new({title: title, date: date, \
111
+ today: today, tomorrow: tomorrow})
93
112
  return rx
94
113
  end
95
114
 
96
- def refresh(rxfilepath, latest_rx)
115
+ def refresh()
116
+
117
+ if @d == DateTime.now.to_date - 1 and @rx.tomorrow.strip.length > 0 then
118
+ @rx = new_rx(today: @rx.tomorrow)
119
+ end
120
+
97
121
  end
98
122
 
99
- end
123
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_planner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  52/Qhn5QdVacSO+YlHFgL6wMk/FAnJzGgADFpvq/QgXbDkH5G2eRKpvJP9J1E34V
32
32
  iT9ytBP7h9+uFg==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-12-11 00:00:00.000000000 Z
34
+ date: 2015-12-12 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: recordx
metadata.gz.sig CHANGED
Binary file