reminders_txt 0.3.13 → 0.3.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3df1d27dc11d59331c7ecdefd6c42860705c690
4
- data.tar.gz: 3c0583364d5ee423b2e32111ecbbafcdfc590ea5
3
+ metadata.gz: 917ca91a5de6794a7b57b13f44dea851eafc03b5
4
+ data.tar.gz: 41d7a19a41e0ae8d32e418d2def6f4bc55e329a6
5
5
  SHA512:
6
- metadata.gz: fae4a5163466b2f4e02fe4cd2ca092549946dc1a1e16116087d50d82f5904941931f57b2a539c4647f25f118e35b268a090ce3748a6fe4ff0fac3f3606235506
7
- data.tar.gz: d9c94efc0fa03c3b0ccb93e9bf537fb72c47607bf2178ac8f33e269ba1497fd00d9604701e2cce4fb6ee795519ad68adbf4ac7b06e1e31bfd0fb88eb5271a4d0
6
+ metadata.gz: 1031d7a36f643df92f9bfc7858faaad7e7135873303a4e5878456e191ec22d791da02a1e6d377fb8d18f6829abf575adb7275d8f83a85b93f82a9345e891dc2a
7
+ data.tar.gz: 775d899e265f0c0aecbbb45b6637a118ea128eab67618b8232bb38b46cef64b7c409d9d7911415d22fb4e67a211e87d13cfa810283b9c4752587d12888df4ee3
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/reminders_txt.rb CHANGED
@@ -111,6 +111,9 @@ class RemindersTxt
111
111
 
112
112
  starting = /(?:\(?\s*starting (\d+\w{2} \w+\s*\w*)(?: until (.*))?\s*\))?/
113
113
  weekday = Date::DAYNAMES.join('|').downcase
114
+ months = (Date::MONTHNAMES[1..-1] + Date::ABBR_MONTHNAMES[1..-1])
115
+ .join('|').downcase
116
+
114
117
 
115
118
  get /^(.*)(every \w+ \w+(?: at (\d+am) )?)\s*#{starting}/ do \
116
119
  |title, recurring, time, raw_date, end_date|
@@ -142,7 +145,8 @@ class RemindersTxt
142
145
 
143
146
  # some meeting 3rd thursday of the month at 7:30pm
144
147
  # some meeting First thursday of the month at 7:30pm
145
- get /(.*)\s+(\w+ \w+day of (?:the|every) month at .*)/ do |title, recurring|
148
+ get /(.*)\s+(\w+ \w+day of (?:the|every) month at .*)/ do
149
+ |title, recurring|
146
150
 
147
151
  #puts [1, title, recurring].inspect
148
152
  OpenStruct.new input: params[:input], title: title, recurring: recurring
@@ -158,13 +162,29 @@ class RemindersTxt
158
162
  OpenStruct.new input: params[:input], title: title, date: d
159
163
 
160
164
  end
165
+
166
+ # e.g. 21/05/2017 Forum meetup at Roundpeg from 2pm
167
+ get /^(\d+\/\d+\/\d+)\s+(.*)(?: from|at)\s+(\d+[ap]m)/ do
168
+ |raw_date, title, raw_time|
169
+
170
+ d = Chronic.parse(raw_date + ' ' +
171
+ raw_time, :endian_precedence => :little)
172
+ recurring = nil
173
+
174
+ #puts [3, title, raw_date].inspect
175
+ OpenStruct.new input: params[:input], title: title, date: d
176
+ end
161
177
 
162
178
  # hall 2 friday at 11am
163
179
  # some important day 24th Mar
164
- get /([^\d]+)\s+(\d+[^\*]+)(\*)?/ do |title, raw_date, annualar|
180
+
181
+ with_date = "(.*)\\s+(\\d\+\s*(?:st|nd|rd|th)?\\s+(?:#{months}))"
182
+ alt_pattern = '([^\d]+)\s+(\d+[^\*]+)(\*)?'
183
+
184
+ get /#{with_date}|#{alt_pattern}\s*(\*)$/i do |title, raw_date, annualar|
165
185
 
166
186
  d = Chronic.parse(raw_date)
167
-
187
+
168
188
  recurring = nil
169
189
 
170
190
  if annualar then
@@ -200,9 +220,12 @@ class RemindersTxt
200
220
  recurring: recurring
201
221
  end
202
222
 
203
- # e.g. 04-Aug@12:34
204
- get '*' do
205
223
 
224
+
225
+
226
+ # e.g. 04-Aug@12:34
227
+ get '*' do |s|
228
+ puts 's: ' + s.inspect
206
229
  'pattern unrecognised'
207
230
  end
208
231
 
@@ -230,7 +253,7 @@ class RemindersTxt
230
253
  end
231
254
 
232
255
  @updated = false
233
-
256
+
234
257
  refresh()
235
258
 
236
259
  end
@@ -265,7 +288,7 @@ class RemindersTxt
265
288
  end
266
289
 
267
290
  # delete expired non-recurring reminders
268
- @reminders.reject! {|x| x.date.to_time < @now if not x.recurring }
291
+ @reminders.reject! {|x| x.date.to_time < @now if not x.recurring }
269
292
 
270
293
  @reminders.sort_by!(&:date)
271
294
 
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.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  n+SSd9dm8JjhZ2pqHtX+bgMZ18hrN06xfR+UPtk5BKC8v1PC0FWxaVR4lom39rFU
32
32
  seDxJNsJgamAKg==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-04-14 00:00:00.000000000 Z
34
+ date: 2017-05-01 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
metadata.gz.sig CHANGED
Binary file