reminders_txt 0.3.0 → 0.3.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 +0 -0
- data/lib/reminders_txt.rb +33 -17
- metadata +1 -1
- 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: 4f20103f70752f7787daa661d392a2ae68ba5cb0
|
4
|
+
data.tar.gz: 2e3572e91d46a26858a81f62a88440d13d0d2767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f40d167ca858715279d9a216b3e45c079bd50a06c844e018e7dcba7d04b1ede53375921721b5c5425ba12d54b7c6b8cdfd091527e4ac3c06accc1d6ebe644352
|
7
|
+
data.tar.gz: ef0292802c578f9ccb68854e89f853c5def2e23bf9e443c6ead347a50ea608514a022e28510a210d7a748fef9a707efd56d8a3def283221722b2edd0085d4763
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/reminders_txt.rb
CHANGED
@@ -65,10 +65,10 @@ class RemindersTxt
|
|
65
65
|
|
66
66
|
def refresh()
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
68
|
+
#@reminders.map! do |x|
|
69
|
+
# x.date = x.date.is_a?(Time) ? x.date : Chronic.parse(x.date)
|
70
|
+
# x
|
71
|
+
#end
|
72
72
|
|
73
73
|
# synchronise with the XML file
|
74
74
|
# if XML file doesn't exist, create it
|
@@ -78,9 +78,11 @@ class RemindersTxt
|
|
78
78
|
dx = Dynarex.new @dxfilepath
|
79
79
|
|
80
80
|
@reminders.map do |reminder|
|
81
|
+
s = reminder.input
|
82
|
+
r = dx.find_by_input s
|
81
83
|
|
82
|
-
|
83
|
-
reminder.date = r ? Date.parse(r.date) : reminder.date.to_date
|
84
|
+
# it is on file and it's not an annual event?
|
85
|
+
reminder.date = (r and not s[/\*$/]) ? Date.parse(r.date) : reminder.date.to_date
|
84
86
|
|
85
87
|
reminder
|
86
88
|
end
|
@@ -132,25 +134,26 @@ class RemindersTxt
|
|
132
134
|
starting = /(?:\(?\s*starting (\d+\w{2} \w+\s*\w*)(?: until (.*))?\s*\))?/
|
133
135
|
|
134
136
|
get /^(.*)(every \w+ \w+(?: at (\d+am) )?)\s*#{starting}/ do \
|
135
|
-
|title, recurring, time,
|
137
|
+
|title, recurring, time, raw_date, end_date|
|
136
138
|
|
137
139
|
input = params[:input]
|
138
140
|
|
141
|
+
d = Chronic.parse(raw_date)
|
142
|
+
|
139
143
|
if recurring =~ /day|week/ then
|
144
|
+
|
140
145
|
|
141
|
-
|
142
|
-
|
143
|
-
if start_date <= @now then
|
146
|
+
if d < @now then
|
144
147
|
|
145
|
-
new_date = CronFormat.new(ChronicCron.new(recurring).to_expression,
|
148
|
+
new_date = CronFormat.new(ChronicCron.new(recurring).to_expression, d).to_time
|
146
149
|
input.gsub!(date, new_date.strftime("#{new_date.day.ordinal} %b %Y"))
|
147
|
-
|
150
|
+
d = new_date
|
148
151
|
|
149
152
|
end
|
150
153
|
end
|
151
154
|
|
152
155
|
|
153
|
-
OpenStruct.new input: input, title: title, recurring: recurring, date:
|
156
|
+
OpenStruct.new input: input, title: title, recurring: recurring, date: d, end_date: end_date
|
154
157
|
#[0, title, recurring, time, date, end_date].inspect
|
155
158
|
end
|
156
159
|
|
@@ -163,16 +166,29 @@ class RemindersTxt
|
|
163
166
|
end
|
164
167
|
|
165
168
|
# some important day 24th Mar
|
166
|
-
get /(.*)\s+(\d
|
169
|
+
get /(.*)\s+(\d+[^\*]+)(\*)?/ do |title, raw_date, annualar|
|
170
|
+
|
171
|
+
d = Chronic.parse(raw_date)
|
167
172
|
|
168
|
-
|
173
|
+
if annualar and d < @now then
|
174
|
+
d = Chronic.parse(raw_date, now: Time.local(@now.year + 1, 1, 1))
|
175
|
+
end
|
176
|
+
|
177
|
+
OpenStruct.new input: params[:input], title: title, date: d
|
169
178
|
#[2, title, date].inspect
|
170
179
|
end
|
171
180
|
|
172
181
|
# 27-Mar@1436 some important day
|
173
|
-
get /(\d[^\s]+)\s+(
|
182
|
+
get /(\d[^\s]+)\s+([^\*]+)(\*)?/ do |raw_date, title, annualar|
|
174
183
|
|
175
|
-
|
184
|
+
d = Chronic.parse(raw_date)
|
185
|
+
|
186
|
+
if annualar and d < @now then
|
187
|
+
d = Chronic.parse(raw_date, now: Time.local(@now.year + 1, 1, 1))
|
188
|
+
end
|
189
|
+
|
190
|
+
|
191
|
+
OpenStruct.new input: params[:input], title: title, date: d
|
176
192
|
#[3, title, date].inspect
|
177
193
|
end
|
178
194
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|