vpim 0.695 → 13.11.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{README → README.rdoc} +2 -13
- data/lib/vpim.rb +1 -0
- data/lib/vpim/address.rb +3 -2
- data/lib/vpim/agent/atomize.rb +4 -0
- data/lib/vpim/agent/base.rb +74 -0
- data/lib/vpim/agent/calendars.rb +1 -0
- data/lib/vpim/agent/handler.rb +27 -0
- data/lib/vpim/agent/ics.rb +162 -0
- data/lib/vpim/attachment.rb +1 -0
- data/lib/vpim/date.rb +3 -2
- data/lib/vpim/dirinfo.rb +5 -4
- data/lib/vpim/duration.rb +1 -0
- data/lib/vpim/enumerator.rb +1 -0
- data/lib/vpim/field.rb +3 -2
- data/lib/vpim/icalendar.rb +9 -5
- data/lib/vpim/maker/vcard.rb +1 -0
- data/lib/vpim/property/base.rb +1 -0
- data/lib/vpim/property/common.rb +1 -0
- data/lib/vpim/property/location.rb +10 -0
- data/lib/vpim/property/priority.rb +2 -1
- data/lib/vpim/property/recurrence.rb +1 -0
- data/lib/vpim/property/resources.rb +1 -2
- data/lib/vpim/repo.rb +2 -1
- data/lib/vpim/rfc2425.rb +32 -24
- data/lib/vpim/rrule.rb +9 -8
- data/lib/vpim/time.rb +1 -0
- data/lib/vpim/vcard.rb +13 -11
- data/lib/vpim/version.rb +2 -2
- data/lib/vpim/vevent.rb +3 -1
- data/lib/vpim/view.rb +3 -2
- data/lib/vpim/vjournal.rb +1 -0
- data/lib/vpim/vpim.rb +2 -1
- data/lib/vpim/vtodo.rb +1 -0
- data/samples/agent.ru +10 -0
- data/test/test_all.rb +2 -0
- data/test/test_date.rb +6 -5
- data/test/test_dur.rb +1 -0
- data/test/test_field.rb +3 -2
- data/test/test_ical.rb +12 -2
- data/test/test_misc.rb +13 -0
- data/test/test_repo.rb +22 -2
- data/test/test_rrule.rb +1 -0
- data/test/test_vcard.rb +53 -1
- metadata +36 -46
- data/lib/vpim/agent/app.rb +0 -194
- data/lib/vpim/agent/main.rb +0 -327
- data/lib/vpim/agent/scraps.rb +0 -292
- data/test/test_agent_app.rb +0 -74
- data/test/test_agent_atomize.rb +0 -84
- data/test/test_agent_calendars.rb +0 -128
- data/test/test_view.rb +0 -79
data/test/test_date.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
|
3
4
|
require 'vpim/date'
|
@@ -38,16 +39,16 @@ class TestVpimDate < Test::Unit::TestCase
|
|
38
39
|
|
39
40
|
def test_bywday
|
40
41
|
|
41
|
-
# 2004
|
42
|
-
#
|
43
|
-
# January February March
|
42
|
+
# 2004
|
43
|
+
#
|
44
|
+
# January February March
|
44
45
|
# S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
|
45
46
|
# 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6
|
46
47
|
# 4 5 6 7 8 9 10 8 9 10 11 12 13 14 7 8 9 10 11 12 13
|
47
48
|
# 11 12 13 14 15 16 17 15 16 17 18 19 20 21 14 15 16 17 18 19 20
|
48
49
|
# 18 19 20 21 22 23 24 22 23 24 25 26 27 28 21 22 23 24 25 26 27
|
49
50
|
# 25 26 27 28 29 30 31 29 28 29 30 31
|
50
|
-
#
|
51
|
+
#
|
51
52
|
do_bywday([2004, 1, 4, 1], [2004, 1, 1])
|
52
53
|
do_bywday([2004, 1, 4, 2], [2004, 1, 8])
|
53
54
|
do_bywday([2004, 1, 4, -1], [2004, 1, 29])
|
@@ -74,7 +75,7 @@ class TestVpimDate < Test::Unit::TestCase
|
|
74
75
|
do_bywday([2004,-12, "th", -2], [2004, 1, 22])
|
75
76
|
do_bywday([2004,-12, "th", -5], [2004, 1, 1])
|
76
77
|
|
77
|
-
# October November December
|
78
|
+
# October November December
|
78
79
|
# S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
|
79
80
|
# 1 2 1 2 3 4 5 6 1 2 3 4
|
80
81
|
# 3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
|
data/test/test_dur.rb
CHANGED
data/test/test_field.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
|
3
4
|
require 'test/unit'
|
@@ -15,7 +16,7 @@ class TestField < Test::Unit::TestCase
|
|
15
16
|
assert_equal("+\\+\n+\n+,+;+a+b+c+", dec)
|
16
17
|
enc_out = Vpim.encode_text(dec)
|
17
18
|
should_be = "+\\\\+\\n+\\n+\\,+\\;+a+b+c+"
|
18
|
-
# Note a, b, and c are allowed to be escaped, but shouldn't be and
|
19
|
+
# Note a, b, and c are allowed to be escaped, but shouldn't be and
|
19
20
|
# aren't in output
|
20
21
|
#puts("<#{dec}> => <#{enc_out}>")
|
21
22
|
assert_equal(should_be, enc_out)
|
@@ -134,7 +135,7 @@ class TestField < Test::Unit::TestCase
|
|
134
135
|
assert_equal('Z.B', f.group)
|
135
136
|
|
136
137
|
f.value = 'some text'
|
137
|
-
|
138
|
+
|
138
139
|
assert_equal('some text', f.value)
|
139
140
|
assert_equal('some text', f.value_raw)
|
140
141
|
|
data/test/test_ical.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
|
3
4
|
require 'vpim/icalendar'
|
@@ -170,7 +171,7 @@ ___
|
|
170
171
|
# Hal was encoding raw strings, here's how to do it with the API.
|
171
172
|
|
172
173
|
cal = Icalendar.create
|
173
|
-
|
174
|
+
|
174
175
|
start = Time.now
|
175
176
|
|
176
177
|
event = Icalendar::Vevent.create(start,
|
@@ -329,7 +330,7 @@ __
|
|
329
330
|
assert_equal(1, vc.events.to_a.size)
|
330
331
|
assert_equal(1, vc.todos.to_a.size)
|
331
332
|
assert_equal(1, vc.journals.to_a.size)
|
332
|
-
|
333
|
+
|
333
334
|
vc.to_s # Shouldn't raise...
|
334
335
|
# TODO - encode isn't round-tripping, unknown components are lost, which is
|
335
336
|
# not good.
|
@@ -421,6 +422,15 @@ __
|
|
421
422
|
assert_equal(cal.events.last.location, nil)
|
422
423
|
end
|
423
424
|
|
425
|
+
def test_set_location
|
426
|
+
vc = Icalendar.create2 do |vc|
|
427
|
+
vc.add_event do |m|
|
428
|
+
m.location("bien located")
|
429
|
+
end
|
430
|
+
end
|
431
|
+
assert_match(/LOCATION:bien located/, vc.to_s)
|
432
|
+
end
|
433
|
+
|
424
434
|
|
425
435
|
def test_event_maker_w_rrule
|
426
436
|
vc = Icalendar.create2 do |vc|
|
data/test/test_misc.rb
ADDED
data/test/test_repo.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
|
3
4
|
require 'vpim/repo'
|
4
|
-
require '
|
5
|
+
require File.expand_path('../common', __FILE__)
|
5
6
|
|
6
7
|
class TestRepo < Test::Unit::TestCase
|
7
8
|
Apple3 = Vpim::Repo::Apple3
|
@@ -50,7 +51,7 @@ class TestRepo < Test::Unit::TestCase
|
|
50
51
|
_test_each(repo, 1)
|
51
52
|
end
|
52
53
|
|
53
|
-
def
|
54
|
+
def test_uri_http
|
54
55
|
caldata = open('test/calendars/weather.calendar/Events/1205042405-0-0.ics').read
|
55
56
|
|
56
57
|
server = data_on_port(caldata, 9876)
|
@@ -68,6 +69,25 @@ class TestRepo < Test::Unit::TestCase
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
72
|
+
def test_uri_webcal
|
73
|
+
caldata = open('test/calendars/weather.calendar/Events/1205042405-0-0.ics').read
|
74
|
+
|
75
|
+
server = data_on_port(caldata, 9876)
|
76
|
+
begin
|
77
|
+
c = Uri::Calendar.new("webcal://localhost:9876")
|
78
|
+
assert_equal(caldata, c.encode)
|
79
|
+
|
80
|
+
repo = Uri.new("webcal://localhost:9876")
|
81
|
+
|
82
|
+
assert_equal(1, repo.count)
|
83
|
+
|
84
|
+
_test_each(repo, 1)
|
85
|
+
ensure
|
86
|
+
server.kill
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
71
91
|
def test_uri_invalid
|
72
92
|
assert_raises(ArgumentError) do
|
73
93
|
Uri.new("url")
|
data/test/test_rrule.rb
CHANGED
data/test/test_vcard.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
|
3
4
|
require 'vpim/vcard'
|
@@ -690,7 +691,14 @@ END:VCARD
|
|
690
691
|
assert_equal('', card.name.given)
|
691
692
|
assert_equal('', card.name.fullname)
|
692
693
|
|
693
|
-
|
694
|
+
# As of Ruby 1.9, modifying a frozen object raises a RuntimeError instead of
|
695
|
+
# a TypeError.
|
696
|
+
if RUBY_VERSION >= "1.9"
|
697
|
+
expected_error = RuntimeError
|
698
|
+
else
|
699
|
+
expected_error = TypeError
|
700
|
+
end
|
701
|
+
assert_raises(expected_error) do
|
694
702
|
card.name.given = 'given'
|
695
703
|
end
|
696
704
|
|
@@ -718,6 +726,28 @@ END:VCARD
|
|
718
726
|
assert_equal('well given', card.name.fullname)
|
719
727
|
end
|
720
728
|
|
729
|
+
def test_add_tel
|
730
|
+
phones = ["1", "2", "3"]
|
731
|
+
card = Vpim::Vcard::Maker.make2 do |maker|
|
732
|
+
maker.add_name do |name|
|
733
|
+
name.given = "self.first_name"
|
734
|
+
name.family = "self.last_name"
|
735
|
+
end
|
736
|
+
phones.each do |phone|
|
737
|
+
maker.add_tel(phone) do |tel|
|
738
|
+
tel.location = 'home'
|
739
|
+
tel.preferred = true
|
740
|
+
end
|
741
|
+
end
|
742
|
+
end
|
743
|
+
card = Vpim::Vcard.decode(card.encode).first
|
744
|
+
# pp card
|
745
|
+
card.telephones.each do |phone|
|
746
|
+
assert_equal(phone, phones.delete(phone))
|
747
|
+
end
|
748
|
+
assert_equal(0, phones.size)
|
749
|
+
end
|
750
|
+
|
721
751
|
def test_add_note
|
722
752
|
note = "hi\' \ \"\",,;; \n \n field"
|
723
753
|
|
@@ -896,6 +926,28 @@ __
|
|
896
926
|
|
897
927
|
end
|
898
928
|
|
929
|
+
def test_quoted_printable
|
930
|
+
c = <<'__'
|
931
|
+
BEGIN:VCARD
|
932
|
+
VERSION:2.1
|
933
|
+
N:Quinn;Charles
|
934
|
+
FN:Charles Quinn
|
935
|
+
NOTE;ENCODING=QUOTED-PRINTABLE: =0D=0Acbq+highgroove@example.com <mailto:cbq+highgroove@example.com>=0D=0A555-555-2=
|
936
|
+
500 - Office=0D=0A555-555-2502 - Fax
|
937
|
+
TEL;WORK;VOICE:555 555 2500
|
938
|
+
TEL;WORK;FAX:555 555 2502
|
939
|
+
EMAIL;PREF;INTERNET:cbq+highgroove@example.com
|
940
|
+
REV:20100210T201157Z
|
941
|
+
END:VCARD
|
942
|
+
__
|
943
|
+
card = Vpim::Vcard.decode(c).first
|
944
|
+
assert_equal("Quinn", card.name.family)
|
945
|
+
assert_equal(
|
946
|
+
"=0D=0Acbq+highgroove@example.com <mailto:cbq+highgroove@example.com>=0D=0A555-555-2=500 - Office=0D=0A555-555-2502 - Fax",
|
947
|
+
card.note
|
948
|
+
)
|
949
|
+
end
|
950
|
+
|
899
951
|
def _test_gmail_vcard_export
|
900
952
|
# GOOGLE BUG - Whitespace before the LABEL field values is a broken
|
901
953
|
# line continuation.
|
metadata
CHANGED
@@ -1,37 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: vpim
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 13.11.11
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Sam Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2009-03-01 00:00:00 -08:00
|
13
|
-
default_executable:
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
14
12
|
dependencies: []
|
15
|
-
|
16
|
-
|
13
|
+
description: |
|
14
|
+
This is a pure-ruby library for decoding and encoding vCard and iCalendar data
|
15
|
+
("personal information") called vPim.
|
17
16
|
email: vieuxtech@gmail.com
|
18
|
-
executables:
|
17
|
+
executables:
|
19
18
|
- reminder
|
20
19
|
- rrule
|
21
20
|
extensions: []
|
22
|
-
|
23
|
-
|
24
|
-
- README
|
21
|
+
extra_rdoc_files:
|
22
|
+
- README.rdoc
|
25
23
|
- CHANGES
|
26
24
|
- COPYING
|
27
25
|
- samples/README.mutt
|
28
|
-
files:
|
26
|
+
files:
|
29
27
|
- lib/vpim/address.rb
|
30
|
-
- lib/vpim/agent/app.rb
|
31
28
|
- lib/vpim/agent/atomize.rb
|
29
|
+
- lib/vpim/agent/base.rb
|
32
30
|
- lib/vpim/agent/calendars.rb
|
33
|
-
- lib/vpim/agent/
|
34
|
-
- lib/vpim/agent/
|
31
|
+
- lib/vpim/agent/handler.rb
|
32
|
+
- lib/vpim/agent/ics.rb
|
35
33
|
- lib/vpim/attachment.rb
|
36
34
|
- lib/vpim/date.rb
|
37
35
|
- lib/vpim/dirinfo.rb
|
@@ -60,7 +58,9 @@ files:
|
|
60
58
|
- lib/vpim.rb
|
61
59
|
- bin/reminder
|
62
60
|
- bin/rrule
|
61
|
+
- samples/README.mutt
|
63
62
|
- samples/ab-query.rb
|
63
|
+
- samples/agent.ru
|
64
64
|
- samples/cmd-itip.rb
|
65
65
|
- samples/ex_cpvcard.rb
|
66
66
|
- samples/ex_get_vcard_photo.rb
|
@@ -71,7 +71,6 @@ files:
|
|
71
71
|
- samples/ics-to-rss.rb
|
72
72
|
- samples/mutt-aliases-to-vcf.rb
|
73
73
|
- samples/osx-wrappers.rb
|
74
|
-
- samples/README.mutt
|
75
74
|
- samples/reminder.rb
|
76
75
|
- samples/rrule.rb
|
77
76
|
- samples/tabbed-file-to-vcf.rb
|
@@ -79,57 +78,48 @@ files:
|
|
79
78
|
- samples/vcf-lines.rb
|
80
79
|
- samples/vcf-to-ics.rb
|
81
80
|
- samples/vcf-to-mutt.rb
|
82
|
-
- test/test_agent_app.rb
|
83
|
-
- test/test_agent_atomize.rb
|
84
|
-
- test/test_agent_calendars.rb
|
85
81
|
- test/test_all.rb
|
86
82
|
- test/test_date.rb
|
87
83
|
- test/test_dur.rb
|
88
84
|
- test/test_field.rb
|
89
85
|
- test/test_ical.rb
|
86
|
+
- test/test_misc.rb
|
90
87
|
- test/test_repo.rb
|
91
88
|
- test/test_rrule.rb
|
92
89
|
- test/test_vcard.rb
|
93
|
-
- test/test_view.rb
|
94
90
|
- COPYING
|
95
|
-
- README
|
91
|
+
- README.rdoc
|
96
92
|
- CHANGES
|
97
|
-
has_rdoc: true
|
98
93
|
homepage: http://vpim.rubyforge.org
|
94
|
+
licenses: []
|
95
|
+
metadata: {}
|
99
96
|
post_install_message:
|
100
97
|
rdoc_options: []
|
101
|
-
|
102
|
-
require_paths:
|
98
|
+
require_paths:
|
103
99
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- -
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version:
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
version: "0"
|
115
|
-
version:
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
116
110
|
requirements: []
|
117
|
-
|
118
111
|
rubyforge_project: vpim
|
119
|
-
rubygems_version:
|
112
|
+
rubygems_version: 2.0.3
|
120
113
|
signing_key:
|
121
|
-
specification_version:
|
114
|
+
specification_version: 4
|
122
115
|
summary: iCalendar and vCard support for ruby
|
123
|
-
test_files:
|
124
|
-
- test/test_agent_app.rb
|
125
|
-
- test/test_agent_atomize.rb
|
126
|
-
- test/test_agent_calendars.rb
|
116
|
+
test_files:
|
127
117
|
- test/test_all.rb
|
128
118
|
- test/test_date.rb
|
129
119
|
- test/test_dur.rb
|
130
120
|
- test/test_field.rb
|
131
121
|
- test/test_ical.rb
|
122
|
+
- test/test_misc.rb
|
132
123
|
- test/test_repo.rb
|
133
124
|
- test/test_rrule.rb
|
134
125
|
- test/test_vcard.rb
|
135
|
-
- test/test_view.rb
|
data/lib/vpim/agent/app.rb
DELETED
@@ -1,194 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright (C) 2009 Sam Roberts
|
3
|
-
|
4
|
-
This library is free software; you can redistribute it and/or modify it
|
5
|
-
under the same terms as the ruby language itself, see the file COPYING for
|
6
|
-
details.
|
7
|
-
=end
|
8
|
-
|
9
|
-
require 'sinatra'
|
10
|
-
require 'vpim/agent/atomize'
|
11
|
-
require 'vpim/repo'
|
12
|
-
require 'vpim/view'
|
13
|
-
|
14
|
-
require 'cgi'
|
15
|
-
|
16
|
-
configure do
|
17
|
-
server = Sinatra::Application.server
|
18
|
-
set :server, Proc.new {
|
19
|
-
if ENV.include?("PHP_FCGI_CHILDREN")
|
20
|
-
break "fastcgi" # Must NOT be the correct class name!
|
21
|
-
elsif ENV.include?("REQUEST_METHOD")
|
22
|
-
break "cgi" # Must NOT be the correct class name!
|
23
|
-
else
|
24
|
-
# Fall back on whatever it was going to be.
|
25
|
-
server
|
26
|
-
end
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# I could wrap the Repo/Calendar/Atomize in a small class that would memoize
|
31
|
-
# ical data and atom output. Maybe even do an HTTP head for fast detection of
|
32
|
-
# change? Does a calendar have updated information? Can we memoize atom when
|
33
|
-
# ics doesn't change?
|
34
|
-
|
35
|
-
module Vpim
|
36
|
-
module Agent
|
37
|
-
module App
|
38
|
-
def self.atomize(caluri, feeduri)
|
39
|
-
repo = Vpim::Repo::Uri.new(caluri)
|
40
|
-
cal = repo.find{true}
|
41
|
-
cal = View.week(cal)
|
42
|
-
feed = Agent::Atomize.calendar(cal, feeduri, caluri, cal.name)
|
43
|
-
return feed.to_xml, Agent::Atomize::MIME
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
get '/ics' do
|
50
|
-
from = env['QUERY_STRING']
|
51
|
-
|
52
|
-
url = URI.parse(request.url)
|
53
|
-
url.query = nil
|
54
|
-
url_base = url.to_s
|
55
|
-
url_atom = nil
|
56
|
-
|
57
|
-
@url_ics = from # ics from here
|
58
|
-
@url_atom = nil
|
59
|
-
|
60
|
-
if not from.empty?
|
61
|
-
# Error out if we can't atomize the feed
|
62
|
-
Vpim::Agent::App.atomize(from, "http://example.com")
|
63
|
-
|
64
|
-
url = URI.parse(request.url)
|
65
|
-
url.path << "/atom"
|
66
|
-
url_atom = url.to_s
|
67
|
-
end
|
68
|
-
|
69
|
-
@url_base = url_base # clean input form
|
70
|
-
@url_atom = url_atom # atomized ics from here
|
71
|
-
|
72
|
-
haml :"ics.haml"
|
73
|
-
end
|
74
|
-
|
75
|
-
post '/ics' do
|
76
|
-
from = params[:url]
|
77
|
-
url = URI.parse(request.url)
|
78
|
-
url.query = from
|
79
|
-
redirect url.to_s
|
80
|
-
end
|
81
|
-
|
82
|
-
# When we support other forms..
|
83
|
-
#get '/ics/:form' do
|
84
|
-
# form = params[:form]
|
85
|
-
get '/ics/atom' do
|
86
|
-
from = env['QUERY_STRING']
|
87
|
-
port = env["SERVER_PORT"].to_i
|
88
|
-
here = request.url
|
89
|
-
|
90
|
-
if from.empty?
|
91
|
-
url = URI.parse(here)
|
92
|
-
url.path.sub(/atom$/, "")
|
93
|
-
redirect here.to_s
|
94
|
-
end
|
95
|
-
|
96
|
-
xml, xmltype = Vpim::Agent::App.atomize(from, here)
|
97
|
-
|
98
|
-
content_type xmltype
|
99
|
-
body xml
|
100
|
-
end
|
101
|
-
|
102
|
-
get '/ics/style.css' do
|
103
|
-
content_type 'text/css'
|
104
|
-
sass :"ics.sass"
|
105
|
-
end
|
106
|
-
|
107
|
-
error do
|
108
|
-
@url_error = CGI.escapeHTML(env['sinatra.error'].inspect)
|
109
|
-
haml :"ics.haml"
|
110
|
-
end
|
111
|
-
|
112
|
-
use_in_file_templates!
|
113
|
-
|
114
|
-
# FIXME - hard-coded :action paths below, bad!
|
115
|
-
|
116
|
-
__END__
|
117
|
-
@@ics.sass
|
118
|
-
body
|
119
|
-
:background-color gray
|
120
|
-
:font-size medium
|
121
|
-
a
|
122
|
-
:color black
|
123
|
-
:font-style italic
|
124
|
-
a:hover
|
125
|
-
:color darkred
|
126
|
-
|
127
|
-
#header
|
128
|
-
:border-bottom 3px solid darkred
|
129
|
-
#title
|
130
|
-
:color black
|
131
|
-
:font-size large
|
132
|
-
|
133
|
-
.text
|
134
|
-
:width 80%
|
135
|
-
-#:color yellow
|
136
|
-
|
137
|
-
#submit
|
138
|
-
:margin-top 30px
|
139
|
-
:margin-left 5%
|
140
|
-
#form
|
141
|
-
:padding
|
142
|
-
:top 10px
|
143
|
-
:bottom 10px
|
144
|
-
:left 10px
|
145
|
-
:right 10px
|
146
|
-
:text-align left
|
147
|
-
#url
|
148
|
-
:width 80%
|
149
|
-
#button
|
150
|
-
:font-weight bold
|
151
|
-
:text-align center
|
152
|
-
|
153
|
-
#subscribe
|
154
|
-
:margin-left 5%
|
155
|
-
-#.feed
|
156
|
-
-# :margin-left 10%
|
157
|
-
|
158
|
-
#footer
|
159
|
-
:border-top 3px solid darkred
|
160
|
-
:margin-top 20px
|
161
|
-
@@ics.haml
|
162
|
-
%html
|
163
|
-
%head
|
164
|
-
%title Subscribe to calendar feeds as atom feeds
|
165
|
-
%link{:href => '/ics/style.css', :media => 'screen', :type => 'text/css'}
|
166
|
-
%body
|
167
|
-
#header
|
168
|
-
%span#title Subscribe to calendar feeds as atom feeds
|
169
|
-
#submit
|
170
|
-
.text Calendar feeds are great, but sometimes all you want is an atom feed of what's coming up in the next week.
|
171
|
-
.text Paste the URL of the calendar below, submit it, and subscribe.
|
172
|
-
%form#form{:method => 'POST', :action => '/ics'}
|
173
|
-
%input#url{:name => 'url', :value => params[:url]}
|
174
|
-
%input#button{:type => 'submit', :value => 'Submit'}
|
175
|
-
- if @url_atom
|
176
|
-
#subscribe
|
177
|
-
.text
|
178
|
-
Subscribe to
|
179
|
-
%a{:href => @url_ics}= @url_ics
|
180
|
-
as:
|
181
|
-
%ul.feed
|
182
|
-
%a{:href => @url_atom}= @url_atom
|
183
|
-
(atom feed)
|
184
|
-
- if @url_error
|
185
|
-
#error.text
|
186
|
-
#preamble Sorry, trying to access:
|
187
|
-
#source= @url_ics
|
188
|
-
#transition resulted in:
|
189
|
-
#destination= @url_error
|
190
|
-
#footer
|
191
|
-
.text
|
192
|
-
:textile
|
193
|
-
Coming from the "Octet Cloud":http://octetcloud.com/ using "vPim":http://vpim.rubyforge.org/, piloted by cloud monkey "Sam Roberts":mailto:vieuxtech@gmail.com
|
194
|
-
|