daily_planner 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/lib/daily_planner.rb +30 -6
- metadata +2 -2
- 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: 1d58b6a0721e04c206913343c2ab860ce837f752
|
4
|
+
data.tar.gz: b9b43c23a70ad631b36bbbbec900ab9ff9fadce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
2
|
-
|
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�!�r�E�D��m�s�%����X� i&��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,
|
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(
|
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.
|
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-
|
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
|