reminders_txt 0.3.11 → 0.3.12
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 +34 -18
- 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: cbb33480f37472a926eafe65ff3ce3422a83c2be
|
4
|
+
data.tar.gz: 257b8dc0ce77dca22753f2901ae496721d2d1e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abe605a67c520962a4e02f4b2a3a460498959e668ba2a87ea37c62950db9349b3ec14e2f5ad38874a362d7ed4f39a057a800458bb576979db9c02b7630fe33b1
|
7
|
+
data.tar.gz: baa9b238c153f46623f31aa6c5a8f09a1085f7a1800a0ad2023bb9f38e922a89e915bd85903c4ec9aa521a7ced60393144715761a1d057d22ef0e2c5caa171f2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/reminders_txt.rb
CHANGED
@@ -25,7 +25,7 @@ class RemindersTxt
|
|
25
25
|
include AppRoutes
|
26
26
|
using Ordinals
|
27
27
|
|
28
|
-
attr_reader :reminders
|
28
|
+
attr_reader :reminders, :dx
|
29
29
|
|
30
30
|
def initialize(raw_s='reminders.txt', now: Time.now)
|
31
31
|
|
@@ -35,14 +35,34 @@ class RemindersTxt
|
|
35
35
|
@filepath = raw_s
|
36
36
|
|
37
37
|
if raw_s.lines.length > 1 then
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
if raw_s.lstrip[0] == '<' then
|
40
|
+
|
41
|
+
@filepath = 'reminders.xml'
|
42
|
+
@dx = Dynarex.new raw_s
|
43
|
+
|
44
|
+
else
|
45
|
+
|
46
|
+
@filepath = File.join(Dir.pwd, 'reminders.txt')
|
47
|
+
@dxfilepath = @filepath.sub(/.txt$/,'.xml')
|
48
|
+
|
49
|
+
@dx = Dynarex.new
|
50
|
+
import_txt(raw_s)
|
51
|
+
|
52
|
+
end
|
53
|
+
|
40
54
|
elsif File.extname(@filepath) == '.txt'
|
41
55
|
|
42
|
-
|
43
|
-
|
56
|
+
s = File.read @filepath
|
57
|
+
@filename = File.basename(@filepath)
|
58
|
+
@dxfilepath = @filepath.sub(/.txt$/,'.xml')
|
59
|
+
|
60
|
+
import_txt(s)
|
61
|
+
|
44
62
|
else
|
63
|
+
|
45
64
|
@dx = Dynarex.new @filepath
|
65
|
+
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
@@ -129,7 +149,7 @@ class RemindersTxt
|
|
129
149
|
|
130
150
|
# hall 2 friday at 11am
|
131
151
|
# some important day 24th Mar
|
132
|
-
get /(
|
152
|
+
get /([^\d]+)\s+(\d+[^\*]+)(\*)?/ do |title, raw_date, annualar|
|
133
153
|
|
134
154
|
d = Chronic.parse(raw_date)
|
135
155
|
|
@@ -181,16 +201,9 @@ class RemindersTxt
|
|
181
201
|
|
182
202
|
private
|
183
203
|
|
184
|
-
def import_txt(
|
185
|
-
|
186
|
-
s = File.read filepath
|
187
|
-
@file_contents, @filename = s, File.basename(filepath)
|
188
|
-
|
189
|
-
#Dir.chdir File.dirname(filename)
|
190
|
-
|
191
|
-
@dxfilepath = filepath.sub(/.txt$/,'.xml')
|
192
|
-
|
204
|
+
def import_txt(s)
|
193
205
|
|
206
|
+
@file_contents = s
|
194
207
|
@params = {}
|
195
208
|
expressions(@params)
|
196
209
|
buffer = s.lines[2..-1]
|
@@ -214,10 +227,9 @@ class RemindersTxt
|
|
214
227
|
#
|
215
228
|
def refresh()
|
216
229
|
|
217
|
-
|
218
230
|
reminders = @reminders.clone
|
219
231
|
# if XML file doesn't exist, create it
|
220
|
-
|
232
|
+
|
221
233
|
if File.exists? @dxfilepath then
|
222
234
|
|
223
235
|
@dx = Dynarex.new @dxfilepath
|
@@ -233,6 +245,10 @@ class RemindersTxt
|
|
233
245
|
reminder.date.to_date
|
234
246
|
|
235
247
|
end
|
248
|
+
|
249
|
+
else
|
250
|
+
|
251
|
+
save_dx()
|
236
252
|
|
237
253
|
end
|
238
254
|
|
@@ -247,7 +263,7 @@ class RemindersTxt
|
|
247
263
|
h2 = (Digest::MD5.new << @file_contents).to_s
|
248
264
|
|
249
265
|
b = h1 != h2
|
250
|
-
|
266
|
+
|
251
267
|
if b or @reminders != reminders then
|
252
268
|
|
253
269
|
save_dx()
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|