travis-config 1.1.0 → 1.1.1

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: aea576de8c27f7e41b5dfd80e34006f1f19295aa
4
- data.tar.gz: 2ac9a83e70854a1afe14777f339b1942715b75d1
3
+ metadata.gz: 2db328b9fff6ec2788a6c6b297005601117a8045
4
+ data.tar.gz: 239d6c3e786ea50e771b22134c6c514ddc43e7fe
5
5
  SHA512:
6
- metadata.gz: 5545ec1bd08707b7beb3a9417befe88594aa3b982b35ba0992888a0b63540980da98c01e097ef3f1d09c296bc74fbeae0a849fcaf833ff952513543f810cc860
7
- data.tar.gz: f0429bb8d0efc0c9be9977c910d853b2c0a0e48014559fb1104894a1813f057721e61e4104ed00706c56cd5bc5ce9381e006dc75b62d91f0ce7f4bfc297e92ed
6
+ metadata.gz: 30d43b9068219b5c555a713c631c81b862ef60b129646f11f3e7095a40783ef835a5f1128b51ebf3a7b3743b855eee6d86b2dea6601736b69762f781c77acf80
7
+ data.tar.gz: fd874e4d30b6ca7d298dd72b68fb2e26dcf6e8b2ea749b23530cb43bdf299960d69b92f851a81be2332b8625e340e2ec4e4a36b4b2879092bb645c1d11802f15
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis-config (1.0.13)
4
+ travis-config (1.1.0)
5
5
  hashr (~> 2.0.0)
6
6
 
7
7
  GEM
@@ -39,4 +39,4 @@ DEPENDENCIES
39
39
  travis-config!
40
40
 
41
41
  BUNDLED WITH
42
- 1.14.5
42
+ 1.14.6
@@ -47,7 +47,7 @@ module Travis
47
47
  key = key.map(&:upcase).join('_')
48
48
  value = env.fetch(key, default)
49
49
  raise UnexpectedString.new(key, value) if value.is_a?(String) && hashes?(default)
50
- default.is_a?(Array) ? split(value) : cast(value)
50
+ default.is_a?(Array) ? split(value) : cast(value, default)
51
51
  end
52
52
 
53
53
  def vars(env, keys, default)
@@ -57,7 +57,7 @@ module Travis
57
57
  vars.group_by(&:pop).values.map(&:to_h)
58
58
  end
59
59
 
60
- def cast(value)
60
+ def cast(value, default = nil)
61
61
  case value
62
62
  when /^[\d]+\.[\d]+$/
63
63
  value.to_f
@@ -70,7 +70,7 @@ module Travis
70
70
  when ''
71
71
  nil
72
72
  else
73
- value
73
+ default.is_a?(Symbol) ? value.to_sym : value
74
74
  end
75
75
  end
76
76
 
@@ -85,7 +85,7 @@ module Travis
85
85
  end
86
86
 
87
87
  def self.prefix(prefix = nil)
88
- prefix ? @prefix = prefix : @prefix
88
+ prefix ? @prefix = prefix : @prefix ||= 'travis'
89
89
  end
90
90
 
91
91
  def load
@@ -1,3 +1,3 @@
1
1
  module TravisConfig
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -2,6 +2,7 @@ module Travis::Test::Env
2
2
  class Config < Travis::Config
3
3
  define database: { adapter: nil, variables: { statement_timeout: nil } },
4
4
  hash: { under_scored: nil, nested: { foo: nil } },
5
+ symbol: :foo,
5
6
  integer: nil,
6
7
  float: nil,
7
8
  true: nil,
@@ -11,9 +12,6 @@ module Travis::Test::Env
11
12
  no: nil,
12
13
  off: nil,
13
14
  nil: nil
14
-
15
-
16
- Env.prefix :travis
17
15
  end
18
16
  end
19
17
 
@@ -23,6 +21,7 @@ describe Travis::Config::Env do
23
21
  describe 'cast' do
24
22
  env TRAVIS_HASH_UNDER_SCORED: 'under_scored',
25
23
  TRAVIS_HASH_NESTED_FOO: 'foo',
24
+ TRAVIS_SYMBOL: 'bar',
26
25
  TRAVIS_INTEGER: '10',
27
26
  TRAVIS_FLOAT: '10.0',
28
27
  TRAVIS_TRUE: 'true',
@@ -35,6 +34,7 @@ describe Travis::Config::Env do
35
34
 
36
35
  it { expect(config.hash.under_scored).to eq 'under_scored' }
37
36
  it { expect(config.hash.nested.foo).to eq 'foo' }
37
+ it { expect(config.symbol).to eq :bar }
38
38
  it { expect(config.integer).to eq 10 }
39
39
  it { expect(config.float).to eq 10.0 }
40
40
  it { expect(config.true).to be true }
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis CI