gnu-remind 0.2.0 → 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: f3a65fb4fd6cfecb566b294ebec92687fff9ea4cce140a6c79a86287b35b771d
4
- data.tar.gz: 61e0e752c2a17d67334f0472c078e50a4ec37258773515e42a32268d98d84f70
3
+ metadata.gz: 7a58f3a6894c78ad5307599857e12d935d930adbd46a2b1baa7839b1a7f40868
4
+ data.tar.gz: d2dd9790c0f9f755c991e392452219089e71d4e33a7c241bbc771e3acfaeac6d
5
5
  SHA512:
6
- metadata.gz: eb222815e789273533570469b18499fa86743e0e9ebdac7a21b32cb50f356b38d660bbd6e33b0f91a94af6852ac384af795aeb6fa60ef9bc0be45993d6ee2377
7
- data.tar.gz: c9c8a5d4c96db394e9bfc1c3416d98219de2d8c20baf9419ccb48f690c47682567e73cb041ac1fffbc69e5aa6cc205e0db827737ff7c459a23c0eea9b5793536
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
@@ -6,10 +6,10 @@ module EVENT
6
6
  # Event +i+.
7
7
  def initialize i
8
8
  if @event = Nickel.parse(i)
9
- puts %[EVENT event: #{@event}]
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.2.0"
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.2.0
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,8 +64,6 @@ files:
64
64
  - LICENSE.txt
65
65
  - README.md
66
66
  - Rakefile
67
- - gnu-remind-0.1.8.gem
68
- - gnu-remind-0.1.9.gem
69
67
  - lib/remind.rb
70
68
  - lib/remind/calendar.rb
71
69
  - lib/remind/event.rb
data/gnu-remind-0.1.8.gem DELETED
Binary file
data/gnu-remind-0.1.9.gem DELETED
Binary file