travis-config 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbc7a2d8183a191085935a7231c5b5dfd70aabc9
4
- data.tar.gz: d93f522f61921493e144e8a1b03b4588439ab649
3
+ metadata.gz: b20cf6bcdcf4a21186e5a8be8ae50ed664623e32
4
+ data.tar.gz: 93daf81e6fb27f4b5b51f217aa8e1dec483cbcb5
5
5
  SHA512:
6
- metadata.gz: 361e6fcbb5b39ae63d0463b14d362014e40f69495c19b34e251b74813655b50c3d37709dd45512e60e4cb95bc84ec3e1050022b6a997b80e0da4b666729c93f6
7
- data.tar.gz: 1161fe3d03c1ef110be6d8bde3cb60b086fbfd263750e3a84f19c60584bd56bb9dba5d92293c62b963c32d9ce2d19244b4445cec79077b030b308ae33e24f5c0
6
+ metadata.gz: 35e8a089cbe00a52d086a0d3c093fc72da3ec43c9fbd1a8b8d40337d064e461dfc3dff6b1a3be3a9a724829bbde375baa6990c84b1f19e9d4cbe4dbeae5a8ec1
7
+ data.tar.gz: 2a274be2fcb0c7bf1c0fdd6108f239d3ea5b66c4c8fa62a8ebcf81284748420575ff60cd1f3d3ad217041bc97a67b6444e3d9e88e8b713f3019a7cd0ce0db33c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis-config (0.1.1)
4
+ travis-config (0.1.2)
5
5
  hashr (~> 0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -61,5 +61,5 @@ one go:
61
61
 
62
62
  ```bash
63
63
  $ gem install gem-release
64
- $ gem release --tag
64
+ $ gem bump --push --tag --release
65
65
  ```
@@ -9,7 +9,10 @@ module Travis
9
9
  DATABASE_URL = %r((?:.+?)://(?<username>.+):(?<password>.+)@(?<host>[^:]+):?(?<port>.*)/(?<database>.+))
10
10
 
11
11
  def load
12
- { database: database }
12
+ {
13
+ database: database,
14
+ logs_database: logs_database
15
+ }
13
16
  end
14
17
 
15
18
  private
@@ -20,6 +23,12 @@ module Travis
20
23
  config
21
24
  end
22
25
 
26
+ def logs_database
27
+ config = parse_database_url(logs_database_url)
28
+ config = config.merge(pool: logs_pool_size.to_i) if logs_pool_size
29
+ config
30
+ end
31
+
23
32
  def parse_database_url(url)
24
33
  matches = DATABASE_URL.match(url.to_s)
25
34
  matches ? compact(Hash[matches.names.zip(matches.captures)]) : {}
@@ -29,9 +38,17 @@ module Travis
29
38
  ENV.values_at('DB_POOL', 'DATABASE_POOL_SIZE').compact.first
30
39
  end
31
40
 
41
+ def logs_pool_size
42
+ ENV.values_at('LOGS_DB_POOL', 'LOGS_DATABASE_POOL_SIZE').compact.first
43
+ end
44
+
32
45
  def database_url
33
46
  ENV.values_at('DATABASE_URL', 'SHARED_DATABASE_URL').compact.first
34
47
  end
48
+
49
+ def logs_database_url
50
+ ENV.values_at('LOGS_DATABASE_URL', 'SHARED_LOGS_DATABASE_URL').compact.first
51
+ end
35
52
  end
36
53
  end
37
54
  end
@@ -1,3 +1,3 @@
1
1
  module TravisConfig
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ 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' }
10
11
  end
11
12
  end
12
13
 
@@ -3,6 +3,7 @@ describe Travis::Config::Heroku do
3
3
  let(:vars) { %w(DATABASE_URL POOL_SIZE) }
4
4
  after { vars.each { |key| ENV.delete(key) } }
5
5
  before { ENV['DATABASE_URL'] = 'postgres://username:password@hostname:port/database' }
6
+ before { ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname:port/logs_database' }
6
7
 
7
8
  it 'loads a DATABASE_URL with a port' do
8
9
  expect(config.database.to_hash).to eq(
@@ -58,4 +59,59 @@ describe Travis::Config::Heroku do
58
59
  pool: 25
59
60
  )
60
61
  end
62
+
63
+ it 'loads a LOGS_DATABASE_URL with a port' do
64
+ expect(config.logs_database.to_hash).to eq(
65
+ adapter: 'postgresql',
66
+ host: 'hostname',
67
+ port: 'port',
68
+ database: 'logs_database',
69
+ username: 'username',
70
+ password: 'password',
71
+ encoding: 'unicode'
72
+ )
73
+ end
74
+
75
+ it 'loads a LOGS_DATABASE_URL without a port' do
76
+ ENV['LOGS_DATABASE_URL'] = 'postgres://username:password@hostname/logs_database'
77
+
78
+ expect(config.logs_database.to_hash).to eq(
79
+ adapter: 'postgresql',
80
+ host: 'hostname',
81
+ database: 'logs_database',
82
+ username: 'username',
83
+ password: 'password',
84
+ encoding: 'unicode'
85
+ )
86
+ end
87
+
88
+ it 'loads LOGS_DB_POOL' do
89
+ ENV['LOGS_DB_POOL'] = '25'
90
+
91
+ expect(config.logs_database.to_hash).to eq(
92
+ adapter: 'postgresql',
93
+ host: 'hostname',
94
+ port: 'port',
95
+ database: 'logs_database',
96
+ username: 'username',
97
+ password: 'password',
98
+ encoding: 'unicode',
99
+ pool: 25
100
+ )
101
+ end
102
+
103
+ it 'loads LOGS_DATABASE_POOL_SIZE' do
104
+ ENV['LOGS_DATABASE_POOL_SIZE'] = '25'
105
+
106
+ expect(config.logs_database.to_hash).to eq(
107
+ adapter: 'postgresql',
108
+ host: 'hostname',
109
+ port: 'port',
110
+ database: 'logs_database',
111
+ username: 'username',
112
+ password: 'password',
113
+ encoding: 'unicode',
114
+ pool: 25
115
+ )
116
+ end
61
117
  end
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: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis CI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashr