icalPal 1.0.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 +7 -0
- data/README.md +184 -0
- data/bin/icalPal +204 -0
- data/icalPal.gemspec +21 -0
- data/lib/EventKit.rb +44 -0
- data/lib/ToICalPal.rb +177 -0
- data/lib/calendar.rb +24 -0
- data/lib/defaults.rb +64 -0
- data/lib/event.rb +283 -0
- data/lib/icalPal.rb +82 -0
- data/lib/options.rb +268 -0
- data/lib/rdt.rb +58 -0
- data/lib/store.rb +19 -0
- metadata +58 -0
data/lib/rdt.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module ICalPal
|
4
|
+
# Child class of DateTime that adds support for relative dates (<em><b>R</b>elative<b>D</b>ate<b>T</b>ime</em>).
|
5
|
+
class RDT < DateTime
|
6
|
+
# Convert a String to an RDT
|
7
|
+
#
|
8
|
+
# @param str [String] can be +yesterday+, +today+, +tomorrow+,
|
9
|
+
# <code>+N</code>, or +-N+. Otherwise use DateTime.parse.
|
10
|
+
#
|
11
|
+
# @return [RDT] a new RDT
|
12
|
+
def self.conv(str)
|
13
|
+
case str
|
14
|
+
when 'yesterday' then $today - 1
|
15
|
+
when 'today' then $today
|
16
|
+
when 'tomorrow' then $today + 1
|
17
|
+
when /^\+([0-9]+)/ then $today + $1.to_i
|
18
|
+
when /^\-([0-9]+)/ then $today - $1.to_i
|
19
|
+
else parse(str)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Values can be +day before yesterday+, +yesterday+,
|
24
|
+
# +today+, +tomorrow+, +day after tomorrow+, or the result from
|
25
|
+
# strftime
|
26
|
+
#
|
27
|
+
# @return [String] A string representation of self relative to
|
28
|
+
# today.
|
29
|
+
def to_s
|
30
|
+
return strftime($opts[:df]) if $opts[:nrd] && $opts[:df]
|
31
|
+
|
32
|
+
d1 = RDT.new(year, month, day)
|
33
|
+
|
34
|
+
case Integer(d1 - $today)
|
35
|
+
when -2 then 'day before yesterday'
|
36
|
+
when -1 then 'yesterday'
|
37
|
+
when 0 then 'today'
|
38
|
+
when 1 then 'tomorrow'
|
39
|
+
when 2 then 'day after tomorrow'
|
40
|
+
else strftime($opts[:df]) if $opts[:df]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
alias inspect to_s
|
45
|
+
|
46
|
+
# @see Time.to_a
|
47
|
+
#
|
48
|
+
# @return [Array] Self as an array
|
49
|
+
def to_a
|
50
|
+
[ year, month, day, hour, min, sec ]
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Integer] Seconds since epoch
|
54
|
+
def to_i
|
55
|
+
to_time.to_i
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/store.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module ICalPal
|
2
|
+
# Class representing items from the <tt>Store</tt> table
|
3
|
+
class Store
|
4
|
+
include ICalPal
|
5
|
+
|
6
|
+
QUERY = <<~SQL
|
7
|
+
SELECT DISTINCT
|
8
|
+
|
9
|
+
Store.name AS account,
|
10
|
+
*
|
11
|
+
|
12
|
+
FROM #{self.name.split('::').last}
|
13
|
+
|
14
|
+
WHERE Store.disabled IS NOT 1
|
15
|
+
AND Store.display_order IS NOT -1
|
16
|
+
SQL
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: icalPal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Rosen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
Inspired by icalBuddy and maintains close compatability. Includes
|
15
|
+
many additional features for querying, filtering, and formatting.
|
16
|
+
email: ajr@corp.mlfs.org
|
17
|
+
executables:
|
18
|
+
- icalPal
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.md
|
22
|
+
files:
|
23
|
+
- README.md
|
24
|
+
- bin/icalPal
|
25
|
+
- icalPal.gemspec
|
26
|
+
- lib/EventKit.rb
|
27
|
+
- lib/ToICalPal.rb
|
28
|
+
- lib/calendar.rb
|
29
|
+
- lib/defaults.rb
|
30
|
+
- lib/event.rb
|
31
|
+
- lib/icalPal.rb
|
32
|
+
- lib/options.rb
|
33
|
+
- lib/rdt.rb
|
34
|
+
- lib/store.rb
|
35
|
+
homepage: https://github.com/ajrosen/icalPal
|
36
|
+
licenses:
|
37
|
+
- GPL-3.0+
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.6.0
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubygems_version: 3.4.6
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Command-line tool to query the macOS Calendar
|
58
|
+
test_files: []
|