icalendar 2.6.1 → 2.7.0

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: 4fd1e657ab9c20d0576627a5d04bcc6991205bf8f086ad8150e5bcbc179f6c49
4
- data.tar.gz: 2a29f3a0da940f8c2caa83bc49e2cfad4cb2fa31b72a64c1b7f200a65571bfb9
3
+ metadata.gz: b22d9bc37f8f10ba08d5b8aa155dfb1b97a9876c800c547271f43ce15f09b89d
4
+ data.tar.gz: 91260efab7eafc852e509258fa0163cd1ac2c41352b9482fcae85a45547fa325
5
5
  SHA512:
6
- metadata.gz: '02840f7036575111fdfce4253131e15b574a38f1f48061229863a52514d661943e119c859a983df0ce3d16818e86a34cbcd9b7e2813fb4b91e38d09d8be5e9e2'
7
- data.tar.gz: 59eb643eafb0a108da246806fe737c58e5592e0baf14af7d04ccd131ebc03e164bd3433ce2eced74e9d2054fa648a52aad64252d3eaecdc6df7a367ebbdf2107
6
+ metadata.gz: a6466ed9d1ae91fd9007b42a8d9001879e601ea5f03c338fceb5dcda03b3b32e27ca115cb3a359560b9c04c8944891a174d3bade9596f84d2ca12808dad3046d
7
+ data.tar.gz: a587f1166316ad6a87602d3026144c3d3e9ca09a6d3ef2a40a0664aa77cd497817894df6d53503f6cdcfd95a99fcc2e66c6a8688af19870de2a199cf9b47511d
@@ -3,12 +3,13 @@ before_install:
3
3
  - gem install bundler
4
4
  language: ruby
5
5
  rvm:
6
+ - 2.7
6
7
  - 2.6
7
8
  - 2.5
8
- - 2.4
9
9
  - jruby-19mode
10
10
  - ruby-head
11
11
  - jruby-head
12
+ - truffleruby-head
12
13
  matrix:
13
14
  allow_failures:
14
15
  - rvm: ruby-head
@@ -1,3 +1,7 @@
1
+ === 2.7.0 2020-09-12
2
+ * Handle custom component names, with and without X- prefix
3
+ * Fix Component lookup to avoid namespace collisions
4
+
1
5
  === 2.6.1 2019-12-07
2
6
  * Improve performance when generating large ICS files - Alex Balhatchet
3
7
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  iCalendar -- Internet calendaring, Ruby style
2
2
  ===
3
3
 
