-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathtravis.rb
More file actions
70 lines (57 loc) · 1.66 KB
/
travis.rb
File metadata and controls
70 lines (57 loc) · 1.66 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require 'pusher'
require 'travis/support'
require 'travis/support/database'
require 'travis/errors'
module Travis
class << self
attr_accessor :testing
def services=(services)
@services = services
end
def services
@services ||= Travis::Services
end
end
require 'travis/model'
require 'travis/task'
require 'travis/event'
require 'travis/api/serialize'
require 'travis/config/defaults'
require 'travis/features'
require 'travis/github'
require 'travis/notification'
require 'travis/services'
class UnknownRepository < StandardError; end
class GithubApiError < StandardError; end
class AdminMissing < StandardError; end
class RepositoryMissing < StandardError; end
class LogAlreadyRemoved < StandardError; end
class AuthorizationDenied < StandardError; end
class JobUnfinished < StandardError; end
class << self
attr_accessor :config
def setup(options = {})
@config = Config.load(*options[:configs])
Travis.logger.info("Setting up module Travis")
Services.register
Github::Services.register
end
def redis
@redis ||= Redis.new(config.redis.to_h)
end
def pusher
@pusher ||= ::Pusher.tap do |pusher|
pusher.app_id = config.pusher.app_id
pusher.key = config.pusher.key
pusher.secret = config.pusher.secret
pusher.scheme = config.pusher.scheme if config.pusher.scheme
pusher.host = config.pusher.host if config.pusher.host
pusher.port = config.pusher.port if config.pusher.port
end
end
def states_cache
@states_cache ||= Travis::StatesCache.new
end
end
setup
end