vigetlabs-dockit 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/event_collection.rb +2 -0
- data/lib/export.rb +77 -71
- metadata +1 -10
data/lib/event_collection.rb
CHANGED
data/lib/export.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'chronic'
|
1
|
+
require 'event_collection'
|
3
2
|
|
4
3
|
module Export
|
5
4
|
def rack_process(user)
|
@@ -12,75 +11,82 @@ module Export
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def exchange(user)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
14
|
+
file = File.new("#{user.username}.ics", "w")
|
15
|
+
raise "Failed to create file #{user.username}.ics" unless file
|
16
|
+
|
17
|
+
EventCollection.user = user
|
18
|
+
file.puts(EventCollection.all.to_ics)
|
19
|
+
file.close
|
20
|
+
|
21
|
+
# RExchange::open(user.remote_uri, user.email, user.password) do |mailbox|
|
22
|
+
#
|
23
|
+
# # create ics file, clearing any old one
|
24
|
+
# file = File.new("#{user.username}.ics", "w")
|
25
|
+
# raise "Failed to create file #{user.username}.ics" unless file
|
26
|
+
#
|
27
|
+
# file.puts "BEGIN:VCALENDAR"
|
28
|
+
# file.puts "CALSCALE:GREGORIAN"
|
29
|
+
# file.puts "PRODID:-//Apple Computer\, Inc//iCal 2.0//EN"
|
30
|
+
# file.puts "VERSION:2.0"
|
31
|
+
# file.puts "X-WR-CALNAME:#{user.title}"
|
32
|
+
#
|
33
|
+
# # itemcount = 0
|
34
|
+
#
|
35
|
+
# # Loop through all calendar events, making VEVENTS
|
36
|
+
# mailbox.calendar.each do |event|
|
37
|
+
#
|
38
|
+
# file.puts "BEGIN:VEVENT"
|
39
|
+
#
|
40
|
+
# # Set some properties for this event
|
41
|
+
# file.puts "DTSTAMP;TZID=#{user.timezone}:#{dformat(event.created_at)}"
|
42
|
+
# file.puts "DTSTART;TZID=#{user.timezone}:#{dformat(event.start_at)}"
|
43
|
+
# file.puts "DTEND;TZID=#{user.timezone}:#{dformat(event.end_at)}"
|
44
|
+
# file.puts "LAST-MODIFIED;TZID=#{user.timezone}:#{dformat(event.modified_at)}"
|
45
|
+
#
|
46
|
+
# file.puts "SUMMARY:" + (event.subject.blank? ? "Unknown Subject" : event.subject)
|
47
|
+
#
|
48
|
+
# description = event.body.blank? ? "" : event.body.gsub!("\n","\\n").gsub("^\n","")
|
49
|
+
# # ?? add event.href+"?Cmd=accept" or "decline" or "tentative"
|
50
|
+
# # description += event.href+"?Cmd=accept"
|
51
|
+
# # description += event.href+"?Cmd=decline"
|
52
|
+
# # description += event.href+"?Cmd=tentative"
|
53
|
+
#
|
54
|
+
# file.puts "DESCRIPTION:" + description
|
55
|
+
#
|
56
|
+
# file.puts "UID:" + event.uid if event.uid
|
57
|
+
#
|
58
|
+
# if event.reminder_offset && event.reminder_offset.to_i > 60
|
59
|
+
# # ouput valarm details. reminder_offset is in seconds
|
60
|
+
# ro_min = event.reminder_offset.to_i / 60
|
61
|
+
# file.puts "BEGIN:VALARM"
|
62
|
+
# file.puts "TRIGGER:-PT#{ro_min}M"
|
63
|
+
# # item.puts "DESCRIPTION:Påminnelse om aktivitet"
|
64
|
+
# file.puts "ACTION:DISPLAY"
|
65
|
+
# file.puts "END:VALARM"
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# #add event to calendar
|
69
|
+
# file.puts "END:VEVENT"
|
70
|
+
#
|
71
|
+
# # itemcount += 1
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# # puts mailbox.inspect
|
75
|
+
# # puts
|
76
|
+
# # puts mailbox.methods
|
77
|
+
#
|
78
|
+
# # Loop through all todos, creating VTODOS
|
79
|
+
# # Loop through all journals, creating VJOURNAL
|
80
|
+
# # Loop through all free/busy time, creating VFREEBUSY
|
81
|
+
# # event.busy_status
|
82
|
+
#
|
83
|
+
# #close ical file
|
84
|
+
# file.puts "END:VCALENDAR"
|
85
|
+
# file.close
|
86
|
+
#
|
87
|
+
# # p "Done! Wrote #{itemcount} appointment items"
|
88
|
+
#
|
89
|
+
# end
|
84
90
|
end
|
85
91
|
|
86
92
|
def dformat(t)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vigetlabs-dockit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale @ Viget Labs
|
@@ -30,15 +30,6 @@ dependencies:
|
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: 0.3.0
|
32
32
|
version:
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: chronic
|
35
|
-
version_requirement:
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.3
|
41
|
-
version:
|
42
33
|
- !ruby/object:Gem::Dependency
|
43
34
|
name: activesupport
|
44
35
|
version_requirement:
|