txgh 2.0.0 → 2.0.1

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: 083d15ac3686b54241f76f3cf7da05783ed9b189
4
- data.tar.gz: 42bbf8c31844b25f9c05a74701a6625980d3e7ea
3
+ metadata.gz: 41d11b7b8102cca5e57f005f206a07ae1e80b37b
4
+ data.tar.gz: 00d3f323be5b4e668d4ad92e89d4211027899346
5
5
  SHA512:
6
- metadata.gz: 4117c59c816d16878946db1cc5451dfd822c7386c8347d11b952c8e68c620cf88d98ed5360f04752c781621dece4bcb9507debef086a682f38cb31baca14c391
7
- data.tar.gz: d24d9cad4af2d0d8ee8bdf3f8a93f681650e535184d1f25a8d0e29818f7de86cc41751ab9927243de2ab04dd0406a14abc514e691c4059aab116c710690ebc5e
6
+ metadata.gz: 7a609ee7470a0787d7c350ab62fd871eabd615fcf9645d5f9807de6644587da41e52596dcb28437bb568f8a0cc937598db56b9f1e9ccd5358d5a682e02d8cf55
7
+ data.tar.gz: 99d8736582500541ba8967d5d621d55a49eec61dd3c0138a0c54f886963112cd52aff95348ce6faa880728e47b7ac4be0cd767ef57b7711c66427dad7dcbfb94
@@ -11,6 +11,10 @@ module Txgh
11
11
  config['name']
12
12
  end
13
13
 
14
+ def organization
15
+ config['organization']
16
+ end
17
+
14
18
  def webhook_secret
15
19
  config['webhook_secret']
16
20
  end
@@ -27,7 +31,7 @@ module Txgh
27
31
  end
28
32
 
29
33
  def auto_delete_resources?
30
- (config['auto_delete_resources'] || '').downcase == 'true'
34
+ Utils.booleanize(config['auto_delete_resources'] || 'false')
31
35
  end
32
36
 
33
37
  def tx_config_uri
data/lib/txgh/utils.rb CHANGED
@@ -42,6 +42,15 @@ module Txgh
42
42
  ret[hash[key]] = hash
43
43
  end
44
44
  end
45
+
46
+ def booleanize(obj)
47
+ case obj
48
+ when String
49
+ obj.downcase == 'true'
50
+ when TrueClass, FalseClass
51
+ obj
52
+ end
53
+ end
45
54
  end
46
55
 
47
56
  Utils.extend(Utils)
data/lib/txgh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Txgh
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
@@ -32,7 +32,12 @@ describe TransifexProject do
32
32
  expect(transifex_project.auto_delete_resources?).to eq(false)
33
33
  end
34
34
 
35
- it 'returns true if configured' do
35
+ it 'returns true if configured with bool' do
36
+ project_config['auto_delete_resources'] = true
37
+ expect(transifex_project.auto_delete_resources?).to eq(true)
38
+ end
39
+
40
+ it 'returns true if configured with string' do
36
41
  project_config['auto_delete_resources'] = 'true'
37
42
  expect(transifex_project.auto_delete_resources?).to eq(true)
38
43
  end
data/spec/utils_spec.rb CHANGED
@@ -55,4 +55,21 @@ describe Utils do
55
55
  })
56
56
  end
57
57
  end
58
+
59
+ describe '.booleanize' do
60
+ it 'converts a string into a bool' do
61
+ expect(Utils.booleanize('true')).to eq(true)
62
+ expect(Utils.booleanize('false')).to eq(false)
63
+ end
64
+
65
+ it 'converts a badly-cased string into a bool' do
66
+ expect(Utils.booleanize('TrUe')).to eq(true)
67
+ expect(Utils.booleanize('faLSE')).to eq(false)
68
+ end
69
+
70
+ it "doesn't convert bools" do
71
+ expect(Utils.booleanize(true)).to eq(true)
72
+ expect(Utils.booleanize(false)).to eq(false)
73
+ end
74
+ end
58
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txgh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Jackowski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-27 00:00:00.000000000 Z
12
+ date: 2016-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: abroad