icalPal 1.1.3 → 1.1.4

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: 6df02cd393c1f6c4e11afcd99519b50014bfd5205b248cb7fafbfe15392293b8
4
- data.tar.gz: 3ef6ee87c41ea05aaef02faba595801070b420450b9ef05e62996339df93506d
3
+ metadata.gz: a4c83cdb34723fcb8765291ee5724c3a3521d32aa268649631b2ae6e0d597c13
4
+ data.tar.gz: 54c399338c62d6ee482ad5240ede35b0b86b7d796320ec95bc6076485e672365
5
5
  SHA512:
6
- metadata.gz: aaf7e02978bdd9bc596dbe720c6560c53e57e6f79bd98538d417a9880c020f25df0197f77a1a34101455518804dd5409788df2d7f3e1bb76573118f77a040363
7
- data.tar.gz: a1d3435ecad3586f7e5568ebd74dae1d7cc97786f20c613808a73b1ab8e3342d0963cc9eed7002cecb71e63784d80cef26bc6025cc6d22649552ba887c04c6e7
6
+ metadata.gz: d284b817b3c49f1db9ca67920ccced88a4b0c1247b3137a590568f388b60f9b5e79af493cc16f6384a7d7ae09de16f3e578851cf184df9bcc16e8bf8ab8bef53
7
+ data.tar.gz: 716a3c40617e47413ce661157e0bface4671b0b400b1fad3f4bdf0b084d1fc4a9c75f88dfb05a89928749355cce56984692c6e740fd196820a8cb03f06c643aa
data/README.md CHANGED
@@ -181,7 +181,9 @@ to mimic icalBuddy as much as possible.
181
181
  CSV, Hash, JSON, and YAML print all fields for all items in their
182
182
  respective formats. From that you can analyze the results any way you like.
183
183
 
184
- All other formats, ANSI, HTML, Markdown, RDoc, and TOC, use Ruby's
184
+ Remind format uses a minimal implementation built in icalPal.
185
+
186
+ Other formats such as ANSI, HTML, Markdown, RDoc, and TOC, use Ruby's
185
187
  [RDoc::Markup](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup.html)
186
188
  framework to build and render the items.
187
189
 
@@ -207,5 +209,5 @@ objects, one for each of the item's properties:
207
209
 
208
210
  The document will also include a number of
209
211
  [RDoc::Markup::Verbatim](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup/Verbatim.html)
210
- items. The are not included in the output, but are used to pass
212
+ items. They are not included in the output, but are used to pass
211
213
  information about the item and property to the default formatter.
data/bin/icalPal CHANGED
@@ -40,8 +40,10 @@ $log.info("Options: #{$opts}")
40
40
  # Add an item to the list
41
41
  #
42
42
  # @param item[Object]
43
+
43
44
  def add(item)
44
- $log.debug("Adding #{item['UUID']} (#{item['title']})") if item['UUID']
45
+ $log.info("Adding #{item.inspect} #{item['UUID']} (#{item['title']})") if item['UUID']
46
+
45
47
  item['sday'] = ICalPal::RDT.new(*item['sdate'].to_a[0..2]) if item['sdate']
46
48
  $items.push(item)
47
49
  end
@@ -117,6 +119,7 @@ end
117
119
  begin
118
120
  $items.sort_by! { |i| [ i[$opts[:sep]], i[$opts[:sort]], i['sdate'] ] }
119
121
  $items.reverse! if $opts[:reverse]
122
+ $items.uniq!
120
123
  rescue ArgumentError => e
121
124
  $log.warn("Sorting failed, results may be unexpected\n")
122
125
  end
@@ -143,22 +146,24 @@ items = $items[0..$opts[:li] - 1]
143
146
 
144
147
  unless mu
145
148
  puts case $opts[:output]
