ruby-vobject 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.hound.yml +3 -0
- data/.rubocop.tb.yml +650 -0
- data/.rubocop.yml +1077 -0
- data/.travis.yml +16 -3
- data/Gemfile +1 -1
- data/LICENSE.txt +21 -17
- data/README.adoc +142 -0
- data/Rakefile +1 -1
- data/lib/c.rb +173 -0
- data/lib/error.rb +19 -0
- data/lib/vcalendar.rb +77 -0
- data/lib/vcard.rb +67 -0
- data/lib/vobject.rb +13 -170
- data/lib/vobject/component.rb +87 -36
- data/lib/vobject/parameter.rb +116 -0
- data/lib/vobject/parametervalue.rb +26 -0
- data/lib/vobject/property.rb +134 -55
- data/lib/vobject/propertyvalue.rb +46 -0
- data/lib/vobject/vcalendar/component.rb +106 -0
- data/lib/vobject/vcalendar/grammar.rb +595 -0
- data/lib/vobject/vcalendar/paramcheck.rb +259 -0
- data/lib/vobject/vcalendar/propertyparent.rb +98 -0
- data/lib/vobject/vcalendar/propertyvalue.rb +606 -0
- data/lib/vobject/vcalendar/typegrammars.rb +605 -0
- data/lib/vobject/vcard/v3_0/component.rb +40 -0
- data/lib/vobject/vcard/v3_0/grammar.rb +176 -0
- data/lib/vobject/vcard/v3_0/paramcheck.rb +111 -0
- data/lib/vobject/vcard/v3_0/parameter.rb +17 -0
- data/lib/vobject/vcard/v3_0/property.rb +18 -0
- data/lib/vobject/vcard/v3_0/propertyvalue.rb +401 -0
- data/lib/vobject/vcard/v3_0/typegrammars.rb +426 -0
- data/lib/vobject/vcard/v4_0/component.rb +40 -0
- data/lib/vobject/vcard/v4_0/grammar.rb +225 -0
- data/lib/vobject/vcard/v4_0/paramcheck.rb +270 -0
- data/lib/vobject/vcard/v4_0/parameter.rb +18 -0
- data/lib/vobject/vcard/v4_0/property.rb +63 -0
- data/lib/vobject/vcard/v4_0/propertyvalue.rb +404 -0
- data/lib/vobject/vcard/v4_0/typegrammars.rb +540 -0
- data/lib/vobject/vcard/version.rb +3 -0
- data/lib/vobject/version.rb +1 -1
- data/ruby-vobject.gemspec +19 -11
- metadata +93 -17
- data/README.md +0 -94
data/lib/vobject/version.rb
CHANGED
data/ruby-vobject.gemspec
CHANGED
@@ -1,28 +1,36 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "vobject/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "ruby-vobject"
|
8
9
|
spec.version = Vobject::VERSION
|
9
|
-
spec.authors = ["Peter Tam"]
|
10
|
-
spec.email = ["peter.tam@ribose.com"]
|
10
|
+
spec.authors = ["Peter Tam", "Nick Nicholas"]
|
11
|
+
spec.email = ["peter.tam@ribose.com", "opoudjis@gmail.com"]
|
12
|
+
#spec.platform = Gem::Platform.local
|
13
|
+
spec.require_paths = ["lib"]
|
11
14
|
|
12
|
-
spec.summary =
|
15
|
+
spec.summary = "Parse iCalendar or vCard into a ruby hash."
|
16
|
+
spec.description = "The main purpose of the gem is to parse vobject formatted text into a ruby
|
13
17
|
hash format. Currently there are two possiblities of vobjects, namely
|
14
18
|
iCalendar (https://tools.ietf.org/html/rfc5545) and vCard
|
15
|
-
(https://tools.ietf.org/html/rfc6350).
|
16
|
-
spec.homepage = "https://
|
17
|
-
spec.license = "
|
19
|
+
(https://tools.ietf.org/html/rfc6350)."
|
20
|
+
spec.homepage = "https://github.com/riboseinc/ruby-vobject"
|
21
|
+
spec.license = "BSD-2-Clause"
|
18
22
|
|
19
23
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
spec.bindir = "
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.bindir = "bin"
|
25
|
+
#spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
26
|
spec.require_paths = ["lib"]
|
23
27
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1
|
28
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
25
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
31
|
spec.add_development_dependency "rspec-json_expectations"
|
32
|
+
spec.add_development_dependency "byebug"
|
33
|
+
|
34
|
+
spec.add_runtime_dependency "rsec", "~> 0.4"
|
35
|
+
spec.add_runtime_dependency "tzinfo"
|
28
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-vobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Tam
|
8
|
-
|
9
|
-
|
8
|
+
- Nick Nicholas
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -16,14 +17,14 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
20
|
+
version: '2.1'
|
20
21
|
type: :development
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
27
|
+
version: '2.1'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: rake
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,33 +67,111 @@ dependencies:
|
|
66
67
|
- - ">="
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: '0'
|
69
|
-
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: byebug
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rsec
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.4'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.4'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: tzinfo
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
description: |-
|
113
|
+
The main purpose of the gem is to parse vobject formatted text into a ruby
|
114
|
+
hash format. Currently there are two possiblities of vobjects, namely
|
115
|
+
iCalendar (https://tools.ietf.org/html/rfc5545) and vCard
|
116
|
+
(https://tools.ietf.org/html/rfc6350).
|
70
117
|
email:
|
71
118
|
- peter.tam@ribose.com
|
119
|
+
- opoudjis@gmail.com
|
72
120
|
executables: []
|
73
121
|
extensions: []
|
74
122
|
extra_rdoc_files: []
|
75
123
|
files:
|
76
124
|
- ".gitignore"
|
125
|
+
- ".hound.yml"
|
77
126
|
- ".rspec"
|
127
|
+
- ".rubocop.tb.yml"
|
128
|
+
- ".rubocop.yml"
|
78
129
|
- ".travis.yml"
|
79
130
|
- CODE_OF_CONDUCT.md
|
80
131
|
- Gemfile
|
81
132
|
- LICENSE.txt
|
82
|
-
- README.
|
133
|
+
- README.adoc
|
83
134
|
- Rakefile
|
84
135
|
- bin/console
|
85
136
|
- bin/setup
|
137
|
+
- lib/c.rb
|
138
|
+
- lib/error.rb
|
139
|
+
- lib/vcalendar.rb
|
140
|
+
- lib/vcard.rb
|
86
141
|
- lib/vobject.rb
|
87
142
|
- lib/vobject/component.rb
|
143
|
+
- lib/vobject/parameter.rb
|
144
|
+
- lib/vobject/parametervalue.rb
|
88
145
|
- lib/vobject/property.rb
|
146
|
+
- lib/vobject/propertyvalue.rb
|
147
|
+
- lib/vobject/vcalendar/component.rb
|
148
|
+
- lib/vobject/vcalendar/grammar.rb
|
149
|
+
- lib/vobject/vcalendar/paramcheck.rb
|
150
|
+
- lib/vobject/vcalendar/propertyparent.rb
|
151
|
+
- lib/vobject/vcalendar/propertyvalue.rb
|
152
|
+
- lib/vobject/vcalendar/typegrammars.rb
|
153
|
+
- lib/vobject/vcard/v3_0/component.rb
|
154
|
+
- lib/vobject/vcard/v3_0/grammar.rb
|
155
|
+
- lib/vobject/vcard/v3_0/paramcheck.rb
|
156
|
+
- lib/vobject/vcard/v3_0/parameter.rb
|
157
|
+
- lib/vobject/vcard/v3_0/property.rb
|
158
|
+
- lib/vobject/vcard/v3_0/propertyvalue.rb
|
159
|
+
- lib/vobject/vcard/v3_0/typegrammars.rb
|
160
|
+
- lib/vobject/vcard/v4_0/component.rb
|
161
|
+
- lib/vobject/vcard/v4_0/grammar.rb
|
162
|
+
- lib/vobject/vcard/v4_0/paramcheck.rb
|
163
|
+
- lib/vobject/vcard/v4_0/parameter.rb
|
164
|
+
- lib/vobject/vcard/v4_0/property.rb
|
165
|
+
- lib/vobject/vcard/v4_0/propertyvalue.rb
|
166
|
+
- lib/vobject/vcard/v4_0/typegrammars.rb
|
167
|
+
- lib/vobject/vcard/version.rb
|
89
168
|
- lib/vobject/version.rb
|
90
169
|
- ruby-vobject.gemspec
|
91
|
-
homepage: https://
|
170
|
+
homepage: https://github.com/riboseinc/ruby-vobject
|
92
171
|
licenses:
|
93
|
-
-
|
172
|
+
- BSD-2-Clause
|
94
173
|
metadata: {}
|
95
|
-
post_install_message:
|
174
|
+
post_install_message:
|
96
175
|
rdoc_options: []
|
97
176
|
require_paths:
|
98
177
|
- lib
|
@@ -107,11 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
186
|
- !ruby/object:Gem::Version
|
108
187
|
version: '0'
|
109
188
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
189
|
+
rubygems_version: 3.0.3
|
190
|
+
signing_key:
|
113
191
|
specification_version: 4
|
114
|
-
summary:
|
115
|
-
hash format. Currently there are two possiblities of vobjects, namely iCalendar
|
116
|
-
(https://tools.ietf.org/html/rfc5545) and vCard (https://tools.ietf.org/html/rfc6350).
|
192
|
+
summary: Parse iCalendar or vCard into a ruby hash.
|
117
193
|
test_files: []
|
data/README.md
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
# Vobject
|
2
|
-
|
3
|
-
The main purpose of the gem is to parse vobject formatted text into a ruby
|
4
|
-
hash format. Currently there are two possiblities of vobjects, namely
|
5
|
-
iCalendar (https://tools.ietf.org/html/rfc5545) and vCard
|
6
|
-
(https://tools.ietf.org/html/rfc6350). There are only a few differences
|
7
|
-
between the iCalendar and vCard format. Only vCard supports grouping
|
8
|
-
feature, and currently vCard does not have any sub-object supported.
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Add this line to your application's Gemfile:
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
gem 'ruby-vobject'
|
16
|
-
```
|
17
|
-
|
18
|
-
And then execute:
|
19
|
-
|
20
|
-
$ bundle
|
21
|
-
|
22
|
-
Or install it yourself as:
|
23
|
-
|
24
|
-
$ gem install ruby-vobject
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
|
-
Vobject.parse("<ics/vcf file>")
|
29
|
-
|
30
|
-
Example:
|
31
|
-
|
32
|
-
A sample ics file (in spec/examples/example2.ics):
|
33
|
-
|
34
|
-
```
|
35
|
-
BEGIN:VCALENDAR
|
36
|
-
VERSION:2.0
|
37
|
-
PRODID:-//ABC Corporation//NONSGML My Product//EN
|
38
|
-
BEGIN:VTODO
|
39
|
-
DTSTAMP:19980130T134500Z
|
40
|
-
SEQUENCE:2
|
41
|
-
UID:uid4@example.com
|
42
|
-
ORGANIZER:mailto:unclesam@example.com
|
43
|
-
ATTENDEE;PARTSTAT=ACCEPTED:mailto:jqpublic@example.com
|
44
|
-
DUE:19980415T000000
|
45
|
-
STATUS:NEEDS-ACTION
|
46
|
-
SUMMARY:Submit Income Taxes
|
47
|
-
BEGIN:VALARM
|
48
|
-
ACTION:AUDIO
|
49
|
-
TRIGGER:19980403T120000Z
|
50
|
-
ATTACH;FMTTYPE=audio/basic:http://example.com/pub/audio-
|
51
|
-
files/ssbanner.aud
|
52
|
-
REPEAT:4
|
53
|
-
DURATION:PT1H
|
54
|
-
END:VALARM
|
55
|
-
END:VTODO
|
56
|
-
END:VCALENDAR
|
57
|
-
```
|
58
|
-
|
59
|
-
Parse the ics file into Ruby hash format:
|
60
|
-
|
61
|
-
```ruby
|
62
|
-
require 'vobject'
|
63
|
-
|
64
|
-
ics = File.read "spec/examples/example2.ics"
|
65
|
-
Vobject.parse(ics)
|
66
|
-
|
67
|
-
=> {:VCALENDAR=>[{:VERSION=>{:value=>"2.0"}}, {:PRODID=>{:value=>"-//ABC Corporation//NONSGML My Product//EN"}}, {:VTODO=>[{:DTSTAMP=>{:value=>"19980130T134500Z"}}, {:SEQUENCE=>{:value=>"2"}}, {:UID=>{:value=>"uid4@example.com"}}, {:ORGANIZER=>{:value=>"mailto:unclesam@example.com"}}, {:ATTENDEE=>{:params=>{:PARTSTAT=>"ACCEPTED"}, :value=>"mailto:jqpublic@example.com"}}, {:DUE=>{:value=>"19980415T000000"}}, {:STATUS=>{:value=>"NEEDS-ACTION"}}, {:SUMMARY=>{:value=>"Submit Income Taxes"}}, {:VALARM=>[{:ACTION=>{:value=>"AUDIO"}}, {:TRIGGER=>{:value=>"19980403T120000Z"}}, {:ATTACH=>{:params=>{:FMTTYPE=>"audio/basic"}, :value=>"http://example.com/pub/audio-files/ssbanner.aud"}}, {:REPEAT=>{:value=>"4"}}, {:DURATION=>{:value=>"PT1H"}}]}]}]}
|
68
|
-
```
|
69
|
-
|
70
|
-
Running spec:
|
71
|
-
bundle exec rspec
|
72
|
-
|
73
|
-
|
74
|
-
## Development
|
75
|
-
|
76
|
-
Currently the parser is written by regular expression. However, it is
|
77
|
-
hard to maintain. A better approach will be using some grammar parser
|
78
|
-
library, such as treetop (https://rubygems.org/gems/treetop/versions/1.6.8).
|
79
|
-
|
80
|
-
Some really simple specs have been written. Please make sure they still
|
81
|
-
pass after migrating into the grammar parser approach. Also, some other
|
82
|
-
specs such as some special characters as stated in RFC 5545 and 6350
|
83
|
-
should be tested as well.
|
84
|
-
|
85
|
-
|
86
|
-
## Contributing
|
87
|
-
|
88
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/riboseinc/ruby-vobject. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
89
|
-
|
90
|
-
|
91
|
-
## License
|
92
|
-
|
93
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
94
|
-
|