travis-config 1.0.8 → 1.0.9
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.rb +8 -1
- data/lib/travis/config/env.rb +1 -1
- data/lib/travis/config/helpers.rb +1 -1
- data/lib/travis/config/heroku.rb +2 -3
- data/lib/travis/config/version.rb +1 -1
- data/spec/travis/config/heroku/database_spec.rb +1 -16
- data/spec/travis/config_spec.rb +23 -1
- 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: ece7b075d7cfafadd4396a14bbe84fbdac918b0e
|
4
|
+
data.tar.gz: 8e676abb5ced7f60cd329393eec3569404649ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317b2e96faa0bd261834a517f0337f764bcb4b2f4b527fa83091e14c155613fc993ab4f5bf0578409f1cd7d651ff5f31a2ffb8b8712811ea428dc8fea9ba0cee
|
7
|
+
data.tar.gz: 08d4f9ebd80a763543d62370b847c4eb0bd2552632adc5650c26183a351c5a7e3e0e853223c2fa0c77f9f9f55e94d9872d74958a1516eae3f811750619053915
|
data/Gemfile.lock
CHANGED
data/lib/travis/config.rb
CHANGED
@@ -17,7 +17,9 @@ module Travis
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def load(*names)
|
20
|
-
|
20
|
+
config = load_from(*names)
|
21
|
+
config = normalize(config)
|
22
|
+
new(config)
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
@@ -32,6 +34,11 @@ module Travis
|
|
32
34
|
names = [:files, :env, :heroku, :docker] if names.empty?
|
33
35
|
names.map { |name| const_get(camelize(name)).new }
|
34
36
|
end
|
37
|
+
|
38
|
+
def normalize(config)
|
39
|
+
config[:logs_database] = config[:database] if blank?(config[:logs_database])
|
40
|
+
config
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
def env
|
data/lib/travis/config/env.rb
CHANGED
data/lib/travis/config/heroku.rb
CHANGED
@@ -4,7 +4,7 @@ require 'travis/config/heroku/memcached'
|
|
4
4
|
|
5
5
|
module Travis
|
6
6
|
class Config
|
7
|
-
class Heroku
|
7
|
+
class Heroku # TODO rename to EnvVar
|
8
8
|
include Helpers
|
9
9
|
|
10
10
|
def load
|
@@ -24,8 +24,7 @@ module Travis
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def logs_database
|
27
|
-
|
28
|
-
config.empty? ? database : config
|
27
|
+
Database.new(prefix: 'logs').config
|
29
28
|
end
|
30
29
|
|
31
30
|
def amqp
|
@@ -193,22 +193,7 @@ describe Travis::Config::Heroku, :Database do
|
|
193
193
|
)
|
194
194
|
end
|
195
195
|
|
196
|
-
it '
|
197
|
-
ENV['DATABASE_URL'] = 'postgres://username:password@hostname:1234/logs_database'
|
198
|
-
|
199
|
-
expect(config.logs_database.to_h).to eq(
|
200
|
-
adapter: 'postgresql',
|
201
|
-
host: 'hostname',
|
202
|
-
port: 1234,
|
203
|
-
database: 'logs_database',
|
204
|
-
username: 'username',
|
205
|
-
password: 'password',
|
206
|
-
encoding: 'unicode',
|
207
|
-
variables: { application_name: 'travis-config/specs', statement_timeout: 10_000 }
|
208
|
-
)
|
209
|
-
end
|
210
|
-
|
211
|
-
it 'sets logs_database to nil if no DATABASE_URL and no LOGS_DATABASE_URL is given' do
|
196
|
+
it 'sets logs_database to nil if no LOGS_DATABASE_URL is given' do
|
212
197
|
expect(config.logs_database).to be_nil
|
213
198
|
end
|
214
199
|
end
|
data/spec/travis/config_spec.rb
CHANGED
@@ -47,9 +47,31 @@ describe Travis::Config do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
50
|
it 'deep symbolizes arrays, too' do
|
52
51
|
config = Travis::Config.new('queues' => [{ 'slug' => 'rails/rails', 'queue' => 'rails' }])
|
53
52
|
expect(config.queues.first.values_at(:slug, :queue)).to eq(['rails/rails', 'rails'])
|
54
53
|
end
|
54
|
+
|
55
|
+
describe 'logs_database config' do
|
56
|
+
before { ENV['DATABASE_URL'] = 'postgres://username:password@hostname:1234/database' }
|
57
|
+
after { ENV['DATABASE_URL'] = nil }
|
58
|
+
|
59
|
+
describe 'given logs_database is defined in a config file' do
|
60
|
+
before do
|
61
|
+
Dir.stubs(:[]).returns ['config/travis.yml']
|
62
|
+
YAML.stubs(:load_file).with('config/travis.yml').returns('test' => { 'logs_database' => { 'database' => 'config_file' } })
|
63
|
+
end
|
64
|
+
it { expect(config.logs_database.database).to eq 'config_file' }
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'given logs_database is defined in the keychain' do
|
68
|
+
before { ENV['travis_config'] = YAML.dump('logs_database' => { 'database' => 'keychain' }) }
|
69
|
+
after { ENV['travis_config'] = nil }
|
70
|
+
it { expect(config.logs_database.database).to eq 'keychain' }
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'given logs_database is not defined anywhere it defaults to database' do
|
74
|
+
it { expect(config.logs_database.database).to eq 'database' }
|
75
|
+
end
|
76
|
+
end
|
55
77
|
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: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis CI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashr
|