4
- [![Build Status](https://travis-ci.org/icalendar/icalendar.svg?branch=master)](https://travis-ci.org/icalendar/icalendar)
4
+ [![Build Status](https://travis-ci.com/icalendar/icalendar.svg?branch=master)](https://travis-ci.com/icalendar/icalendar)
5
5
  [![Code Climate](https://codeclimate.com/github/icalendar/icalendar.png)](https://codeclimate.com/github/icalendar/icalendar)
6
6
 
7
7
  <http://github.com/icalendar/icalendar>
@@ -115,7 +115,7 @@ cal.event do |e|
115
115
  a.attendee = %w(mailto:me@my-domain.com mailto:me-too@my-domain.com) # one or more email recipients (required)
116
116
  a.append_attendee "mailto:me-three@my-domain.com"
117
117
  a.trigger = "-PT15M" # 15 minutes before
118
- a.append_attach Icalendar::Values::Uri.new "ftp://host.com/novo-procs/felizano.exe", "fmttype" => "application/binary" # email attachments (optional)
118
+ a.append_attach Icalendar::Values::Uri.new("ftp://host.com/novo-procs/felizano.exe", "fmttype" => "application/binary") # email attachments (optional)
119
119
  end
120
120
 
121
121
  e.alarm do |a|
@@ -28,20 +28,19 @@ ActiveSupport is required for TimeWithZone support, but not required for general
28
28
 
29
29
  s.add_dependency 'ice_cube', '~> 0.16'
30
30
 
31
- s.add_development_dependency 'rake', '~> 12.0'
31
+ s.add_development_dependency 'rake', '~> 13.0'
32
32
  s.add_development_dependency 'bundler', '~> 2.0'
33
33
 
34
34
  # test with all groups of tzinfo dependencies
35
35
  # tzinfo 2.x
36
36
  # s.add_development_dependency 'tzinfo', '~> 2.0'
37
- # s.add_development_dependency 'tzinfo-data', '~> 1.2018'
37
+ # s.add_development_dependency 'tzinfo-data', '~> 1.2020'
38
38
  # tzinfo 1.x
39
- s.add_development_dependency 'activesupport', '~> 5.2'
40
- s.add_development_dependency 'i18n', '~> 1.1'
39
+ s.add_development_dependency 'activesupport', '~> 6.0'
40
+ s.add_development_dependency 'i18n', '~> 1.8'
41
41
  s.add_development_dependency 'tzinfo', '~> 1.2'
42
- s.add_development_dependency 'tzinfo-data', '~> 1.2018'
42
+ s.add_development_dependency 'tzinfo-data', '~> 1.2020'
43
43
  # tzinfo 0.x
44
- # s.add_development_dependency 'i18n', '~> 0.7'
45
44
  # s.add_development_dependency 'tzinfo', '~> 0.3'
46
45
  # end tzinfo
47
46
 
@@ -21,21 +21,33 @@ module Icalendar
21
21
  c
22
22
  end
23
23
 
24
+ def add_custom_component(component_name, c)
25
+ c.parent = self
26
+ yield c if block_given?
27
+ (custom_components[component_name.downcase.gsub("-", "_")] ||= []) << c
28
+ c
29
+ end
30
+
31
+ def custom_component(component_name)
32
+ custom_components[component_name.downcase.gsub("-", "_")] || []
33
+ end
34
+
24
35
  def method_missing(method, *args, &block)
25
36
  method_name = method.to_s
26
37
  if method_name =~ /^add_(x_\w+)$/
27
38
  component_name = $1
28
39
  custom = args.first || Component.new(component_name, component_name.upcase)
29
- (custom_components[component_name] ||= []) << custom
30
- yield custom if block_given?
31
- custom
40
+ add_custom_component(component_name, custom, &block)
41
+ elsif method_name =~ /^x_/ && custom_component(method_name).size > 0
42
+ custom_component method_name
32
43
  else
33
44
  super
34
45
  end
35
46
  end
36
47
 
37
48
  def respond_to_missing?(method_name, include_private = false)
38
- method_name.to_s.start_with?('add_x_') || super
49
+ string_method = method_name.to_s
50
+ string_method.start_with?('add_x_') || custom_component(string_method).size > 0 || super
39
51
  end
40
52
 
41
53
  module ClassMethods
@@ -82,8 +82,8 @@ module Icalendar
82
82
  if !fields[:params]['value'].nil?
83
83
  klass_name = fields[:params].delete('value').first
84
84
  unless klass_name.upcase == klass.value_type
85
- klass_name = klass_name.downcase.gsub(/(?:\A|-)(.)/) { |m| m[-1].upcase }
86
- klass = Icalendar::Values.const_get klass_name if Icalendar::Values.const_defined?(klass_name)
85
+ klass_name = "Icalendar::Values::#{klass_name.downcase.gsub(/(?:\A|-)(.)/) { |m| m[-1].upcase }}"
86
+ klass = Object.const_get klass_name if Object.const_defined?(klass_name)
87
87
  end
88
88
  end
89
89
  klass
@@ -106,14 +106,14 @@ module Icalendar
106
106
  timezone_store.store(component) if klass_name == 'Timezone'
107
107
  break
108
108
  elsif fields[:name] == 'begin'
109
- klass_name = fields[:value].gsub(/\AV/, '').downcase.capitalize
109
+ klass_name = fields[:value].gsub(/\AV/, '').gsub("-", "_").downcase.capitalize
110
110
  Icalendar.logger.debug "Adding component #{klass_name}"
111
- if Icalendar.const_defined? klass_name
112
- component.add_component parse_component(Icalendar.const_get(klass_name).new)
113
- elsif Icalendar::Timezone.const_defined? klass_name
114
- component.add_component parse_component(Icalendar::Timezone.const_get(klass_name).new)
111
+ if Object.const_defined? "Icalendar::#{klass_name}"
112
+ component.add_component parse_component(Object.const_get("Icalendar::#{klass_name}").new)
113
+ elsif Object.const_defined? "Icalendar::Timezone::#{klass_name}"
114
+ component.add_component parse_component(Object.const_get("Icalendar::Timezone::#{klass_name}").new)
115
115
  else
116
- component.add_component parse_component(Component.new klass_name.downcase, fields[:value])
116
+ component.add_custom_component klass_name, parse_component(Component.new klass_name.downcase, fields[:value])
117
117
  end
118
118
  else
119
119
  parse_property component, fields
@@ -1,5 +1,5 @@
1
1
  module Icalendar
2
2
 
3
- VERSION = '2.6.1'
3
+ VERSION = '2.7.0'
4
4
 
5
5
  end
@@ -0,0 +1,158 @@
1
+ BEGIN:VCALENDAR
2
+ PRODID:-//Atlassian Confluence//Calendar Plugin 1.0//EN
3
+ VERSION:2.0
4
+ CALSCALE:GREGORIAN
5
+ X-WR-CALNAME:Grimsell testkalender
6
+ X-WR-CALDESC:
7
+ X-WR-TIMEZONE:Europe/Stockholm
8
+ X-MIGRATED-FOR-USER-KEY:true
9
+ METHOD:PUBLISH
10
+ BEGIN:VTIMEZONE
11
+ TZID:Europe/Stockholm
12
+ TZURL:http://tzurl.org/zoneinfo/Europe/Stockholm
13
+ SEQUENCE:9206
14
+ BEGIN:DAYLIGHT
15
+ TZOFFSETFROM:+0100
16
+ TZOFFSETTO:+0200
17
+ TZNAME:CEST
18
+ DTSTART:19810329T020000
19
+ RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
20
+ END:DAYLIGHT
21
+ BEGIN:STANDARD
22
+ TZOFFSETFROM:+0200
23
+ TZOFFSETTO:+0100
24
+ TZNAME:CET
25
+ DTSTART:19961027T030000
26
+ RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
27
+ END:STANDARD
28
+ BEGIN:STANDARD
29
+ TZOFFSETFROM:+011212
30
+ TZOFFSETTO:+010014
31
+ TZNAME:SET
32
+ DTSTART:18790101T000000
33
+ RDATE:18790101T000000
34
+ END:STANDARD
35
+ BEGIN:STANDARD
36
+ TZOFFSETFROM:+010014
37
+ TZOFFSETTO:+0100
38
+ TZNAME:CET
39
+ DTSTART:19000101T000000
40
+ RDATE:19000101T000000
41
+ END:STANDARD
42
+ BEGIN:DAYLIGHT
43
+ TZOFFSETFROM:+0100
44
+ TZOFFSETTO:+0200
45
+ TZNAME:CEST
46
+ DTSTART:19160514T230000
47
+ RDATE:19160514T230000
48
+ RDATE:19800406T020000
49
+ END:DAYLIGHT
50
+ BEGIN:STANDARD
51
+ TZOFFSETFROM:+0200
52
+ TZOFFSETTO:+0100
53
+ TZNAME:CET
54
+ DTSTART:19161001T010000
55
+ RDATE:19161001T010000
56
+ RDATE:19800928T030000
57
+ RDATE:19810927T030000
58
+ RDATE:19820926T030000
59
+ RDATE:19830925T030000
60
+ RDATE:19840930T030000
61
+ RDATE:19850929T030000
62
+ RDATE:19860928T030000
63
+ RDATE:19870927T030000
64
+ RDATE:19880925T030000
65
+ RDATE:19890924T030000
66
+ RDATE:19900930T030000
67
+ RDATE:19910929T030000
68
+ RDATE:19920927T030000
69
+ RDATE:19930926T030000
70
+ RDATE:19940925T030000
71
+ RDATE:19950924T030000
72
+ END:STANDARD
73
+ BEGIN:STANDARD
74
+ TZOFFSETFROM:+0100
75
+ TZOFFSETTO:+0100
76
+ TZNAME:CET
77
+ DTSTART:19800101T000000
78
+ RDATE:19800101T000000
79
+ END:STANDARD
80
+ END:VTIMEZONE
81
+ BEGIN:VEVENT
82
+ DTSTAMP:20151203T104347Z
83
+ SUMMARY:Kaffepaus
84
+ UID:20151203T101856Z-1543254179@intranet.idainfront.se
85
+ DESCRIPTION:
86
+ ORGANIZER;X-CONFLUENCE-USER-KEY=ff80818141e4d3b60141e4d4b75700a2;CN=Magnu
87
+ s Grimsell;CUTYPE=INDIVIDUAL:mailto:magnus.grimsell@idainfront.se
88
+ CREATED:20151203T101856Z
89
+ LAST-MODIFIED:20151203T101856Z
90
+ SEQUENCE:1
91
+ X-CONFLUENCE-SUBCALENDAR-TYPE:other
92
+ TRANSP:OPAQUE
93
+ STATUS:CONFIRMED
94
+ DTSTART:20151203T090000Z
95
+ DTEND:20151203T091500Z
96
+ END:VEVENT
97
+ BEGIN:X-EVENT-SERIES
98
+ SUMMARY:iipax - Sprints
99
+ DESCRIPTION:
100
+ X-CONFLUENCE-SUBCALENDAR-TYPE:jira-agile-sprint
101
+ URL:jira://8112ef9a-343e-30e6-b469-4f993bf0371d?projectKey=II&dateFieldNa
102
+ me=sprint
103
+ END:X-EVENT-SERIES
104
+ BEGIN:VEVENT
105
+ DTSTAMP:20151203T104348Z
106
+ DTSTART;TZID=Europe/Stockholm:20130115T170800
107
+ DTEND;TZID=Europe/Stockholm:20130204T170800
108
+ UID:3cb4df4b-eb18-43fd-934a-16c15acfb4b1-3@jira.idainfront.se
109
+ X-GREENHOPPER-SPRINT-CLOSED:false
110
+ X-GREENHOPPER-SPRINT-EDITABLE:true
111
+ X-JIRA-PROJECT;X-JIRA-PROJECT-KEY=II:iipax
112
+ X-GREENHOPPER-SPRINT-VIEWBOARDS-URL:https://jira.idainfront.se/secure/GHG
113
+ oToBoard.jspa?sprintId=3
114
+ SEQUENCE:0
115
+ X-CONFLUENCE-SUBCALENDAR-TYPE:jira-agile-sprint
116
+ TRANSP:OPAQUE
117
+ STATUS:CONFIRMED
118
+ DESCRIPTION:https://jira.idainfront.se/secure/GHGoToBoard.jspa?sprintId=3
119
+
120
+ SUMMARY:iipax - Callisto-6
121
+ END:VEVENT
122
+ BEGIN:VEVENT
123
+ DTSTAMP:20151203T104348Z
124
+ DTSTART;TZID=Europe/Stockholm:20130219T080000
125
+ DTEND;TZID=Europe/Stockholm:20130319T095900
126
+ UID:3cb4df4b-eb18-43fd-934a-16c15acfb4b1-5@jira.idainfront.se
127
+ X-GREENHOPPER-SPRINT-CLOSED:false
128
+ X-GREENHOPPER-SPRINT-EDITABLE:true
129
+ X-JIRA-PROJECT;X-JIRA-PROJECT-KEY=II:iipax
130
+ X-GREENHOPPER-SPRINT-VIEWBOARDS-URL:https://jira.idainfront.se/secure/GHG
131
+ oToBoard.jspa?sprintId=5
132
+ SEQUENCE:0
133
+ X-CONFLUENCE-SUBCALENDAR-TYPE:jira-agile-sprint
134
+ TRANSP:OPAQUE
135
+ STATUS:CONFIRMED
136
+ DESCRIPTION:https://jira.idainfront.se/secure/GHGoToBoard.jspa?sprintId=5
137
+
138
+ SUMMARY:iipax - Bulbasaur
139
+ END:VEVENT
140
+ BEGIN:VEVENT
141
+ DTSTAMP:20151203T104348Z
142
+ DTSTART;TZID=Europe/Stockholm:20130326T105900
143
+ DTEND;TZID=Europe/Stockholm:20130419T105900
144
+ UID:3cb4df4b-eb18-43fd-934a-16c15acfb4b1-7@jira.idainfront.se
145
+ X-GREENHOPPER-SPRINT-CLOSED:true
146
+ X-GREENHOPPER-SPRINT-EDITABLE:true
147
+ X-JIRA-PROJECT;X-JIRA-PROJECT-KEY=II:iipax
148
+ X-GREENHOPPER-SPRINT-VIEWBOARDS-URL:https://jira.idainfront.se/secure/GHG
149
+ oToBoard.jspa?sprintId=7
150
+ SEQUENCE:0
151
+ X-CONFLUENCE-SUBCALENDAR-TYPE:jira-agile-sprint
152
+ TRANSP:OPAQUE
153
+ STATUS:CONFIRMED
154
+ DESCRIPTION:https://jira.idainfront.se/secure/GHGoToBoard.jspa?sprintId=7
155
+
156
+ SUMMARY:iipax - Ivysaur
157
+ END:VEVENT
158
+ END:VCALENDAR
@@ -66,6 +66,16 @@ describe Icalendar::Parser do
66
66
  expect(event.dtstart.utc).to eq Time.parse("20180104T150000Z")
67
67
  end
68
68
  end
69
+ context 'custom_component.ics' do
70
+ let(:fn) { 'custom_component.ics' }
71
+
72
+ it 'correctly handles custom named components' do
73
+ parsed = subject.parse
74
+ calendar = parsed.first
75
+ expect(calendar.custom_component('x_event_series').size).to eq 1
76
+ expect(calendar.custom_component('X-EVENT-SERIES').size).to eq 1
77
+ end
78
+ end
69
79
  end
70
80
 
71
81
  describe '#parse with bad line' do
@@ -135,6 +135,15 @@ describe Icalendar do
135
135
  ical = subject.parse.first.to_ical
136
136
  expect(ical).to include 'CUSTOMFIELD:Not properly noted as custom with X- prefix.'
137
137
  end
138
+
139
+ context 'custom components' do
140
+ let(:source) { File.read File.join(File.dirname(__FILE__), 'fixtures', 'custom_component.ics') }
141
+
142
+ it 'can output the custom component' do
143
+ ical = subject.parse.first.to_ical
144
+ expect(ical).to include 'BEGIN:X-EVENT-SERIES'
145
+ end
146
+ end
138
147
  end
139
148
  end
140
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-07 00:00:00.000000000 Z
11
+ date: 2020-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ice_cube
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.2'
61
+ version: '6.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.2'
68
+ version: '6.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: i18n
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '1.8'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '1.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: tzinfo
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.2018'
103
+ version: '1.2020'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.2018'
110
+ version: '1.2020'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: timecop
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +210,7 @@ files:
210
210
  - spec/calendar_spec.rb
211
211
  - spec/downcased_hash_spec.rb
212
212
  - spec/event_spec.rb
213
+ - spec/fixtures/custom_component.ics
213
214
  - spec/fixtures/event.ics
214
215
  - spec/fixtures/nondefault_values.ics
215
216
  - spec/fixtures/nonstandard.ics
@@ -261,8 +262,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
262
  - !ruby/object:Gem::Version
262
263
  version: '0'
263
264
  requirements: []
264
- rubygems_version: 3.0.3
265
- signing_key:
265
+ rubygems_version: 3.1.2
266
+ signing_key:
266
267
  specification_version: 4
267
268
  summary: A ruby implementation of the iCalendar specification (RFC-5545).
268
269
  test_files:
@@ -270,6 +271,7 @@ test_files:
270
271
  - spec/calendar_spec.rb
271
272
  - spec/downcased_hash_spec.rb
272
273
  - spec/event_spec.rb
274
+ - spec/fixtures/custom_component.ics
273
275
  - spec/fixtures/event.ics
274
276
  - spec/fixtures/nondefault_values.ics
275
277
  - spec/fixtures/nonstandard.ics