-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweetsvn.rb
46 lines (40 loc) · 1.46 KB
/
tweetsvn.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
require 'rubygems'
require 'bundler'
Bundler.setup
require 'yaml'
require_relative 'lib/update_twitter_from_source_transaction'
class Tweetsvn
def run
load_secrets
source = GmailCommitSource.new @secrets['source']['username'],
@secrets['source']['password']
tweeter = Tweeter.new @secrets['twitter']['consumer']['key'],
@secrets['twitter']['consumer']['secret'],
@secrets['twitter']['access']['token'],
@secrets['twitter']['access']['secret']
UpdateTwitterFromSourceTransaction.new(source,tweeter).run
end
private
def load_secrets
if File.exists?('config/secrets.yml')
@secrets = YAML::load_file('config/secrets.yml')
else
@secrets = {
'source' => {
'username' => ENV['TWEETSVN_SOURCE_USERNAME'],
'password' => ENV['TWEETSVN_SOURCE_PASSWORD']
},
'twitter' => {
'consumer' => {
'key' => ENV['TWEETSVN_TWITTER_CONSUMER_KEY'],
'secret' => ENV['TWEETSVN_TWITTER_CONSUMER_SECRET']
},
'access' => {
'token' => ENV['TWEETSVN_TWITTER_ACCESS_TOKEN'],
'secret' => ENV['TWEETSVN_TWITTER_ACCESS_SECRET']
}
}
}
end
end
end