gnu-remind 0.1.9 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 852847d0fb94591dece3c07d9312aeb1a1a79f763d9c1d8b8fe12d54df58edc9
4
- data.tar.gz: c187f80a3fb175b6f91c1ced9dbb95811a850a12e8380c1b83008eff5f98189a
3
+ metadata.gz: 7a58f3a6894c78ad5307599857e12d935d930adbd46a2b1baa7839b1a7f40868
4
+ data.tar.gz: d2dd9790c0f9f755c991e392452219089e71d4e33a7c241bbc771e3acfaeac6d
5
5
  SHA512:
6
- metadata.gz: 719856762c828bc51c6983b0a05928f00f3dcabea349c6aa096e621667eea1ac7f57721150ec39e366c27295aa8780128a08a567909d73b96ec58ba5ab89241b
7
- data.tar.gz: 5694f948015c39695dfae99a759323fe27936d39b25b8ab545adb45681f5af9a5c00fb5ea3ca7a4218ce194a2501c9e2ffd85d55ad246801d4215ef7a70eeaed
6
+ metadata.gz: 2160c533701402d36cb2d631c4c05e85d9d33a06b180c05a1f6ebd01ea5647f9cab9d2007f23da4c8f7e08618f91633a849fbb3f566f6b642eaac019aa7f86ed
7
+ data.tar.gz: f9742104e26f6f69bf69b84e0ba11f0654738c230802a894f9a309c7a87ebeffa0f729e90b319fe9f3b3482f5ca32bd07a0f176fd191aa36f4a52e2775005ba6
@@ -1,6 +1,10 @@
1
+ #
1
2
  # Icalendar wrapper.
3
+ #
4
+ # Allows injection of ics calender events from either a remote server or file.
5
+ # Meant to provide the backbone event source for local reminders.
6
+ #
2
7
  module CAL
3
-
4
8
  # Calendar object.
5
9
  class C
6
10
  # Calendar +f+
data/lib/remind/event.rb CHANGED
@@ -5,11 +5,11 @@ module EVENT
5
5
  class E
6
6
  # Event +i+.
7
7
  def initialize i
