travis-config 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/travis/config/heroku.rb +2 -5
- data/lib/travis/config/version.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/travis/config/heroku_spec.rb +13 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ceacc0f6edcb2ac39967e9aa9832ec98b9a9cba0
|
|
4
|
+
data.tar.gz: f33a79c5c2c5d5a18e577ff91d5ea0a985dcfed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e0964efaa98ae82564b5e861d322b048f923125c1b4bc15ba5e1fe0369dd1032eef43d2ec3966b51078c737fa8367aff219d2530933b93dab7bde39ac38e0a4
|
|
7
|
+
data.tar.gz: 013f0dc42b9cf4143a847db644aa6d92e878a0b2337884f2f61355da7320ca875f87c9959e3bf9fc98b184e7ea1ae53ec1d7ea967e4e2e0ccdd74674bc1de7f1
|
data/Gemfile.lock
CHANGED
data/lib/travis/config/heroku.rb
CHANGED
|
@@ -9,10 +9,7 @@ module Travis
|
|
|
9
9
|
DATABASE_URL = %r((?:.+?)://(?<username>.+):(?<password>.+)@(?<host>[^:]+):?(?<port>.*)/(?<database>.+))
|
|
10
10
|
|
|
11
11
|
def load
|
|
12
|
-
|
|
13
|
-
database: database,
|
|
14
|
-
logs_database: logs_database
|
|
15
|
-
}
|
|
12
|
+
compact(database: database, logs_database: logs_database)
|
|
16
13
|
end
|
|
17
14
|
|
|
18
15
|
private
|
|
@@ -26,7 +23,7 @@ module Travis
|
|
|
26
23
|
def logs_database
|
|
27
24
|
config = parse_database_url(logs_database_url)
|
|
28
25
|
config = config.merge(pool: logs_pool_size.to_i) if logs_pool_size
|
|
29
|
-
config
|
|
26
|
+
config.merge(adapter: 'postgresql', encoding: 'unicode') unless config.empty?
|
|
30
27
|
end
|
|
31
28
|
|
|
32
29
|
def parse_database_url(url)
|
data/spec/spec_helper.rb
CHANGED
|
@@ -7,7 +7,6 @@ module Travis::Test
|
|
|
7
7
|
class Config < Travis::Config
|
|
8
8
|
define amqp: { username: 'guest', password: 'guest', host: 'localhost', prefetch: 1 }
|
|
9
9
|
define database: { adapter: 'postgresql', database: 'test', encoding: 'unicode' }
|
|
10
|
-
define logs_database: { adapter: 'postgresql', database: 'logs_test', encoding: 'unicode' }
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
describe Travis::Config::Heroku do
|
|
2
2
|
let(:config) { Travis::Test::Config.load(:heroku) }
|
|
3
|
-
let(:vars) { %w(DATABASE_URL
|
|
3
|
+
let(:vars) { %w(DATABASE_URL DB_POOL DATABASE_POOL_SIZE LOGS_DATABASE_URL LOGS_DB_POOL LOGS_DATABASE_POOL_SIZE) }
|
|
4
4
|
after { vars.each { |key| ENV.delete(key) } }
|
|
5
|
-
before { ENV['DATABASE_URL'] = 'postgres://username:password@hostname:port/database' }
|
|
6
|
-
before { ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:port/logs_database' }
|
|
7
5
|
|
|
8
6
|
it 'loads a DATABASE_URL with a port' do
|
|
7
|
+
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:port/database'
|
|
8
|
+
|
|
9
9
|
expect(config.database.to_hash).to eq(
|
|
10
10
|
adapter: 'postgresql',
|
|
11
11
|
host: 'hostname',
|
|
@@ -31,6 +31,7 @@ describe Travis::Config::Heroku do
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'loads DB_POOL' do
|
|
34
|
+
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:port/database'
|
|
34
35
|
ENV['DB_POOL'] = '25'
|
|
35
36
|
|
|
36
37
|
expect(config.database.to_hash).to eq(
|
|
@@ -46,6 +47,7 @@ describe Travis::Config::Heroku do
|
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
it 'loads DATABASE_POOL_SIZE' do
|
|
50
|
+
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:port/database'
|
|
49
51
|
ENV['DATABASE_POOL_SIZE'] = '25'
|
|
50
52
|
|
|
51
53
|
expect(config.database.to_hash).to eq(
|
|
@@ -61,6 +63,8 @@ describe Travis::Config::Heroku do
|
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
it 'loads a LOGS_DATABASE_URL with a port' do
|
|
66
|
+
ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:port/logs_database'
|
|
67
|
+
|
|
64
68
|
expect(config.logs_database.to_hash).to eq(
|
|
65
69
|
adapter: 'postgresql',
|
|
66
70
|
host: 'hostname',
|
|
@@ -86,6 +90,7 @@ describe Travis::Config::Heroku do
|
|
|
86
90
|
end
|
|
87
91
|
|
|
88
92
|
it 'loads LOGS_DB_POOL' do
|
|
93
|
+
ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:port/logs_database'
|
|
89
94
|
ENV['LOGS_DB_POOL'] = '25'
|
|
90
95
|
|
|
91
96
|
expect(config.logs_database.to_hash).to eq(
|
|
@@ -101,6 +106,7 @@ describe Travis::Config::Heroku do
|
|
|
101
106
|
end
|
|
102
107
|
|
|
103
108
|
it 'loads LOGS_DATABASE_POOL_SIZE' do
|
|
109
|
+
ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:port/logs_database'
|
|
104
110
|
ENV['LOGS_DATABASE_POOL_SIZE'] = '25'
|
|
105
111
|
|
|
106
112
|
expect(config.logs_database.to_hash).to eq(
|
|
@@ -114,4 +120,8 @@ describe Travis::Config::Heroku do
|
|
|
114
120
|
pool: 25
|
|
115
121
|
)
|
|
116
122
|
end
|
|
123
|
+
|
|
124
|
+
it 'sets logs_database to nil if no logs db url given' do
|
|
125
|
+
expect(config.logs_database).to be_nil
|
|
126
|
+
end
|
|
117
127
|
end
|