calview 2.1.0 → 2.1.1
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 +4 -4
- data/bin/calview.rb +37 -12
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35a0f6291e94bfdccef44ba708b5f35cb923ca7a4f6d1fe67cd03c6ccccffc3f
|
|
4
|
+
data.tar.gz: 0d4d1eede6da92ae9915af71aa0f60f4fd42dab838417d4b9da54a337fecb5ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46b63ef8beab029e75f57c8e546c0f7b9c272c0aaaf22ded44d24275b23deb3af2fc01414ed5431637f977c7425d4948929ab10cb3265b0102eb8409916b4971
|
|
7
|
+
data.tar.gz: b7d2afe489ba143214acf69091bcdb466ce02b6839f2d189a2fa0724abd072797108a163aca681f4fbbae703599187e3f66edd1ba0dfd012e2b3c71f0f2b5c39
|
data/bin/calview.rb
CHANGED
|
@@ -155,11 +155,14 @@ class VcalParser
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
def parse
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
unless valid_vcal?
|
|
159
|
+
@event[:error] = "Not a valid iCalendar file (missing BEGIN:VCALENDAR or BEGIN:VEVENT)"
|
|
160
|
+
return @event
|
|
161
|
+
end
|
|
162
|
+
|
|
160
163
|
# Fix multiline participants (single gsub operation)
|
|
161
164
|
@vcal.gsub!(PATTERNS[:multiline_attendee], '\1\2')
|
|
162
|
-
|
|
165
|
+
|
|
163
166
|
# Parse in most likely order of appearance
|
|
164
167
|
parse_summary
|
|
165
168
|
parse_dates_and_times
|
|
@@ -171,7 +174,7 @@ class VcalParser
|
|
|
171
174
|
parse_recurrence
|
|
172
175
|
parse_status
|
|
173
176
|
parse_priority
|
|
174
|
-
|
|
177
|
+
|
|
175
178
|
@event
|
|
176
179
|
end
|
|
177
180
|
|
|
@@ -206,11 +209,11 @@ class VcalParser
|
|
|
206
209
|
|
|
207
210
|
def parse_timezone_dates_fast(start_match)
|
|
208
211
|
load_tzinfo
|
|
209
|
-
|
|
212
|
+
|
|
210
213
|
stz_name = start_match[1]
|
|
211
214
|
sdate = extract_date(start_match[2])
|
|
212
215
|
stime = start_match[3] ? extract_time(start_match[3]) : nil
|
|
213
|
-
|
|
216
|
+
|
|
214
217
|
end_match = @vcal.match(PATTERNS[:dtend_tzid])
|
|
215
218
|
if end_match
|
|
216
219
|
etz_name = end_match[1]
|
|
@@ -221,11 +224,15 @@ class VcalParser
|
|
|
221
224
|
edate = sdate
|
|
222
225
|
etime = stime
|
|
223
226
|
end
|
|
224
|
-
|
|
227
|
+
|
|
228
|
+
# Store timezone identifier for display
|
|
229
|
+
resolved = WINDOWS_TZ[stz_name] || stz_name
|
|
230
|
+
@event[:timezone] = resolved
|
|
231
|
+
|
|
225
232
|
if @tzinfo_loaded && stime && etime
|
|
226
233
|
stz = convert_timezone(stz_name)
|
|
227
234
|
etz = convert_timezone(etz_name)
|
|
228
|
-
|
|
235
|
+
|
|
229
236
|
if stz && etz
|
|
230
237
|
begin
|
|
231
238
|
stime = stz.local_to_utc(Time.parse("#{sdate} #{stime}")).localtime
|
|
@@ -235,7 +242,7 @@ class VcalParser
|
|
|
235
242
|
end
|
|
236
243
|
end
|
|
237
244
|
end
|
|
238
|
-
|
|
245
|
+
|
|
239
246
|
store_date_time_info(sdate, edate, stime, etime)
|
|
240
247
|
end
|
|
241
248
|
|
|
@@ -461,7 +468,12 @@ class CalendarViewer
|
|
|
461
468
|
|
|
462
469
|
def display(event)
|
|
463
470
|
return puts "Error: Invalid or empty calendar file" unless event
|
|
464
|
-
|
|
471
|
+
|
|
472
|
+
if event[:error]
|
|
473
|
+
STDERR.puts "Error: #{event[:error]}"
|
|
474
|
+
exit 1
|
|
475
|
+
end
|
|
476
|
+
|
|
465
477
|
case @format
|
|
466
478
|
when :json
|
|
467
479
|
display_json(event)
|
|
@@ -486,7 +498,8 @@ class CalendarViewer
|
|
|
486
498
|
time_info += ", #{event[:times]}" if event[:times]
|
|
487
499
|
output << "WHEN: #{time_info}"
|
|
488
500
|
end
|
|
489
|
-
|
|
501
|
+
|
|
502
|
+
output << "TIMEZONE: #{event[:timezone]}" if event[:timezone]
|
|
490
503
|
output << "WHERE: #{event[:location]}" if event[:location] && !event[:location].empty?
|
|
491
504
|
output << "RECURRENCE: #{event[:recurrence]}" if event[:recurrence]
|
|
492
505
|
output << "STATUS: #{event[:status]}" if event[:status]
|
|
@@ -552,12 +565,24 @@ if __FILE__ == $0
|
|
|
552
565
|
|
|
553
566
|
begin
|
|
554
567
|
vcal_content = ARGF.read
|
|
568
|
+
rescue Errno::ENOENT => e
|
|
569
|
+
STDERR.puts "Error: File not found: #{e.message}"
|
|
570
|
+
exit 1
|
|
571
|
+
rescue Errno::EACCES => e
|
|
572
|
+
STDERR.puts "Error: Permission denied: #{e.message}"
|
|
573
|
+
exit 1
|
|
574
|
+
rescue => e
|
|
575
|
+
STDERR.puts "Error reading input: #{e.message}"
|
|
576
|
+
exit 1
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
begin
|
|
555
580
|
parser = VcalParser.new(vcal_content)
|
|
556
581
|
event = parser.parse
|
|
557
582
|
viewer = CalendarViewer.new(options)
|
|
558
583
|
viewer.display(event)
|
|
559
584
|
rescue => e
|
|
560
|
-
STDERR.puts "Error: #{e.message}"
|
|
585
|
+
STDERR.puts "Error parsing calendar data: #{e.message}"
|
|
561
586
|
exit 1
|
|
562
587
|
end
|
|
563
588
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: calview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tzinfo
|