8
- if @event = Nickel.parse i
9
- puts %[EVENT event: #{@event}]
8
+ if @event = Nickel.parse(i)
9
+ # puts %[EVENT event: #{@event}]
10
10
  @message = @event.message
11
11
  else
12
- puts %[EVENT log]
12
+ # puts %[EVENT log]
13
13
  t = Time.now.utc
14
14
  @message = i
15
15
  end
@@ -28,9 +28,14 @@ module EVENT
28
28
  h = {
29
29
  message: @message,
30
30
  date: e.start_date.to_date.strftime("%-d %b %Y"),
31
- hour: e.start_time.to_time.strftime("%k"),
32
- minute: e.start_time.to_time.strftime("%M")
33
31
  }
32
+ if e.start_time
33
+ h[:hour] = e.start_time.to_time.strftime("%k")
34
+ h[:minute] = e.start_time.to_time.strftime("%M")
35
+ else
36
+ h[:hour] = "00"
37
+ h[:minute] = "00"
38
+ end
34
39
  puts %[each message: #{h}]
35
40
  b.call(h, e)
36
41
  }
data/lib/remind/remind.rb CHANGED
@@ -65,7 +65,7 @@ module REM
65
65
  def id; @id; end
66
66
  # Reminder event hash to reminder string.
67
67
  def to_rem
68
- puts %[R[#{@id}] #{@attr}]
68
+ # puts %[R[#{@id}] #{@attr}]
69
69
  a, i = [], [ @id ]
70
70
  if @attr.has_key? :date
71
71
  a << %[#{@attr[:date]}]
@@ -76,8 +76,10 @@ module REM
76
76
  if @attr.has_key? :hour
77
77
  if @attr.has_key? :minute
78
78
  a << %[AT #{@attr[:hour]}:#{@attr[:minute]}]
79
+ i << %[#{@attr[:hour]}:#{@attr[:minute]}]
79
80
  else
80
81
  a << %[AT #{@attr[:hour]}:00]
82
+ i << %[#{@attr[:hour]}:00]
81
83
  end
82
84
  end
83
85
  return %[REM #{a.join(" ")} MSG #{i.join(" ")}\n]
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Remind
4
4
  # version.
5
- VERSION = "0.1.9"
5
+ VERSION = "0.2.1"
6
6
  end
data/lib/remind.rb CHANGED
@@ -15,13 +15,23 @@ require_relative "remind/remind"
15
15
  require_relative "remind/calendar"
16
16
 
17
17
  require_relative "remind/event"
18
-
19
- # The Remind wrapper.
18
+ #
19
+ # THE Remind WRAPPER
20
+ #
21
+ # Allows maintence of multiple reminder sources as well as a collective reminder source
22
+ # Provides multiple ways to create events.
23
+ # ICAL BASE REMINDERS
24
+ # Remind.url "https://mydomain.com/me.ics"
25
+ # CREATE A WHAT/WHEN Event: used mainly to inject base reminder sets.
26
+ # Remind.reminder what: "Sports ball vs. the other team.", when: "15 March 2024 AT 19:00"
27
+ # CREATE A RAW Event: used mainly to inject events in real time from user input.
28
+ # Remind.set "user", "Sports ball game vs. the other team March 15 2024 7pm."
29
+ #
20
30
  module Remind
21
31
  # generic errors
22
32
  class Error < StandardError; end
23
33
 
24
- @@REM = REM['reminders']
34
+ @@REM = REM['REM']
25
35
 
26
36
  @@INIT = []
27
37
  # Add system event.
@@ -45,12 +55,12 @@ module Remind
45
55
  @@REM.clear!
46
56
 
47
57
  [@@INIT].flatten.each do |x|
48
- puts %[rebuild! x: #{x}]
58
+ # puts %[rebuild! x: #{x}]
49
59
  @@REM[x[:what]].attr = { date: x[:when] }
50
60
  end
51
61
 
52
62
  @@URL.each do |u|
53
- puts %[rebuild! u: #{u}]
63
+ # puts %[rebuild! u: #{u}]
54
64
  CAL.from_url(u).each do |e|
55
65
  d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
56
66
  h = { date: e.when[:begin].to_time.localtime.strftime("%-d %b %Y"), hour: e.when[:begin].to_time.localtime.strftime("%k"), minute: e.when[:begin].to_time.localtime.strftime("%M"), lead: 1 }
@@ -74,12 +84,20 @@ module Remind
74
84
  end
75
85
  REM[k].to_rem! append: true
76
86
  end
77
-
87
+ # alias for Remind.set
88
+ def self.[]= k,v
89
+ Remind.set(k, v)
90
+ end
91
+
78
92
  # Get reminders container +k+
79
93
  # +h[:args]+ can be set to get other filters.
80
94
  # Remind.get("collection")
81
95
  def self.get k, h={}
82
- REM[k].get(h[:args] || '-t1')[1..-1]
96
+ [ @@REM.get(h[:args] || '-t1')[1..-1], REM[k].get(h[:args] || '-t1')[1..-1] ].flatten
97
+ end
98
+ # alias for Remind.get
99
+ def self.[] k
100
+ Remind.get(k)
83
101
  end
84
102
  # Get system reminders
85
103
  # Gets one week's agenda by default.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnu-remind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -64,7 +64,6 @@ files:
64
64
  - LICENSE.txt
65
65
  - README.md
66
66
  - Rakefile
67
- - gnu-remind-0.1.8.gem
68
67
  - lib/remind.rb
69
68
  - lib/remind/calendar.rb
70
69
  - lib/remind/event.rb
data/gnu-remind-0.1.8.gem DELETED
Binary file