tilia-vobject 4.0.0.pre.alpha5 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.sabre.md +59 -2
- data/Gemfile +1 -8
- data/Gemfile.lock +18 -12
- data/LICENSE +1 -1
- data/LICENSE.sabre +1 -1
- data/lib/tilia/v_object.rb +1 -0
- data/lib/tilia/v_object/birthday_calendar_generator.rb +11 -11
- data/lib/tilia/v_object/cli.rb +39 -38
- data/lib/tilia/v_object/component.rb +47 -50
- data/lib/tilia/v_object/component/available.rb +4 -37
- data/lib/tilia/v_object/component/v_alarm.rb +6 -18
- data/lib/tilia/v_object/component/v_availability.rb +6 -39
- data/lib/tilia/v_object/component/v_calendar.rb +66 -98
- data/lib/tilia/v_object/component/v_card.rb +42 -69
- data/lib/tilia/v_object/component/v_event.rb +5 -17
- data/lib/tilia/v_object/component/v_free_busy.rb +4 -16
- data/lib/tilia/v_object/component/v_journal.rb +16 -16
- data/lib/tilia/v_object/component/v_time_zone.rb +2 -14
- data/lib/tilia/v_object/component/v_todo.rb +17 -36
- data/lib/tilia/v_object/date_time_parser.rb +24 -24
- data/lib/tilia/v_object/document.rb +25 -25
- data/lib/tilia/v_object/free_busy_data.rb +7 -7
- data/lib/tilia/v_object/free_busy_generator.rb +73 -75
- data/lib/tilia/v_object/i_tip.rb +1 -0
- data/lib/tilia/v_object/i_tip/broker.rb +134 -116
- data/lib/tilia/v_object/i_tip/i_tip_exception.rb +1 -1
- data/lib/tilia/v_object/i_tip/message.rb +13 -13
- data/lib/tilia/v_object/invalid_data_exception.rb +8 -0
- data/lib/tilia/v_object/node.rb +22 -27
- data/lib/tilia/v_object/parameter.rb +22 -22
- data/lib/tilia/v_object/parse_exception.rb +1 -1
- data/lib/tilia/v_object/parser.rb +1 -0
- data/lib/tilia/v_object/parser/json.rb +9 -19
- data/lib/tilia/v_object/parser/mime_dir.rb +73 -39
- data/lib/tilia/v_object/parser/parser.rb +9 -14
- data/lib/tilia/v_object/parser/xml.rb +33 -50
- data/lib/tilia/v_object/parser/xml/element.rb +1 -0
- data/lib/tilia/v_object/parser/xml/element/key_value.rb +2 -2
- data/lib/tilia/v_object/property.rb +52 -52
- data/lib/tilia/v_object/property/binary.rb +10 -10
- data/lib/tilia/v_object/property/boolean.rb +6 -6
- data/lib/tilia/v_object/property/flat_text.rb +3 -3
- data/lib/tilia/v_object/property/float_value.rb +10 -10
- data/lib/tilia/v_object/property/i_calendar.rb +1 -0
- data/lib/tilia/v_object/property/i_calendar/cal_address.rb +3 -3
- data/lib/tilia/v_object/property/i_calendar/date_time.rb +29 -57
- data/lib/tilia/v_object/property/i_calendar/duration.rb +6 -6
- data/lib/tilia/v_object/property/i_calendar/period.rb +10 -10
- data/lib/tilia/v_object/property/i_calendar/recur.rb +16 -24
- data/lib/tilia/v_object/property/integer_value.rb +8 -8
- data/lib/tilia/v_object/property/text.rb +21 -36
- data/lib/tilia/v_object/property/time.rb +29 -6
- data/lib/tilia/v_object/property/unknown.rb +2 -2
- data/lib/tilia/v_object/property/uri.rb +24 -5
- data/lib/tilia/v_object/property/utc_offset.rb +5 -5
- data/lib/tilia/v_object/property/v_card.rb +1 -0
- data/lib/tilia/v_object/property/v_card/date.rb +3 -3
- data/lib/tilia/v_object/property/v_card/date_and_or_time.rb +30 -42
- data/lib/tilia/v_object/property/v_card/date_time.rb +1 -1
- data/lib/tilia/v_object/property/v_card/language_tag.rb +4 -4
- data/lib/tilia/v_object/property/v_card/time_stamp.rb +5 -5
- data/lib/tilia/v_object/reader.rb +12 -11
- data/lib/tilia/v_object/recur.rb +2 -0
- data/lib/tilia/v_object/recur/event_iterator.rb +30 -27
- data/lib/tilia/v_object/recur/max_instances_exceeded_exception.rb +10 -0
- data/lib/tilia/v_object/recur/no_instances_exception.rb +1 -1
- data/lib/tilia/v_object/recur/r_date_iterator.rb +15 -41
- data/lib/tilia/v_object/recur/r_rule_iterator.rb +23 -156
- data/lib/tilia/v_object/settings.rb +16 -0
- data/lib/tilia/v_object/splitter.rb +1 -0
- data/lib/tilia/v_object/splitter/i_calendar.rb +5 -5
- data/lib/tilia/v_object/splitter/splitter_interface.rb +2 -2
- data/lib/tilia/v_object/splitter/v_card.rb +5 -5
- data/lib/tilia/v_object/string_util.rb +25 -9
- data/lib/tilia/v_object/time_zone_data.rb +1 -0
- data/lib/tilia/v_object/time_zone_util.rb +6 -6
- data/lib/tilia/v_object/uuid_util.rb +3 -3
- data/lib/tilia/v_object/v_card_converter.rb +24 -21
- data/lib/tilia/v_object/version.rb +1 -1
- data/lib/tilia/v_object/writer.rb +7 -7
- data/test/test_helper.rb +3 -3
- data/test/v_object/birthday_calendar_generator_test.rb +22 -0
- data/test/v_object/component/v_alarm_test.rb +3 -1
- data/test/v_object/component/v_calendar_test.rb +40 -4
- data/test/v_object/component/v_card_test.rb +1 -1
- data/test/v_object/component_test.rb +5 -3
- data/test/v_object/date_time_parser_test.rb +15 -5
- data/test/v_object/free_busy_generator_test.rb +5 -5
- data/test/v_object/i_tip/broker_attendee_reply_test.rb +19 -0
- data/test/v_object/i_tip/broker_delete_event_test.rb +146 -2
- data/test/v_object/i_tip/broker_new_event_test.rb +21 -0
- data/test/v_object/i_tip/broker_process_reply_test.rb +10 -0
- data/test/v_object/i_tip/broker_tester.rb +1 -1
- data/test/v_object/i_tip/broker_update_event_test.rb +36 -0
- data/test/v_object/issue259_test.rb +24 -0
- data/test/v_object/issue40_test.rb +3 -1
- data/test/v_object/j_cal_test.rb +15 -12
- data/test/v_object/parser/json_test.rb +5 -5
- data/test/v_object/parser/mime_dir_test.rb +109 -0
- data/test/v_object/property/binary_test.rb +4 -2
- data/test/v_object/property/i_calendar/date_time_test.rb +3 -1
- data/test/v_object/property/uri_test.rb +23 -0
- data/test/v_object/recur/event_iterator/by_month_in_daily_test.rb +1 -1
- data/test/v_object/recur/event_iterator/by_set_pos_hang_test.rb +1 -1
- data/test/v_object/recur/event_iterator/expand_floating_times_test.rb +9 -9
- data/test/v_object/recur/event_iterator/handle_r_date_expand_test.rb +51 -0
- data/test/v_object/recur/event_iterator/incorrect_expand_test.rb +3 -5
- data/test/v_object/recur/event_iterator/infinite_loop_problem_test.rb +3 -1
- data/test/v_object/{issue26_test.rb → recur/event_iterator/issue26_test.rb} +3 -1
- data/test/v_object/recur/event_iterator/main_test.rb +9 -3
- data/test/v_object/recur/event_iterator/max_instances_test.rb +38 -0
- data/test/v_object/recur/event_iterator/missing_overridden_test.rb +3 -5
- data/test/v_object/recur/event_iterator/no_instances_test.rb +5 -3
- data/test/v_object/recur/event_iterator/override_first_event_test.rb +9 -9
- data/test/v_object/recur/r_date_iterator_test.rb +18 -0
- data/test/v_object/recur/r_rule_iterator_test.rb +4 -4
- data/test/v_object/splitter/i_calendar_test.rb +27 -7
- data/test/v_object/splitter/v_card_test.rb +5 -3
- data/test/v_object/test_case.rb +14 -4
- data/tilia-vobject.gemspec +2 -2
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36119ae1bd7d80d9fd72fe489b3db6981bdf3300
|
4
|
+
data.tar.gz: 4e29de64dffe0710536f3c4eebce613eb14ea6d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6897e4c4a95dc66fcbdfdbb12e34a4ab2f50c43ca3c0e06950c98e5c63caf00cdc36b1a7b6d230e1883f148f08d9179c3b824b28fbe0129a77f81c804809786
|
7
|
+
data.tar.gz: bf9e4f694742556c0bc718d439c992021aedf134e417d0d5523cc48369166e3a26131ac27fd6faeeaa245dc01b7cf02dcbba6c7eca131eef497e97250f2f384f
|
data/CHANGELOG.sabre.md
CHANGED
@@ -1,7 +1,57 @@
|
|
1
1
|
ChangeLog
|
2
2
|
=========
|
3
3
|
|
4
|
-
4.0.
|
4
|
+
4.0.2 (2016-01-11)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* #288: Only decode `CHARSET` if we're reading vCard 2.1. If it appears
|
8
|
+
in any other document, we must ignore it.
|
9
|
+
|
10
|
+
|
11
|
+
4.0.1 (2016-01-04)
|
12
|
+
------------------
|
13
|
+
|
14
|
+
* #284: When generating `CANCEL` iTip messages, we now include `DTEND`.
|
15
|
+
(@kewisch)
|
16
|
+
|
17
|
+
|
18
|
+
4.0.0 (2015-12-11)
|
19
|
+
------------------
|
20
|
+
|
21
|
+
* #274: When creating new vCards, the default vCard version is now 4.0.
|
22
|
+
* #275: `VEVENT`, `VTODO` and `VCARD` now automatically get a `UID` and
|
23
|
+
`DTSTAMP` property if this was not already specified.
|
24
|
+
* `ParseException` now extends `\Exception`.
|
25
|
+
* `Sabre\VObject\Reader::read` now has a `$charset` argument.
|
26
|
+
* #272: `Sabre\VObject\Recur\EventIterator::$maxInstances` is now
|
27
|
+
`Sabre\VObject\Settings::$maxRecurrences` and is also honored by the
|
28
|
+
FreeBusyGenerator.
|
29
|
+
* #278: `expand()` did not work correctly on events with sub-components.
|
30
|
+
|
31
|
+
|
32
|
+
4.0.0-beta1 (2015-12-02)
|
33
|
+
------------------------
|
34
|
+
|
35
|
+
* #258: Support for expanding events that use `RDATE`. (@jabdoa2)
|
36
|
+
* #258: Correctly support TZID for events that use `RDATE`. (@jabdoa2)
|
37
|
+
* #240: `Component\VCalendar::expand()` now returns a new expanded `VCalendar`
|
38
|
+
object, instead of editing the existing `VCalendar` in-place. This is a BC
|
39
|
+
break.
|
40
|
+
* #265: Using the new `InvalidDataException` in place of
|
41
|
+
`InvalidArgumentException` and `LogicException` in all places where we fail
|
42
|
+
because there was something wrong with input data.
|
43
|
+
* #227: Always add `VALUE=URI` to `PHOTO` properties.
|
44
|
+
* #235: Always add `VALUE=URI` to `URL` properties.
|
45
|
+
* It's now possible to override which class is used instead of
|
46
|
+
`Component\VCalendar` or `Component\VCard` during parsing.
|
47
|
+
* #263: Lots of small cleanups. (@jakobsack)
|
48
|
+
* #220: Automatically stop recurring after 3500 recurrences.
|
49
|
+
* #41: Allow user to set different encoding than UTF-8 when decoding vCards.
|
50
|
+
* #41: Support the `ENCODING` parameter from vCard 2.1.
|
51
|
+
Both ISO-8859-1 and Windows-1252 are currently supported.
|
52
|
+
* #185: Fix encoding/decoding of `TIME` values in jCal/jCard.
|
53
|
+
|
54
|
+
4.0.0-alpha2 (2015-09-04)
|
5
55
|
-------------------------
|
6
56
|
|
7
57
|
* Updated windows timezone file to support new mexican timezone.
|
@@ -50,7 +100,14 @@ ChangeLog
|
|
50
100
|
and `IntegerValue` to allow PHP 7 compatibility.
|
51
101
|
|
52
102
|
|
53
|
-
3.4.
|
103
|
+
3.4.8 (2016-01-04)
|
104
|
+
------------------
|
105
|
+
|
106
|
+
* #284: When generating `CANCEL` iTip messages, we now include `DTEND`.
|
107
|
+
(@kewisch).
|
108
|
+
|
109
|
+
|
110
|
+
3.4.7 (2015-09-05)
|
54
111
|
------------------
|
55
112
|
|
56
113
|
* #253: Handle `isInTimeRange` for recurring events that have 0 valid
|
data/Gemfile
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
gem 'tilia-xml', '~> 1.1'
|
5
|
-
|
6
|
-
# External dependencies
|
7
|
-
gem 'activesupport', '~> 4.2'
|
8
|
-
gem 'mail', '~> 2.6'
|
9
|
-
gem 'tzinfo', '~> 1.2'
|
10
|
-
gem 'rchardet', '~>1.6'
|
3
|
+
gemspec
|
11
4
|
|
12
5
|
# Testing
|
13
6
|
gem 'rake'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tilia-vobject (4.0.2)
|
5
|
+
activesupport (>= 4.0)
|
6
|
+
mail (~> 2.6)
|
7
|
+
rchardet (~> 1.6)
|
8
|
+
tilia-xml (~> 1.3)
|
9
|
+
tzinfo (~> 1.2)
|
10
|
+
|
1
11
|
GEM
|
2
12
|
remote: https://rubygems.org/
|
3
13
|
specs:
|
4
|
-
activesupport (4.2.5)
|
14
|
+
activesupport (4.2.5.1)
|
5
15
|
i18n (~> 0.7)
|
6
16
|
json (~> 1.7, >= 1.7.7)
|
7
17
|
minitest (~> 5.1)
|
@@ -38,12 +48,12 @@ GEM
|
|
38
48
|
simplecov-html (~> 0.10.0)
|
39
49
|
simplecov-html (0.10.0)
|
40
50
|
thread_safe (0.3.5)
|
41
|
-
tilia-uri (1.0.1)
|
42
|
-
activesupport (
|
43
|
-
tilia-xml (1.
|
44
|
-
activesupport (
|
45
|
-
libxml-ruby (
|
46
|
-
tilia-uri (~> 1.0)
|
51
|
+
tilia-uri (1.0.1.1)
|
52
|
+
activesupport (>= 4.0)
|
53
|
+
tilia-xml (1.3.0)
|
54
|
+
activesupport (>= 4.0)
|
55
|
+
libxml-ruby (>= 2.8)
|
56
|
+
tilia-uri (~> 1.0, >= 1.0.1.1)
|
47
57
|
tins (1.6.0)
|
48
58
|
tzinfo (1.2.2)
|
49
59
|
thread_safe (~> 0.1)
|
@@ -53,15 +63,11 @@ PLATFORMS
|
|
53
63
|
ruby
|
54
64
|
|
55
65
|
DEPENDENCIES
|
56
|
-
activesupport (~> 4.2)
|
57
|
-
mail (~> 2.6)
|
58
66
|
minitest (~> 5.8)
|
59
67
|
rake
|
60
|
-
rchardet (~> 1.6)
|
61
68
|
rubocop (~> 0.34)
|
62
69
|
simplecov (~> 0.10)
|
63
|
-
tilia-
|
64
|
-
tzinfo (~> 1.2)
|
70
|
+
tilia-vobject!
|
65
71
|
yard (~> 0.8)
|
66
72
|
|
67
73
|
BUNDLED WITH
|
data/LICENSE
CHANGED
data/LICENSE.sabre
CHANGED
data/lib/tilia/v_object.rb
CHANGED
@@ -24,6 +24,7 @@ module Tilia
|
|
24
24
|
require 'tilia/v_object/uuid_util'
|
25
25
|
require 'tilia/v_object/component'
|
26
26
|
require 'tilia/v_object/document'
|
27
|
+
require 'tilia/v_object/invalid_data_exception'
|
27
28
|
require 'tilia/v_object/parse_exception'
|
28
29
|
require 'tilia/v_object/eof_exception'
|
29
30
|
require 'tilia/v_object/reader'
|
@@ -4,7 +4,7 @@ module Tilia
|
|
4
4
|
class BirthdayCalendarGenerator
|
5
5
|
# Input objects.
|
6
6
|
#
|
7
|
-
# @
|
7
|
+
# @return [array]
|
8
8
|
# RUBY: attr_accessor :objects
|
9
9
|
|
10
10
|
# Default year.
|
@@ -13,7 +13,7 @@ module Tilia
|
|
13
13
|
|
14
14
|
# Output format for the SUMMARY.
|
15
15
|
#
|
16
|
-
# @
|
16
|
+
# @return [String]
|
17
17
|
# RUBY: attr_accessor :format
|
18
18
|
|
19
19
|
# Creates the generator.
|
@@ -21,7 +21,7 @@ module Tilia
|
|
21
21
|
# Check the setTimeRange and setObjects methods for details about the
|
22
22
|
# arguments.
|
23
23
|
#
|
24
|
-
# @param
|
24
|
+
# @param objects
|
25
25
|
def initialize(objects = nil)
|
26
26
|
@objects = []
|
27
27
|
@format = '%1s\'s Birthday'
|
@@ -34,9 +34,9 @@ module Tilia
|
|
34
34
|
# You must either supply a vCard as a string or as a Component/VCard object.
|
35
35
|
# It's also possible to supply an array of strings or objects.
|
36
36
|
#
|
37
|
-
# @param
|
37
|
+
# @param objects
|
38
38
|
#
|
39
|
-
# @return void
|
39
|
+
# @return [void]
|
40
40
|
def objects=(objects)
|
41
41
|
objects = [objects] unless objects.is_a?(Array)
|
42
42
|
|
@@ -59,14 +59,14 @@ module Tilia
|
|
59
59
|
|
60
60
|
# Sets the output format for the SUMMARY
|
61
61
|
#
|
62
|
-
# @param
|
62
|
+
# @param [String] format
|
63
63
|
#
|
64
|
-
# @return void
|
64
|
+
# @return [void]
|
65
65
|
attr_writer :format
|
66
66
|
|
67
67
|
# Parses the input data and returns a VCALENDAR.
|
68
68
|
#
|
69
|
-
# @return Component/VCalendar
|
69
|
+
# @return [Component/VCalendar]
|
70
70
|
def result
|
71
71
|
calendar = Component::VCalendar.new
|
72
72
|
|
@@ -92,7 +92,7 @@ module Tilia
|
|
92
92
|
# Skip if we can't parse the BDAY value.
|
93
93
|
begin
|
94
94
|
date_parts = DateTimeParser.parse_v_card_date_time(object['BDAY'].value)
|
95
|
-
rescue
|
95
|
+
rescue InvalidDataException
|
96
96
|
next
|
97
97
|
end
|
98
98
|
|
@@ -100,7 +100,7 @@ module Tilia
|
|
100
100
|
unknown_year = false
|
101
101
|
|
102
102
|
unless date_parts['year']
|
103
|
-
object['BDAY'] = "#{
|
103
|
+
object['BDAY'] = "#{DEFAULT_YEAR}-#{date_parts['month']}-#{date_parts['date']}"
|
104
104
|
unknown_year = true
|
105
105
|
end
|
106
106
|
|
@@ -123,7 +123,7 @@ module Tilia
|
|
123
123
|
'BDAY',
|
124
124
|
'X-SABRE-VCARD-UID' => object['UID'].value,
|
125
125
|
'X-SABRE-VCARD-FN' => object['FN'].value,
|
126
|
-
'X-SABRE-OMIT-YEAR' =>
|
126
|
+
'X-SABRE-OMIT-YEAR' => DEFAULT_YEAR
|
127
127
|
)
|
128
128
|
else
|
129
129
|
event.add(
|
data/lib/tilia/v_object/cli.rb
CHANGED
@@ -5,62 +5,62 @@ module Tilia
|
|
5
5
|
class Cli
|
6
6
|
# No output.
|
7
7
|
#
|
8
|
-
# @
|
8
|
+
# @return [Boolean]
|
9
9
|
# RUBY: attr_accessor :quiet
|
10
10
|
|
11
11
|
# Help display.
|
12
12
|
#
|
13
|
-
# @
|
13
|
+
# @return [Boolean]
|
14
14
|
# RUBY: attr_accessor :show_help
|
15
15
|
|
16
16
|
# Wether to spit out 'mimedir' or 'json' format.
|
17
17
|
#
|
18
|
-
# @
|
18
|
+
# @return [String]
|
19
19
|
# RUBY: attr_accessor :format
|
20
20
|
|
21
21
|
# JSON pretty print.
|
22
22
|
#
|
23
|
-
# @
|
23
|
+
# @return [Boolean]
|
24
24
|
# RUBY: attr_accessor :pretty
|
25
25
|
|
26
26
|
# Source file.
|
27
27
|
#
|
28
|
-
# @
|
28
|
+
# @return [String]
|
29
29
|
# RUBY: attr_accessor :input_path
|
30
30
|
|
31
31
|
# Destination file.
|
32
32
|
#
|
33
|
-
# @
|
33
|
+
# @return [String]
|
34
34
|
# RUBY: attr_accessor :output_path
|
35
35
|
|
36
36
|
# output stream.
|
37
37
|
#
|
38
|
-
# @
|
38
|
+
# @return [resource]
|
39
39
|
# RUBY: attr_accessor :stdout
|
40
40
|
|
41
41
|
# stdin.
|
42
42
|
#
|
43
|
-
# @
|
43
|
+
# @return [resource]
|
44
44
|
# RUBY: attr_accessor :stdin
|
45
45
|
|
46
46
|
# stderr.
|
47
47
|
#
|
48
|
-
# @
|
48
|
+
# @return [resource]
|
49
49
|
# RUBY: attr_accessor :stderr
|
50
50
|
|
51
51
|
# Input format (one of json or mimedir).
|
52
52
|
#
|
53
|
-
# @
|
53
|
+
# @return [String]
|
54
54
|
# RUBY: attr_accessor :input_format
|
55
55
|
|
56
56
|
# Makes the parser less strict.
|
57
57
|
#
|
58
|
-
# @
|
58
|
+
# @return [Boolean]
|
59
59
|
# RUBY: attr_accessor :forgiving
|
60
60
|
|
61
61
|
# Main function.
|
62
62
|
#
|
63
|
-
# @return
|
63
|
+
# @return [Fixnum]
|
64
64
|
def main(argv)
|
65
65
|
# @codeCoverageIgnoreStart
|
66
66
|
# We cannot easily test this, so we'll skip it. Pretty basic anyway.
|
@@ -156,9 +156,10 @@ module Tilia
|
|
156
156
|
return_code = send(command, input)
|
157
157
|
real_code = return_code unless return_code == 0
|
158
158
|
end
|
159
|
-
rescue EofException
|
159
|
+
rescue EofException
|
160
160
|
# end of file
|
161
|
-
|
161
|
+
return real_code
|
162
|
+
rescue StandardError => e
|
162
163
|
log("Error: #{e}", 'red')
|
163
164
|
return 2
|
164
165
|
end
|
@@ -170,7 +171,7 @@ module Tilia
|
|
170
171
|
|
171
172
|
# Shows the help message.
|
172
173
|
#
|
173
|
-
# @return void
|
174
|
+
# @return [void]
|
174
175
|
def show_help
|
175
176
|
log('Usage:', 'yellow')
|
176
177
|
log(' vobject [options] command [arguments]')
|
@@ -210,9 +211,9 @@ HELP
|
|
210
211
|
|
211
212
|
# Validates a VObject file.
|
212
213
|
#
|
213
|
-
# @param Component v_obj
|
214
|
+
# @param [Component] v_obj
|
214
215
|
#
|
215
|
-
# @return
|
216
|
+
# @return [Fixnum]
|
216
217
|
def validate(v_obj)
|
217
218
|
return_code = 0
|
218
219
|
|
@@ -248,9 +249,9 @@ HELP
|
|
248
249
|
|
249
250
|
# Repairs a VObject file.
|
250
251
|
#
|
251
|
-
# @param Component v_obj
|
252
|
+
# @param [Component] v_obj
|
252
253
|
#
|
253
|
-
# @return
|
254
|
+
# @return [Fixnum]
|
254
255
|
def repair(v_obj)
|
255
256
|
return_code = 0
|
256
257
|
|
@@ -288,9 +289,9 @@ HELP
|
|
288
289
|
|
289
290
|
# Converts a vObject file to a new format.
|
290
291
|
#
|
291
|
-
# @param Component v_obj
|
292
|
+
# @param [Component] v_obj
|
292
293
|
#
|
293
|
-
# @return
|
294
|
+
# @return [Fixnum]
|
294
295
|
def convert(v_obj)
|
295
296
|
json = false
|
296
297
|
convert_version = nil
|
@@ -336,9 +337,9 @@ HELP
|
|
336
337
|
|
337
338
|
# Colorizes a file.
|
338
339
|
#
|
339
|
-
# @param Component v_obj
|
340
|
+
# @param [Component] v_obj
|
340
341
|
#
|
341
|
-
# @return
|
342
|
+
# @return [Fixnum]
|
342
343
|
def color(v_obj)
|
343
344
|
@stdout.write(serialize_component(v_obj))
|
344
345
|
0 # otherwise bytes written will be returned
|
@@ -346,9 +347,9 @@ HELP
|
|
346
347
|
|
347
348
|
# Returns an ansi color string for a color name.
|
348
349
|
#
|
349
|
-
# @param
|
350
|
+
# @param [String] color
|
350
351
|
#
|
351
|
-
# @return
|
352
|
+
# @return [String]
|
352
353
|
def colorize(color, str, reset_to = 'default')
|
353
354
|
colors = {
|
354
355
|
'cyan' => '1;36',
|
@@ -364,10 +365,10 @@ HELP
|
|
364
365
|
|
365
366
|
# Writes out a string in specific color.
|
366
367
|
#
|
367
|
-
# @param
|
368
|
-
# @param
|
368
|
+
# @param [String] color
|
369
|
+
# @param [String] str
|
369
370
|
#
|
370
|
-
# @return void
|
371
|
+
# @return [void]
|
371
372
|
def c_write(color, str)
|
372
373
|
@stdout.write(colorize(color, str))
|
373
374
|
end
|
@@ -386,10 +387,10 @@ HELP
|
|
386
387
|
# space to accomodate elements. The key is added to the score to
|
387
388
|
# preserve the original relative order of elements.
|
388
389
|
#
|
389
|
-
# @param
|
390
|
-
# @param array array
|
390
|
+
# @param [Fixnum] key
|
391
|
+
# @param [array] array
|
391
392
|
#
|
392
|
-
# @return
|
393
|
+
# @return [Fixnum]
|
393
394
|
sort_score = lambda do |key, array|
|
394
395
|
key = array.index(key)
|
395
396
|
if array[key].is_a?(Component)
|
@@ -439,9 +440,9 @@ HELP
|
|
439
440
|
|
440
441
|
# Colorizes a property.
|
441
442
|
#
|
442
|
-
# @param Property property
|
443
|
+
# @param [Property] property
|
443
444
|
#
|
444
|
-
# @return void
|
445
|
+
# @return [void]
|
445
446
|
def serialize_property(property)
|
446
447
|
if property.group
|
447
448
|
c_write('default', property.group)
|
@@ -500,9 +501,9 @@ HELP
|
|
500
501
|
|
501
502
|
# Parses the list of arguments.
|
502
503
|
#
|
503
|
-
# @param array argv
|
504
|
+
# @param [array] argv
|
504
505
|
#
|
505
|
-
# @return void
|
506
|
+
# @return [void]
|
506
507
|
def parse_arguments(argv)
|
507
508
|
positional = []
|
508
509
|
options = {}
|
@@ -543,7 +544,7 @@ HELP
|
|
543
544
|
|
544
545
|
# Reads the input file.
|
545
546
|
#
|
546
|
-
# @return Component
|
547
|
+
# @return [Component]
|
547
548
|
def read_input
|
548
549
|
unless @parser
|
549
550
|
@stdin = File.open(@input_path, 'r') if @input_path != '-'
|
@@ -560,9 +561,9 @@ HELP
|
|
560
561
|
|
561
562
|
# Sends a message to STDERR.
|
562
563
|
#
|
563
|
-
# @param
|
564
|
+
# @param [String] msg
|
564
565
|
#
|
565
|
-
# @return void
|
566
|
+
# @return [void]
|
566
567
|
def log(msg, color = 'default')
|
567
568
|
return if @quiet
|
568
569
|
|