reminders_txt 0.4.3 → 0.4.4
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/reminders_txt.rb +73 -11
- data.tar.gz.sig +0 -0
- metadata +39 -35
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9513ff78ef31666123db5eafd6fd822eb4e6ca78968af6221a553732722769c5
|
4
|
+
data.tar.gz: 256e3164ddeb056dda7d0bc311e671e1452e651e777a0b857bbc26ad2b78f094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c045a6a21042f716e794e6737a96725ce5f2a1b82007c10bd53d6dac00603a59b6fb2253ef0ed49fb4caf0e110a0d05932539f980ca2c54805ce8c1ec51be2
|
7
|
+
data.tar.gz: d557e5713f2060525148ee76de09a3599f84a42d5f4e1e6972c3d88e460d52068800bea24d6c294bca54bea9d87345ee59d800950ed982ae2a6be026f110f8da
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/reminders_txt.rb
CHANGED
@@ -8,16 +8,23 @@ require 'event_nlp'
|
|
8
8
|
require 'digest/md5'
|
9
9
|
|
10
10
|
|
11
|
+
class RemindersTxtException < Exception
|
12
|
+
|
13
|
+
|
14
|
+
end
|
15
|
+
|
11
16
|
class RemindersTxt
|
12
17
|
|
13
18
|
|
14
19
|
attr_reader :reminders, :dx
|
15
20
|
|
16
|
-
def initialize(raw_s='reminders.txt', now: Time.now)
|
21
|
+
def initialize(raw_s='reminders.txt', now: Time.now, debug: false)
|
17
22
|
|
18
23
|
super()
|
19
24
|
|
20
|
-
@now = now
|
25
|
+
@now, @debug = now, debug
|
26
|
+
|
27
|
+
puts '@now: ' + @now.inspect if @debug
|
21
28
|
|
22
29
|
|
23
30
|
@filepath = raw_s
|
@@ -64,15 +71,51 @@ class RemindersTxt
|
|
64
71
|
refresh()
|
65
72
|
|
66
73
|
end
|
74
|
+
|
75
|
+
def before(d)
|
76
|
+
|
77
|
+
future_date = d.is_a?(String) ? Chronic.parse(d).to_datetime : d
|
78
|
+
@dx.filter {|x| DateTime.parse(x.date) < future_date}
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
def find(s)
|
83
|
+
@dx.filter {|x| x.title =~ /#{s}/i}
|
84
|
+
end
|
67
85
|
|
68
|
-
def upcoming(ndays=5, days: ndays)
|
69
|
-
|
86
|
+
def upcoming(ndays=5, days: ndays, months: nil)
|
87
|
+
|
88
|
+
next_date = if months then
|
89
|
+
@now.to_datetime >> months.to_i
|
90
|
+
else
|
91
|
+
@now.to_datetime + days.to_i
|
92
|
+
end
|
93
|
+
|
94
|
+
@dx.filter {|x| DateTime.parse(x.date) <= next_date}
|
70
95
|
end
|
71
96
|
|
72
97
|
def updated?()
|
73
98
|
@updated
|
74
99
|
end
|
75
100
|
|
101
|
+
def today()
|
102
|
+
upcoming 0
|
103
|
+
end
|
104
|
+
|
105
|
+
def tomorrow()
|
106
|
+
upcoming days: 1
|
107
|
+
end
|
108
|
+
|
109
|
+
def this_week()
|
110
|
+
upcoming days: 6
|
111
|
+
end
|
112
|
+
|
113
|
+
alias weekahead this_week
|
114
|
+
|
115
|
+
def this_year()
|
116
|
+
upcoming months: 12
|
117
|
+
end
|
118
|
+
|
76
119
|
def to_s()
|
77
120
|
|
78
121
|
filename = File.basename(@filepath).sub(/\.xml$/, '.txt')
|
@@ -103,7 +146,7 @@ class RemindersTxt
|
|
103
146
|
|
104
147
|
r
|
105
148
|
end
|
106
|
-
|
149
|
+
|
107
150
|
@updated = false
|
108
151
|
|
109
152
|
refresh()
|
@@ -130,8 +173,14 @@ class RemindersTxt
|
|
130
173
|
|
131
174
|
if (r and r.recurring.empty? and not s[/\*$/]) then
|
132
175
|
DateTime.parse(r.date)
|
133
|
-
else
|
134
|
-
|
176
|
+
else
|
177
|
+
|
178
|
+
if reminder.date then
|
179
|
+
reminder.date.to_datetime
|
180
|
+
else
|
181
|
+
raise RemindersTxtException, 'nil date for reminder : ' \
|
182
|
+
+ reminder.inspect
|
183
|
+
end
|
135
184
|
end
|
136
185
|
|
137
186
|
end
|
@@ -143,7 +192,17 @@ class RemindersTxt
|
|
143
192
|
end
|
144
193
|
|
145
194
|
# delete expired non-recurring reminders
|
146
|
-
@reminders.reject!
|
195
|
+
@reminders.reject! do |x|
|
196
|
+
|
197
|
+
if @debug then
|
198
|
+
puts 'rejects filter: '
|
199
|
+
puts ' x.input: ' + x.input.inspect
|
200
|
+
puts ' x.date.to_time: ' + x.date.to_time.inspect
|
201
|
+
end
|
202
|
+
|
203
|
+
x.date.to_time < @now if not x.recurring
|
204
|
+
|
205
|
+
end
|
147
206
|
|
148
207
|
@reminders.sort_by!(&:date)
|
149
208
|
|
@@ -155,10 +214,12 @@ class RemindersTxt
|
|
155
214
|
b = h1 != h2
|
156
215
|
|
157
216
|
if b or @reminders != reminders then
|
158
|
-
|
217
|
+
|
159
218
|
save_dx()
|
160
219
|
File.write File.join(File.dirname(@filepath), 'reminders.txt'), self.to_s
|
161
220
|
@updated = true
|
221
|
+
else
|
222
|
+
puts 'no update'
|
162
223
|
end
|
163
224
|
|
164
225
|
[:refresh, b]
|
@@ -207,5 +268,6 @@ class RemindersTxt
|
|
207
268
|
save_detail()
|
208
269
|
|
209
270
|
end
|
210
|
-
|
211
|
-
|
271
|
+
|
272
|
+
|
273
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwODI3MTQyNzQ1WhcN
|
15
|
+
MTkwODI3MTQyNzQ1WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDXSeGl
|
17
|
+
jA7t0dTfrt5uPzHbjshY0b5E/xow3ABWmT8DUEP18xBtnEUrilHRh9GEGvMN0Fsq
|
18
|
+
O/kpqQAqTAqQQOVxyGhbbOQXOY86+SnZtBurNgcJ0QsiDnum4zqjbJT0lscpPdPK
|
19
|
+
t+mXcVcAOdhQndEYIBILiISRfcwxHgjxThAl4dzuS1ifFGCuIpFGJJ49DkigCFdL
|
20
|
+
oTKnImrLw5mSW1/BTY0JEhY4OhpGlaF6B6UOktj6M9tpSgezMcmovR2LGsmcUjjl
|
21
|
+
rgspsBjQ23/h3dwimCDbXDrJEHBKaWgBwoxt6Hya+ybB9IjMPTmnFeAT06bNGyIf
|
22
|
+
bSPcT2UrdvxbU73eEZdcnSQgRnDYQ3TFzQjQGiukgJVkm82v+WCHIpcjBgw0bS6s
|
23
|
+
rR+Hhtf7cZsCxJMRPJxqYonG+yin/mPJfKB2ou9MJggkuny2QZfWtfw+Gun/svVl
|
24
|
+
Ly9Hsq6gTvHWdcmQlPhn7Gx+OZ8CR0M2SOqV5Mvlrhv6/O2tfoC3us3Q45kCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUpxsXwGY1
|
26
|
+
MQV4+OxT3LFEi4/T6OYwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAR12sqgiO9IWN25TPvwTnZX4DIFBa4TQ2pOODG7wI
|
29
|
+
uTWKnkWiAeiY/3dJ+sRp5+zf5VyOKt3gXmLhxdA4cfPvAmNNwZV2RbjELQvgfgHh
|
30
|
+
gP+jIlDpx5Xy2WBpx1a9sQ1Yb8kWDG2988n44HVSJD6e5ngZn4PFLmoY3mIk1m5l
|
31
|
+
dI4Z0AGFjiN2WeQp2aMtWsseoS7LvTm17xOtKNwLfWze9h9DRTNeICu7Dg69eswQ
|
32
|
+
Dd7K/ZLzHn/7xBCbybx3oUlx/w5m102wxNiUSjvlvlDbbheyFjyVGQcudIlWJkKm
|
33
|
+
rNRRoNfNjxaFhKsMdiyrfGmWhOBIsfPlGyhR7WMQYiz5ACjrlmnVnc8Aab1ipiUG
|
34
|
+
almSkip+iLRS55rdH4mSncK3iQurf6Jny9x2JD+U6cRXz/UPpNqFb/bU1mxXiU1a
|
35
|
+
U6f6HfP/6K9f602IeJGEDybVHYFQ7Ssl+AeclLBiMqy5HYuL7kRoD9C2D166GI42
|
36
|
+
M4blonk3dgx08AvXnjoMsgqh
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: dynarex
|
@@ -39,60 +43,60 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
46
|
+
version: '1.8'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
49
|
+
version: 1.8.2
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
56
|
+
version: '1.8'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
59
|
+
version: 1.8.2
|
56
60
|
- !ruby/object:Gem::Dependency
|
57
61
|
name: event_nlp
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
64
|
- - "~>"
|
61
65
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
66
|
+
version: '0.5'
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
69
|
+
version: 0.5.0
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
74
|
- - "~>"
|
71
75
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
76
|
+
version: '0.5'
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
79
|
+
version: 0.5.0
|
76
80
|
- !ruby/object:Gem::Dependency
|
77
81
|
name: chronic_cron
|
78
82
|
requirement: !ruby/object:Gem::Requirement
|
79
83
|
requirements:
|
80
84
|
- - "~>"
|
81
85
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
86
|
+
version: '0.4'
|
83
87
|
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
89
|
+
version: 0.4.0
|
86
90
|
type: :runtime
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
93
|
requirements:
|
90
94
|
- - "~>"
|
91
95
|
- !ruby/object:Gem::Version
|
92
|
-
version: '0.
|
96
|
+
version: '0.4'
|
93
97
|
- - ">="
|
94
98
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
99
|
+
version: 0.4.0
|
96
100
|
description:
|
97
101
|
email: james@jamesrobertson.eu
|
98
102
|
executables: []
|
@@ -120,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
124
|
version: '0'
|
121
125
|
requirements: []
|
122
126
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.6
|
127
|
+
rubygems_version: 2.7.6
|
124
128
|
signing_key:
|
125
129
|
specification_version: 4
|
126
130
|
summary: Reads and updates diary reminders from a plain text file
|
metadata.gz.sig
CHANGED
Binary file
|