icalPal 1.0.1 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da878f6bb6e44ced393b3e22f9198182876900ed7f6da719a89b940654c247d2
4
- data.tar.gz: 6021823cafd2b926749fd48b7488467741bacd9f3b18d0ab2db309e0680563d6
3
+ metadata.gz: 8e7119ea4a0a4ab593fdaafd6a77b190afae0ee23cdb5977e1b013321d7b9ce7
4
+ data.tar.gz: 1fd3b99ff20db0a4f87adbdc3e8156b16509087f4f6c023023c0b1462327e724
5
5
  SHA512:
6
- metadata.gz: f0a8978b868244d413b89bb314de069353eddd1e23aa6fe5dd65da772254a35e4f1dbe61fe69b780cba91942cb48ec075c99db02b9758d4a12afb4f7342d7e3b
7
- data.tar.gz: 412a7ab706838e783901c416134a2ccee0df65076decf5bbfa93404bc11234e8f32debf7992e4eb2d54227cf7691874d05f31ed82e29aec8b9c11ec572776497
6
+ metadata.gz: 835e84ef0fb7d74bd74b064d0ee6f6a31ca9e6450d9beb49b3dc798b77526ca2bd6e9474d2425d0ccd4d35d60201c8bb54afc68cdc1956715285b7f4a259bd9d
7
+ data.tar.gz: 96b7de3c1fd55bd6acb3d070ef93c7599bb213b6a5dc20b4ecf294e02264a346390f142aad39c2c4ad394a716231405e00f1dc9f4203ed5812d0e193e567819c
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -16,8 +16,6 @@ gem install icalPal
16
16
  icalPal events