146
- when 'csv' then
147
- o = {
148
- headers: items[0].keys,
149
- write_converters: proc { |f| f.respond_to?(:gsub)? f.gsub(/\n/, '\n') : f },
150
- write_headers: true,
151
- }
152
-
153
- CSV.generate(o) { |k| items.each { |i| k << i.values.map { |v| v.to_s } } }
154
- when 'hash' then items.map { |i| i.self }
155
- when 'json' then items.map { |i| i.self }.to_json
156
- when 'yaml' then items.map { |i| i.self }.to_yaml
157
- when 'remind' then items.map { |i|
158
- "REM #{i['sdate'].strftime('%F@%T')} MSG #{i['title']}\n"
159
- }.join
160
- else abort "No formatter for #{$opts[:output]}"
161
- end
149
+ when 'csv' then
150
+ o = {
151
+ headers: items[0].keys,
152
+ write_converters: proc { |f| f.respond_to?(:gsub)? f.gsub(/\n/, '\n') : f },
153
+ write_headers: true,
154
+ }
155
+
156
+ CSV.generate(o) { |k| items.each { |i| k << i.values.map { |v| v.to_s } } }
157
+ when 'hash' then items.map { |i| i.self }
158
+ when 'json' then items.map { |i| i.self }.to_json
159
+ when 'yaml' then items.map { |i| i.self }.to_yaml
160
+ when 'remind' then items.map { |i|
161
+ "REM #{i['sdate'].strftime('%F AT %R')} " +
162
+ "DURATION #{((i['edate'] - i['sdate']).to_f * 1440).to_i } " +
163
+ "MSG #{i['title']}"
164
+ }.join("\n")
165
+ else abort "No formatter for #{$opts[:output]}"
166
+ end
162
167
 
163
168
  exit
164
169
  end
data/icalPal.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "icalPal"
3
- s.version = "1.1.3"
3
+ s.version = "1.1.4"
4
4
  s.summary = "Command-line tool to query the macOS Calendar"
5
5
  s.description = <<-EOF
6
6
  Inspired by icalBuddy and maintains close compatability. Includes
@@ -10,12 +10,14 @@ EOF
10
10
  s.authors = "Andy Rosen"
11
11
  s.email = "ajr@corp.mlfs.org"
12
12
  s.homepage = "https://github.com/ajrosen/#{s.name}"
13
- s.licenses = [ "GPL-3.0+" ]
13
+ s.licenses = [ "GPL-3.0-or-later" ]
14
14
 
15
15
  s.files = Dir[ "#{s.name}.gemspec", "bin/*", "lib/*.rb" ]
16
16
  s.executables = [ "#{s.name}" ]
17
17
  s.extra_rdoc_files = [ "README.md" ]
18
18
 
19
+ s.add_runtime_dependency "sqlite3", "~> 1"
20
+
19
21
  s.bindir = 'bin'
20
22
  s.required_ruby_version = '>= 2.6.0'
21
23
  end
data/lib/defaults.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # Does anybody really know what time it is?
2
2
  $now = ICalPal::RDT.now
3
- $today = ICalPal::RDT.new(*$now.to_a[0..2])
3
+ $today = ICalPal::RDT.new(*$now.to_a[0..2] + [0, 0, 0, $now.zone])
4
4
 
5
5
  # Defaults
6
6
  $defaults = {
data/lib/event.rb CHANGED
@@ -3,6 +3,11 @@ module ICalPal
3
3
  class Event
4
4
  include ICalPal
5
5
 
6
+ def []=(k, v)
7
+ @self[k] = v
8
+ @self['sday'] = ICalPal::RDT.new(*self['sdate'].to_a[0..2]) if k == 'sdate'
9
+ end
10
+
6
11
  # Standard accessor with special handling for +age+,
7
12
  # +availability+, +datetime+, +location+, +notes+, +status+,
8
13
  # +title+, and +uid+
@@ -35,6 +40,9 @@ module ICalPal
35
40
  when 'notes' then # \n -> :nnr
36
41
  @self['notes']? @self['notes'].strip.gsub(/\n/, $opts[:nnr]) : nil
37
42
 
43
+ when 'sday' then # pseudo-property
44
+ ICalPal::RDT.new(*@self['sdate'].to_a[0..2])
45
+
38
46
  when 'status' then # Integer -> String
39
47
  EventKit::EKEventStatus.select { |k, v| v == @self['status'] }.keys[0]
40
48
 
@@ -77,14 +85,15 @@ module ICalPal
77
85
  @self["#{k[0]}date"] = RDT.new(*t.to_a.reverse[4..], t.zone) if t
78
86
  end
79
87
 
80
- obj['type'] = EventKit::EKSourceType.find_index { |i| i[:name] == 'Subscribed' } if obj['subcal_url']
81
- type = EventKit::EKSourceType[obj['type']]
82
-
83
88
  if @self['start_tz'] == '_float'
84
89
  @self['sdate'] = RDT.new(*(@self['sdate'].to_time - Time.zone_offset($now.zone())).to_a.reverse[4..], $now.zone)
85
90
  @self['edate'] = RDT.new(*(@self['edate'].to_time - Time.zone_offset($now.zone())).to_a.reverse[4..], $now.zone)
86
91
  end
87
92
 
93
+ # Type of calendar event is from
94
+ obj['type'] = EventKit::EKSourceType.find_index { |i| i[:name] == 'Subscribed' } if obj['subcal_url']
95
+ type = EventKit::EKSourceType[obj['type']]
96
+
88
97
  @self['symbolic_color_name'] ||= @self['color']
89
98
  @self['type'] = type[:name]
90
99
  end
@@ -130,7 +139,6 @@ module ICalPal
130
139
  unless @self['xdate'].any?(@self['sdate']) # Exceptions?
131
140
  o = get_occurrences(changes)
132
141
  o.each { |r| retval.push(r) if in_window?(r['sdate'], r['edate']) }
133
-
134
142
  end
135
143
 
136
144
  apply_frequency!
@@ -145,6 +153,9 @@ module ICalPal
145
153
 
146
154
  # @return a deep clone of self
147
155
  def clone()
156
+ self['stime'] = @self['sdate'].to_i
157
+ self['etime'] = @self['edate'].to_i
158
+
148
159
  Marshal.load(Marshal.dump(self))
149
160
  end
150
161
 
@@ -190,14 +201,14 @@ module ICalPal
190
201
  self['sdate'] = RDT.new(*ndate.to_a[0..2], *self['sdate'].to_a[3..])
191
202
  self['edate'] = RDT.new(*ndate.to_a[0..2], *self['edate'].to_a[3..])
192
203
  retval.push(clone)
193
- }) { |i| @self['sdate'].to_i == i['orig_date'] + ITIME }
204
+ }) { |i| @self['sday'] == i['sday'] }
194
205
  end
