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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b20cf6bcdcf4a21186e5a8be8ae50ed664623e32
4
- data.tar.gz: 93daf81e6fb27f4b5b51f217aa8e1dec483cbcb5
3
+ metadata.gz: ceacc0f6edcb2ac39967e9aa9832ec98b9a9cba0
4
+ data.tar.gz: f33a79c5c2c5d5a18e577ff91d5ea0a985dcfed4
5
5
  SHA512:
6
- metadata.gz: 35e8a089cbe00a52d086a0d3c093fc72da3ec43c9fbd1a8b8d40337d064e461dfc3dff6b1a3be3a9a724829bbde375baa6990c84b1f19e9d4cbe4dbeae5a8ec1
7
- data.tar.gz: 2a274be2fcb0c7bf1c0fdd6108f239d3ea5b66c4c8fa62a8ebcf81284748420575ff60cd1f3d3ad217041bc97a67b6444e3d9e88e8b713f3019a7cd0ce0db33c
6
+ metadata.gz: 9e0964efaa98ae82564b5e861d322b048f923125c1b4bc15ba5e1fe0369dd1032eef43d2ec3966b51078c737fa8367aff219d2530933b93dab7bde39ac38e0a4
7
+ data.tar.gz: 013f0dc42b9cf4143a847db644aa6d92e878a0b2337884f2f61355da7320ca875f87c9959e3bf9fc98b184e7ea1ae53ec1d7ea967e4e2e0ccdd74674bc1de7f1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis-config (0.1.2)
4
+ travis-config (0.1.3)
5
5
  hashr (~> 0.0)
6
6
 
7
7
  GEM
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module TravisConfig
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -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 POOL_SIZE) }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis CI