reminders_txt 0.4.4 → 0.5.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/reminders_txt.rb +47 -7
- metadata +15 -16
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82d43b528dbfbaf1fe0db1f39201ee83b132df59d915c130fc6fb743994cc02d
|
4
|
+
data.tar.gz: 6d7081ca6905ab0acb4149e7b65e632f5047b9cc1ce62750749c5b7222179fac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a26f7f3fb6e13f543923ea85ccb33b6ba1e4198c50942db1a9280d5a615b7d80704bb73ae5578b0658c43805f74317c60967f951b1754ab80c6b64261c95cf
|
7
|
+
data.tar.gz: 894912a616fa45da1bc71bff611be87ff4543f2f0686b28e38bd20e768c77d16a3a57731f7d377fa0f2a7d1f45201df6e56309b71a7a8c199e3ef0bf207226ea
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/reminders_txt.rb
CHANGED
@@ -8,13 +8,27 @@ require 'event_nlp'
|
|
8
8
|
require 'digest/md5'
|
9
9
|
|
10
10
|
|
11
|
+
module Ordinal
|
12
|
+
refine Integer do
|
13
|
+
|
14
|
+
def ordinal
|
15
|
+
self.to_s + ( (10...20).include?(self) ? 'th' :
|
16
|
+
%w{ th st nd rd th th th th th th }[self % 10] )
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
11
23
|
class RemindersTxtException < Exception
|
12
24
|
|
13
25
|
|
14
26
|
end
|
15
27
|
|
16
|
-
class RemindersTxt
|
17
28
|
|
29
|
+
class RemindersTxt
|
30
|
+
using ColouredText
|
31
|
+
include RXFHelperModule
|
18
32
|
|
19
33
|
attr_reader :reminders, :dx
|
20
34
|
|
@@ -24,7 +38,7 @@ class RemindersTxt
|
|
24
38
|
|
25
39
|
@now, @debug = now, debug
|
26
40
|
|
27
|
-
puts '@now: ' + @now.inspect if @debug
|
41
|
+
puts ('@now: ' + @now.inspect).debug if @debug
|
28
42
|
|
29
43
|
|
30
44
|
@filepath = raw_s
|
@@ -48,7 +62,7 @@ class RemindersTxt
|
|
48
62
|
|
49
63
|
elsif File.extname(@filepath) == '.txt'
|
50
64
|
|
51
|
-
s =
|
65
|
+
s = FileX.read @filepath
|
52
66
|
@filename = File.basename(@filepath)
|
53
67
|
@dxfilepath = @filepath.sub(/.txt$/,'.xml')
|
54
68
|
|
@@ -141,6 +155,7 @@ class RemindersTxt
|
|
141
155
|
if (x.length > 1) then
|
142
156
|
|
143
157
|
rx = EventNlp.new(@now, params: {input: x}).parse(x)
|
158
|
+
puts ('rx: ' + rx.inspect).debug if @debug
|
144
159
|
r << rx if rx
|
145
160
|
end
|
146
161
|
|
@@ -160,7 +175,7 @@ class RemindersTxt
|
|
160
175
|
reminders = @reminders.clone
|
161
176
|
# if XML file doesn't exist, create it
|
162
177
|
|
163
|
-
if
|
178
|
+
if FileX.exists? @dxfilepath then
|
164
179
|
|
165
180
|
@dx = Dynarex.new @dxfilepath
|
166
181
|
|
@@ -216,7 +231,7 @@ class RemindersTxt
|
|
216
231
|
if b or @reminders != reminders then
|
217
232
|
|
218
233
|
save_dx()
|
219
|
-
|
234
|
+
FileX.write File.join(File.dirname(@filepath), 'reminders.txt'), self.to_s
|
220
235
|
@updated = true
|
221
236
|
else
|
222
237
|
puts 'no update'
|
@@ -252,7 +267,7 @@ class RemindersTxt
|
|
252
267
|
end
|
253
268
|
|
254
269
|
dx2 = Dynarex.new 'reminders/reminder(input, title, recurring, ' +
|
255
|
-
'date, end_date, info)'
|
270
|
+
'date, end_date, venue, info)'
|
256
271
|
dx2.import rows
|
257
272
|
dx2.save File.join(filepath, 'reminder_details.xml')
|
258
273
|
|
@@ -261,7 +276,7 @@ class RemindersTxt
|
|
261
276
|
def save_dx()
|
262
277
|
|
263
278
|
@dx = Dynarex.new(
|
264
|
-
'reminders/reminder(input, title, recurring, date, end_date)')
|
279
|
+
'reminders/reminder(input, title, recurring, date, end_date, venue)')
|
265
280
|
@reminders.each {|x| @dx.create x.to_h}
|
266
281
|
@dx.save @dxfilepath
|
267
282
|
|
@@ -271,3 +286,28 @@ class RemindersTxt
|
|
271
286
|
|
272
287
|
|
273
288
|
end
|
289
|
+
|
290
|
+
class RemindersTxtVoice < RemindersTxt
|
291
|
+
using Ordinal
|
292
|
+
|
293
|
+
def weekahead()
|
294
|
+
|
295
|
+
s = super.all.map do |x|
|
296
|
+
date = DateTime.parse(x.date)
|
297
|
+
"you are at %s, on %s, at %s." % [(x.venue.empty? ? x.title : x.venue), \
|
298
|
+
format_date(date), date.strftime("%-I:%M%P")
|
299
|
+
]
|
300
|
+
end.join(" Then ")
|
301
|
+
|
302
|
+
s.sub!(/^./){|x| x.upcase}
|
303
|
+
|
304
|
+
end
|
305
|
+
|
306
|
+
private
|
307
|
+
|
308
|
+
def format_date(date)
|
309
|
+
[Date::DAYNAMES[date.wday], 'the', date.day.ordinal, 'of',
|
310
|
+
Date::MONTHNAMES[date.month]].join(' ')
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reminders_txt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
U6f6HfP/6K9f602IeJGEDybVHYFQ7Ssl+AeclLBiMqy5HYuL7kRoD9C2D166GI42
|
36
36
|
M4blonk3dgx08AvXnjoMsgqh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2019-03-09 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dynarex
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '1.8'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.8.
|
49
|
+
version: 1.8.17
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '1.8'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.8.
|
59
|
+
version: 1.8.17
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: event_nlp
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '0.5'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.5.
|
69
|
+
version: 0.5.1
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -76,27 +76,27 @@ dependencies:
|
|
76
76
|
version: '0.5'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.5.
|
79
|
+
version: 0.5.1
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: chronic_cron
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - "~>"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '0.4'
|
87
84
|
- - ">="
|
88
85
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
86
|
+
version: 0.5.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.5'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.4'
|
97
94
|
- - ">="
|
98
95
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.
|
96
|
+
version: 0.5.0
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.5'
|
100
100
|
description:
|
101
101
|
email: james@jamesrobertson.eu
|
102
102
|
executables: []
|
@@ -123,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
127
|
-
rubygems_version: 2.7.6
|
126
|
+
rubygems_version: 3.0.1
|
128
127
|
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: Reads and updates diary reminders from a plain text file
|
metadata.gz.sig
CHANGED
Binary file
|