195
206
 
196
207
  # Check for changes
197
208
  changes.detect(
198
209
  proc {
199
210
  retval.push(clone)
200
- }) { |i| @self['sdate'].to_i == i['orig_date'] + ITIME } unless retval.count.positive?
211
+ }) { |i| @self['sday'] == i['sday'] } unless retval.count.positive?
201
212
 
202
213
  retval
203
214
  end
data/lib/options.rb CHANGED
@@ -23,7 +23,7 @@ module ICalPal
23
23
  @op = OptionParser.new
24
24
  @op.summary_width = 23
25
25
  @op.banner += " [-c] COMMAND"
26
- @op.version = '1.1.3'
26
+ @op.version = '1.1.4'
27
27
 
28
28
  @op.accept(ICalPal::RDT) { |s| ICalPal::RDT.conv(s) }
29
29
 
metadata CHANGED
@@ -1,40 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalPal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rosen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIID/jCCAmagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBphanIv
14
- REM9Y29ycC9EQz1tbGZzL0RDPW9yZzAeFw0yMzA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D381Hvk760soXcLgrLA1hz5XQwDBFs7N/U7PeztxuurOw4NOb
31
- ctKe1VpldN1JTHdz6u7TAGy0NjC86DF05fvAsEn1baKVZz5P+2OG2FEc+4NWa8/T
32
- +v11ZpnzUfxx2TyCM1hTTaphxjAWEYeeylK+ozjZCopJLNkw6uXuni6TrUUQWRAs
33
- PDmWrfNO9LeQhiYLyVsOQ1xuWKDF0acQFAVIZctRp4VuZZMVqis4FRmqMdZcB/R2
34
- HaQXi3DWVibRuVZ3N77DWUKG
35
- -----END CERTIFICATE-----
36
- date: 2023-07-21 00:00:00.000000000 Z
37
- dependencies: []
10
+ cert_chain: []
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sqlite3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
38
27
  description: |
39
28
  Inspired by icalBuddy and maintains close compatability. Includes
40
29
  many additional features for querying, filtering, and formatting.
@@ -59,9 +48,9 @@ files:
59
48
  - lib/store.rb
60
49
  homepage: https://github.com/ajrosen/icalPal
61
50
  licenses:
62
- - GPL-3.0+
51
+ - GPL-3.0-or-later
63
52
  metadata: {}
64
- post_install_message:
53
+ post_install_message:
65
54
  rdoc_options: []
66
55
  require_paths:
67
56
  - lib
@@ -76,8 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
65
  - !ruby/object:Gem::Version
77
66
  version: '0'
78
67
  requirements: []
79
- rubygems_version: 3.4.15
80
- signing_key:
68
+ rubygems_version: 3.5.4
69
+ signing_key:
81
70
  specification_version: 4
82
71
  summary: Command-line tool to query the macOS Calendar
83
72
  test_files: []
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file