travis-config 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/travis/config/heroku.rb +11 -2
- data/lib/travis/config/heroku/database.rb +7 -10
- data/lib/travis/config/version.rb +1 -1
- data/spec/travis/config/heroku/database_spec.rb +101 -69
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ef1a02277339c9c3f8f26ace76974090635ca7f
|
4
|
+
data.tar.gz: 2b874c972e135d322e470e6758390c59ed23b6c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d9a4d344e3a683dcc128732a015d77b24ce7b749236d9e0535908bb9268c4e7afeba743e1857d1f758fdc923961ff524a6a57a15b3e6a76fc6b76cbd8c7d92
|
7
|
+
data.tar.gz: e6dad88f4181ec55a9669d350e3df5e8171ecb3301f2a653e04b5fc20b7d5af71f1536e8181f87b773ff55763c98d28035535237b4fac3abfd6483c59364b2d5
|
data/Gemfile.lock
CHANGED
data/lib/travis/config/heroku.rb
CHANGED
@@ -28,16 +28,25 @@ module Travis
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def amqp
|
31
|
-
compact(Url.parse(
|
31
|
+
compact(Url.parse(amqp_url).to_h)
|
32
32
|
end
|
33
33
|
|
34
34
|
def redis
|
35
|
-
compact(url:
|
35
|
+
compact(url: redis_url)
|
36
36
|
end
|
37
37
|
|
38
38
|
def memcached
|
39
39
|
Memcached.new.config
|
40
40
|
end
|
41
|
+
|
42
|
+
def amqp_url
|
43
|
+
# rabbitmq-bigwig add-ons can only be attached as RABBITMQ_BIGWIG
|
44
|
+
ENV['TRAVIS_RABBITMQ_URL'] || ENV['RABBITMQ_URL'] || ENV['RABBITMQ_BIGWIG_URL']
|
45
|
+
end
|
46
|
+
|
47
|
+
def redis_url
|
48
|
+
ENV['TRAVIS_REDIS_URL'] || ENV['REDIS_URL']
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -6,27 +6,24 @@ module Travis
|
|
6
6
|
class Database < Struct.new(:options)
|
7
7
|
include Helpers
|
8
8
|
|
9
|
-
|
9
|
+
VARIABLES = { application_name: ENV['DYNO'] || $0, statement_timeout: 10_000 }
|
10
|
+
DEFAULTS = { adapter: 'postgresql', encoding: 'unicode', variables: VARIABLES }
|
10
11
|
|
11
12
|
def config
|
12
|
-
config =
|
13
|
-
config = DEFAULTS
|
13
|
+
config = compact(Url.parse(url).to_h)
|
14
|
+
config = deep_merge(DEFAULTS, config) unless config.empty?
|
14
15
|
config[:pool] = pool.to_i if pool
|
15
16
|
config
|
16
17
|
end
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
def
|
21
|
-
|
21
|
+
def url
|
22
|
+
env('TRAVIS_DATABASE_URL', 'DATABASE_URL').compact.first
|
22
23
|
end
|
23
24
|
|
24
25
|
def pool
|
25
|
-
env('
|
26
|
-
end
|
27
|
-
|
28
|
-
def url
|
29
|
-
env('DATABASE_URL').compact.first
|
26
|
+
env('TRAVIS_DATABASE_POOL_SIZE', 'DATABASE_POOL_SIZE', 'DB_POOL').compact.first
|
30
27
|
end
|
31
28
|
|
32
29
|
def env(*keys)
|
@@ -1,21 +1,36 @@
|
|
1
1
|
describe Travis::Config::Heroku, :Database do
|
2
2
|
let(:config) { Travis::Test::Config.load(:heroku) }
|
3
|
-
let(:vars) { %w(DATABASE_URL DB_POOL DATABASE_POOL_SIZE LOGS_DATABASE_URL LOGS_DB_POOL LOGS_DATABASE_POOL_SIZE DYNO) }
|
3
|
+
let(:vars) { %w(TRAVIS_DATABASE_URL DATABASE_URL DB_POOL TRAVIS_DATABASE_POOL_SIZE DATABASE_POOL_SIZE LOGS_DATABASE_URL LOGS_DB_POOL LOGS_DATABASE_POOL_SIZE DYNO) }
|
4
4
|
after { vars.each { |key| ENV.delete(key) } }
|
5
5
|
before { ENV['DYNO'] = 'app_name' }
|
6
6
|
|
7
|
+
it 'loads a TRAVIS_DATABASE_URL with a port' do
|
8
|
+
ENV['TRAVIS_DATABASE_URL'] = 'postgres://username:password@hostname:1234/database'
|
9
|
+
|
10
|
+
expect(config.database.to_h).to eq(
|
11
|
+
adapter: 'postgresql',
|
12
|
+
host: 'hostname',
|
13
|
+
port: 1234,
|
14
|
+
database: 'database',
|
15
|
+
username: 'username',
|
16
|
+
password: 'password',
|
17
|
+
encoding: 'unicode',
|
18
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
7
22
|
it 'loads a DATABASE_URL with a port' do
|
8
23
|
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:1234/database'
|
9
24
|
|
10
25
|
expect(config.database.to_h).to eq(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
26
|
+
adapter: 'postgresql',
|
27
|
+
host: 'hostname',
|
28
|
+
port: 1234,
|
29
|
+
database: 'database',
|
30
|
+
username: 'username',
|
31
|
+
password: 'password',
|
32
|
+
encoding: 'unicode',
|
33
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
19
34
|
)
|
20
35
|
end
|
21
36
|
|
@@ -23,30 +38,30 @@ describe Travis::Config::Heroku, :Database do
|
|
23
38
|
ENV['DATABASE_URL'] = 'postgres://username:password@hostname/database'
|
24
39
|
|
25
40
|
expect(config.database.to_h).to eq(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
adapter: 'postgresql',
|
42
|
+
host: 'hostname',
|
43
|
+
database: 'database',
|
44
|
+
username: 'username',
|
45
|
+
password: 'password',
|
46
|
+
encoding: 'unicode',
|
47
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
33
48
|
)
|
34
49
|
end
|
35
50
|
|
36
|
-
it 'loads
|
51
|
+
it 'loads DATABASE_POOL_SIZE' do
|
37
52
|
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:1234/database'
|
38
|
-
ENV['
|
53
|
+
ENV['DATABASE_POOL_SIZE'] = '25'
|
39
54
|
|
40
55
|
expect(config.database.to_h).to eq(
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
adapter: 'postgresql',
|
57
|
+
host: 'hostname',
|
58
|
+
port: 1234,
|
59
|
+
database: 'database',
|
60
|
+
username: 'username',
|
61
|
+
password: 'password',
|
62
|
+
encoding: 'unicode',
|
63
|
+
pool: 25,
|
64
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
50
65
|
)
|
51
66
|
end
|
52
67
|
|
@@ -55,15 +70,32 @@ describe Travis::Config::Heroku, :Database do
|
|
55
70
|
ENV['DATABASE_POOL_SIZE'] = '25'
|
56
71
|
|
57
72
|
expect(config.database.to_h).to eq(
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
adapter: 'postgresql',
|
74
|
+
host: 'hostname',
|
75
|
+
port: 1234,
|
76
|
+
database: 'database',
|
77
|
+
username: 'username',
|
78
|
+
password: 'password',
|
79
|
+
encoding: 'unicode',
|
80
|
+
pool: 25,
|
81
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'loads DB_POOL' do
|
86
|
+
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:1234/database'
|
87
|
+
ENV['DB_POOL'] = '25'
|
88
|
+
|
89
|
+
expect(config.database.to_h).to eq(
|
90
|
+
adapter: 'postgresql',
|
91
|
+
host: 'hostname',
|
92
|
+
port: 1234,
|
93
|
+
database: 'database',
|
94
|
+
username: 'username',
|
95
|
+
password: 'password',
|
96
|
+
encoding: 'unicode',
|
97
|
+
pool: 25,
|
98
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
67
99
|
)
|
68
100
|
end
|
69
101
|
|
@@ -71,14 +103,14 @@ describe Travis::Config::Heroku, :Database do
|
|
71
103
|
ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:1234/logs_database'
|
72
104
|
|
73
105
|
expect(config.logs_database.to_h).to eq(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
106
|
+
adapter: 'postgresql',
|
107
|
+
host: 'hostname',
|
108
|
+
port: 1234,
|
109
|
+
database: 'logs_database',
|
110
|
+
username: 'username',
|
111
|
+
password: 'password',
|
112
|
+
encoding: 'unicode',
|
113
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
82
114
|
)
|
83
115
|
end
|
84
116
|
|
@@ -86,13 +118,13 @@ describe Travis::Config::Heroku, :Database do
|
|
86
118
|
ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname/logs_database'
|
87
119
|
|
88
120
|
expect(config.logs_database.to_h).to eq(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
121
|
+
adapter: 'postgresql',
|
122
|
+
host: 'hostname',
|
123
|
+
database: 'logs_database',
|
124
|
+
username: 'username',
|
125
|
+
password: 'password',
|
126
|
+
encoding: 'unicode',
|
127
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
96
128
|
)
|
97
129
|
end
|
98
130
|
|
@@ -101,15 +133,15 @@ describe Travis::Config::Heroku, :Database do
|
|
101
133
|
ENV['LOGS_DB_POOL'] = '1'
|
102
134
|
|
103
135
|
expect(config.logs_database.to_h).to eq(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
136
|
+
adapter: 'postgresql',
|
137
|
+
host: 'hostname',
|
138
|
+
port: 1234,
|
139
|
+
database: 'logs_database',
|
140
|
+
username: 'username',
|
141
|
+
password: 'password',
|
142
|
+
encoding: 'unicode',
|
143
|
+
pool: 1,
|
144
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
113
145
|
)
|
114
146
|
end
|
115
147
|
|
@@ -118,15 +150,15 @@ describe Travis::Config::Heroku, :Database do
|
|
118
150
|
ENV['LOGS_DATABASE_POOL_SIZE'] = '25'
|
119
151
|
|
120
152
|
expect(config.logs_database.to_h).to eq(
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
153
|
+
adapter: 'postgresql',
|
154
|
+
host: 'hostname',
|
155
|
+
port: 1234,
|
156
|
+
database: 'logs_database',
|
157
|
+
username: 'username',
|
158
|
+
password: 'password',
|
159
|
+
encoding: 'unicode',
|
160
|
+
pool: 25,
|
161
|
+
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
130
162
|
)
|
131
163
|
end
|
132
164
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis CI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashr
|