17
17
  ```
18
18
 
19
- A [Homebrew](https://brew.sh) formula is in the works.
20
-
21
19
  ## Features
22
20
 
23
21
  ### Compatability with [icalBuddy](https://github.com/ali-rantakari/icalBuddy)
data/bin/icalPal CHANGED
@@ -124,7 +124,6 @@ end
124
124
  # Configure formatting
125
125
  mu = case $opts[:output]
126
126
  when 'ansi' then RDoc::Markup::ToAnsi.new
127
- when 'csv' then proc { |f| f.respond_to?(:gsub)? f.gsub(/\n/, '\n') : f }
128
127
  when 'default' then RDoc::Markup::ToICalPal.new($opts)
129
128
  when 'html' then
130
129
  rdoc = RDoc::Options.new
@@ -140,65 +139,76 @@ mu = case $opts[:output]
140
139
  ##################################################
141
140
  # Print the data
142
141
 
142
+ items = $items[0..$opts[:li] - 1]
143
+
144
+ unless mu
145
+ 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
+ else abort "No formatter for #{$opts[:output]}"
158
+ end
159
+
160
+ exit
161
+ end
162
+
143
163
  section = nil if $opts[:sep]
144
164
 
145
- $items.each_with_index do |i, j|
165
+ items.each_with_index do |i, j|
146
166
  # --li
147
167
  break if $opts[:li].positive? && j >= $opts[:li]
148
168
 
149
- case $opts[:output]
150
- when 'csv' then
151
- values = i.values.map { |v| v.to_s }
152
- puts CSV.generate(write_converters: mu) { |k| k << i.keys } unless j.positive?
153
- puts CSV.generate(write_converters: mu) { |k| k << values }
154
- when 'hash' then p i.self
155
- when 'json' then puts i.self.to_json
156
- when 'yaml' then puts i.self.to_yaml
157
- else
158
- doc = RDoc::Markup::Document.new
169
+ doc = RDoc::Markup::Document.new
159
170
 
160
- # Sections
161
- if $opts[:sep] && section != i[$opts[:sep]]
162
- $log.debug("Section: #{i[$opts[:sep]]}")
171
+ # Sections
172
+ if $opts[:sep] && section != i[$opts[:sep]]
173
+ $log.debug("Section: #{i[$opts[:sep]]}")
163
174
 
164
- v = RDoc::Markup::Verbatim.new
165
- v.format = { item: i, prop: $opts[:sep] }
166
- doc << v
175
+ v = RDoc::Markup::Verbatim.new
176
+ v.format = { item: i, prop: $opts[:sep] }
177
+ doc << v
167
178
 
168
- doc << RDoc::Markup::BlankLine.new if j.positive?
169
- doc << RDoc::Markup::Heading.new(1, i[$opts[:sep]].to_s)
170
- doc << RDoc::Markup::Rule.new(0)
179
+ doc << RDoc::Markup::BlankLine.new if j.positive?
180
+ doc << RDoc::Markup::Heading.new(1, i[$opts[:sep]].to_s)
181
+ doc << RDoc::Markup::Rule.new(0)
171
182
 
172
- section = i[$opts[:sep]]
173
- end
183
+ section = i[$opts[:sep]]
184
+ end
174
185
 
175
- # Item
176
- props = RDoc::Markup::List.new(:BULLET)
186
+ # Item
187
+ props = RDoc::Markup::List.new(:BULLET)
177
188
 
178
- # Properties
179
- $opts[:props].each_with_index do |prop, k|
180
- next unless i[prop]
181
- next if Array === i[prop] && !i[prop][0]
189
+ # Properties
190
+ $opts[:props].each_with_index do |prop, k|
191
+ next unless i[prop]
192
+ next if Array === i[prop] && !i[prop][0]
182
193
 
183
- $log.debug("#{prop}: #{i[prop]}")
194
+ $log.debug("#{prop}: #{i[prop]}")
184
195
 
185
- v = RDoc::Markup::Verbatim.new
186
- v.format = { item: i, prop: prop }
187
- props << v
196
+ v = RDoc::Markup::Verbatim.new
197
+ v.format = { item: i, prop: prop }
198
+ props << v
188
199
 
189
- unless k.positive?
190
- # First property, value only
191
- props << RDoc::Markup::Heading.new(2, i[prop].to_s)
192
- else
193
- props << RDoc::Markup::BlankLine.new unless (i['placeholder'] || $opts[:ps])
194
- props << RDoc::Markup::ListItem.new(prop, RDoc::Markup::Paragraph.new(i[prop]))
195
- end
200
+ unless k.positive?
201
+ # First property, value only
202
+ props << RDoc::Markup::Heading.new(2, i[prop].to_s)
203
+ else
204
+ props << RDoc::Markup::BlankLine.new unless (i['placeholder'] || $opts[:ps])
205
+ props << RDoc::Markup::ListItem.new(prop, RDoc::Markup::Paragraph.new(i[prop]))
196
206
  end
207
+ end
197
208
 
198
- # Print it
199
- unless props.empty?
200
- doc << props
201
- puts doc.accept(mu)
202
- end
209
+ # Print it
210
+ unless props.empty?
211
+ doc << props
212
+ puts doc.accept(mu)
203
213
  end
204
214
  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.0.1"
3
+ s.version = "1.1.0"
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
@@ -95,8 +95,10 @@ module ICalPal
95
95
 
96
96
  # Repeat for multi-day events
97
97
  ((self['duration'] / 86400).to_i + 1).times do |i|
98
- retval.push(Marshal.load(Marshal.dump(self))) if in_window?(self['sdate'])
98
+ self['daynum'] = i + 1
99
+ retval.push(clone) if in_window?(self['sdate'])
99
100
  self['sdate'] += 1
101
+ self['edate'] += 1
100
102
  end
101
103
 
102
104
  retval
@@ -136,6 +138,13 @@ module ICalPal
136
138
 
137
139
  # @!visibility public
138
140
 
141
+ # @return a deep clone of self
142
+ def clone()
143
+ self['stime'] = self['sdate'].to_i
144
+ self['etime'] = self['edate'].to_i
145
+ Marshal.load(Marshal.dump(self))
146
+ end
147
+
139
148
  # Get next occurences of a recurring event
140
149
  #
141
150
  # @param changes [Array] Recurrence changes for the event
@@ -177,14 +186,14 @@ module ICalPal
177
186
  proc {
178
187
  self['sdate'] = RDT.new(*ndate.to_a[0..2], *self['sdate'].to_a[3..])
179
188
  self['edate'] = RDT.new(*ndate.to_a[0..2], *self['edate'].to_a[3..])
180
- retval.push(Marshal.load(Marshal.dump(self)))
189
+ retval.push(clone)
181
190
  }) { |i| @self['sdate'].to_i == i['orig_date'] + ITIME }
182
191
  end
183
192
 
184
193
  # Check for changes
185
194
  changes.detect(
186
195
  proc {
187
- retval.push(Marshal.load(Marshal.dump(self)))
196
+ retval.push(clone)
188
197
  }) { |i| @self['sdate'].to_i == i['orig_date'] + ITIME } unless retval.count.positive?
189
198
 
190
199
  retval
@@ -238,6 +247,7 @@ CalendarItem.availability,
238
247
  CalendarItem.conference_url_detected,
239
248
  CalendarItem.description AS notes,
240
249
  CalendarItem.has_recurrences,
250
+ CalendarItem.invitation_status,
241
251
  CalendarItem.orig_item_id,
242
252
  CalendarItem.rowid,
243
253
  CalendarItem.start_tz,
@@ -258,7 +268,9 @@ Recurrence.count,
258
268
  CAST(Recurrence.end_date AS INT) AS rend_date,
259
269
  Recurrence.frequency,
260
270
  Recurrence.interval,
261
- Recurrence.specifier
271
+ Recurrence.specifier,
272
+
273
+ min(Alarm.trigger_interval) AS trigger_interval
262
274
 
263
275
  FROM Store
264
276
 
@@ -268,7 +280,7 @@ JOIN CalendarItem ON CalendarItem.calendar_id = Calendar.rowid
268
280
  LEFT OUTER JOIN Location ON Location.rowid = CalendarItem.location_id
269
281
  LEFT OUTER JOIN Recurrence ON Recurrence.owner_id = CalendarItem.rowid
270
282
  LEFT OUTER JOIN ExceptionDate ON ExceptionDate.owner_id = CalendarItem.rowid
271
-
283
+ LEFT OUTER JOIN Alarm ON Alarm.calendaritem_owner_id = CalendarItem.rowid
272
284
  LEFT OUTER JOIN Participant ON Participant.owner_id = CalendarItem.rowid
273
285
  LEFT OUTER JOIN Identity ON Identity.rowid = Participant.identity_id
274
286
 
@@ -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.0'
26
+ @op.version = '1.0.2'
27
27
 
28
28
  @op.accept(ICalPal::RDT) { |s| ICalPal::RDT.conv(s) }
29
29
 
@@ -171,9 +171,11 @@ module ICalPal
171
171
  @op.parse!(into: cli)
172
172
  @op.parse!(ENV['ICALPAL'].split, into: env) rescue nil
173
173
  cli[:cf] ||= ENV['ICALPAL_CONFIG'] || $defaults[:common][:cf]
174
- @op.parse!(IO.read(File.expand_path(cli[:cf])).split, into: cf) rescue nil
174
+ @op.parse!(File.read(File.expand_path(cli[:cf])).split, into: cf) rescue nil
175
175
 
176
176
  cli[:cmd] ||= @op.default_argv[0]
177
+ cli[:cmd] ||= env[:cmd] if env[:cmd]
178
+ cli[:cmd] ||= cf[:cmd] if cf[:cmd]
177
179
  cli[:cmd] = 'stores' if cli[:cmd] == 'accounts'
178
180
 
179
181
  # Parse eventsNow and eventsToday commands
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalPal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rosen
@@ -33,7 +33,7 @@ cert_chain:
33
33
  PDmWrfNO9LeQhiYLyVsOQ1xuWKDF0acQFAVIZctRp4VuZZMVqis4FRmqMdZcB/R2
34
34
  HaQXi3DWVibRuVZ3N77DWUKG
35
35
  -----END CERTIFICATE-----
36
- date: 2023-02-23 00:00:00.000000000 Z
36
+ date: 2023-03-05 00:00:00.000000000 Z
37
37
  dependencies: []
38
38
  description: |
39
39
  Inspired by icalBuddy and maintains close compatability. Includes
@@ -48,15 +48,15 @@ files:
48
48
  - README.md
49
49
  - bin/icalPal
50
50
  - icalPal.gemspec
51
+ - lib/Calendar.rb
52
+ - lib/Defaults.rb
53
+ - lib/Event.rb
51
54
  - lib/EventKit.rb
55
+ - lib/ICalPal.rb
56
+ - lib/Options.rb
57
+ - lib/RDT.rb
58
+ - lib/Store.rb
52
59
  - lib/ToICalPal.rb
53
- - lib/calendar.rb
54
- - lib/defaults.rb
55
- - lib/event.rb
56
- - lib/icalPal.rb
57
- - lib/options.rb
58
- - lib/rdt.rb
59
- - lib/store.rb
60
60
  homepage: https://github.com/ajrosen/icalPal
61
61
  licenses:
62
62
  - GPL-3.0+
metadata.gz.sig CHANGED
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes