remember_the_meeting 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.swp
6
+ *.swo
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in remember_the_meeting.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ Remember The Meeting
2
+ ====================
3
+
4
+ This gem is will connect to your calendar on Microsoft Exchange server and make sure you don't miss any appointments.
5
+
6
+ Prerequisites
7
+ -------------
8
+
9
+ On Mac, growl and growl gem need to be installed. On linux, libnotify-bin is the only dependency.
10
+
11
+ Installation
12
+ ------------
13
+
14
+ ```gem install remember_the_meeting```
15
+
16
+ Configuration
17
+ -------------
18
+
19
+ ```export EDITOR=vim```
20
+
21
+ or mate, gedit or whatever. Then run:
22
+
23
+ ```remember_the_meeting config```
24
+
25
+ to configure the connection. Finally, run:
26
+
27
+ ```
28
+ remember_the_meeting
29
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'remember_the_meeting')
4
+
5
+ ARGV.first == 'config' ? RememberTheMeeting.configure : RememberTheMeeting.enable!
@@ -0,0 +1,3 @@
1
+ server: https://yourserver.com/ews/exchange.asmx
2
+ user: domain\\user
3
+ pass: pass
@@ -0,0 +1,18 @@
1
+ Viewpoint::EWS::CalendarItem.class_eval do
2
+ def start_time
3
+ @start_time ||= Time.parse(self.start.to_s)
4
+ end
5
+
6
+ def end_time
7
+ @end_time ||= Time.parse(self.end.to_s)
8
+ end
9
+
10
+ def start_time_formatted
11
+ start_time.strftime('%H:%M')
12
+ end
13
+
14
+ def end_time_formatted
15
+ end_time.strftime('%H:%M')
16
+ end
17
+ end
18
+
@@ -0,0 +1,5 @@
1
+ module Platform
2
+ def linux?
3
+ RUBY_PLATFORM =~ /linux/
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module RememberTheMeeting
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,76 @@
1
+ require File.join(File.dirname(__FILE__), 'remember_the_meeting', 'version')
2
+ require File.join(File.dirname(__FILE__), 'remember_the_meeting', 'platform')
3
+ include Platform
4
+
5
+ require 'viewpoint'
6
+ require 'yaml'
7
+ require 'growl' unless linux?
8
+
9
+ require File.join(File.dirname(__FILE__), 'remember_the_meeting', 'calendar_item_patch')
10
+
11
+ module RememberTheMeeting
12
+
13
+ class << self
14
+ include Platform
15
+
16
+ def notify(subject, start_time, end_time, location)
17
+ message = "#{start_time}-#{end_time}\n#{location}"
18
+ if linux?
19
+ system "notify-send \"#{subject}\" \"#{message}\""
20
+ else
21
+ Growl.notify(message, {:title => subject, :sticky => true})
22
+ end
23
+ end
24
+
25
+ def setup
26
+ Viewpoint::EWS::EWS.endpoint = config['server']
27
+ Viewpoint::EWS::EWS.set_auth(config['user'], config['pass'])
28
+ @cal = Viewpoint::EWS::CalendarFolder.get_folder :calendar
29
+ @cal.subscribe
30
+ end
31
+
32
+ def configure
33
+ system "#{editor} #{config_filepath}"
34
+ end
35
+
36
+ def editor
37
+ editor = `echo $EDITOR`.chomp
38
+ editor.blank? ? 'vim' : editor
39
+ end
40
+
41
+ def config
42
+ YAML.load(File.read(config_filepath))
43
+ end
44
+
45
+ def config_filepath
46
+ File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'exchange.yml'))
47
+ end
48
+
49
+ def start
50
+ loop do
51
+ items = @cal.todays_items
52
+
53
+ # d1 = DateTime.parse('2011-09-24')
54
+ # d2 = DateTime.parse('2011-09-30')
55
+ # items = @cal.items_between(d1, d2)
56
+
57
+ now = Time.now
58
+ in_15_minutes = Time.now + 60 * 15
59
+ upcoming = items.select {|item| item.start_time > now && item.start_time < in_15_minutes }
60
+ upcoming.each do |appointment|
61
+ start_time = appointment.start_time_formatted
62
+ end_time = appointment.end_time_formatted
63
+ subject = appointment.subject
64
+ location = appointment.location
65
+ notify(subject, start_time, end_time, location)
66
+ end
67
+ sleep(300)
68
+ end
69
+ end
70
+
71
+ def enable!
72
+ setup
73
+ start
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "remember_the_meeting/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "remember_the_meeting"
7
+ s.version = RememberTheMeeting::VERSION
8
+ s.authors = ["Milan Dobrota"]
9
+ s.email = ["milan@milandobrota.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Gem that integrates against Exchange server and notifies you 15 minutes before meetings.}
12
+ s.description = %q{Gem that integrates against Exchange server and notifies you 15 minutes before meetings. Linux and OSX. }
13
+
14
+ s.rubyforge_project = "remember_the_meeting"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_runtime_dependency 'nokogiri'
25
+ s.add_runtime_dependency 'handsoap'
26
+ s.add_runtime_dependency 'httpclient'
27
+ s.add_runtime_dependency 'rubyntlm'
28
+ s.add_runtime_dependency 'icalendar'
29
+ s.add_runtime_dependency 'viewpoint'
30
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: remember_the_meeting
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Milan Dobrota
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-25 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: nokogiri
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: handsoap
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: httpclient
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: rubyntlm
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: icalendar
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: viewpoint
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :runtime
104
+ version_requirements: *id006
105
+ description: "Gem that integrates against Exchange server and notifies you 15 minutes before meetings. Linux and OSX. "
106
+ email:
107
+ - milan@milandobrota.com
108
+ executables:
109
+ - remember_the_meeting
110
+ extensions: []
111
+
112
+ extra_rdoc_files: []
113
+
114
+ files:
115
+ - .gitignore
116
+ - Gemfile
117
+ - README.md
118
+ - Rakefile
119
+ - bin/remember_the_meeting
120
+ - config/exchange.yml
121
+ - lib/remember_the_meeting.rb
122
+ - lib/remember_the_meeting/calendar_item_patch.rb
123
+ - lib/remember_the_meeting/platform.rb
124
+ - lib/remember_the_meeting/version.rb
125
+ - remember_the_meeting.gemspec
126
+ has_rdoc: true
127
+ homepage: ""
128
+ licenses: []
129
+
130
+ post_install_message:
131
+ rdoc_options: []
132
+
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
143
+ version: "0"
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
152
+ version: "0"
153
+ requirements: []
154
+
155
+ rubyforge_project: remember_the_meeting
156
+ rubygems_version: 1.3.7
157
+ signing_key:
158
+ specification_version: 3
159
+ summary: Gem that integrates against Exchange server and notifies you 15 minutes before meetings.
160
+ test_files: []
161
+