travis 1.2.1 → 1.2.2

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: 48ae038ebc8fe65bc53a3e6ed066bb28e7d6cfd2
4
- data.tar.gz: 62c2594506f70fecd4a968845874ec0f437e5554
3
+ metadata.gz: cda21789737990f798f8234501d7973bdf75c90f
4
+ data.tar.gz: 86ea0816fb1f70c7784c4f5628e111639e5bb72f
5
5
  SHA512:
6
- metadata.gz: c1ec04404b5187033308316c51eeb9d70dd566b095d75ef59ac3016a1cf9d3c5a35306fcf7268dff45e616888c3658fb7ec4c2e1b8fad88d54fc3ef438fe430d
7
- data.tar.gz: 9640638761e3e557fd4751c2386afed2b72b6add16ab1f1437e53dd216c703c7ef5a11454b81aee122e04cac6dfb2f4b5d35203adf69660fd7afab0d332ee0ad
6
+ metadata.gz: 24524107e5fe9b919e8a40dfb1734780fe06abcefc9342493e56fc300d00a103f1c6fa9b802b22a20597fc8ac09fcf19fb614fa75b5659cfa171dd72bf585f41
7
+ data.tar.gz: dc95bcb8417bfcbd86a3ed237d214a8546c4a5ea05212cf3f961cfbb74ddfbdd718d3657471e91a39d4695c06db7255cefc7ee5a73f83adbb096aaaefa6c6b4d
data/README.md CHANGED
@@ -888,6 +888,11 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
888
888
 
889
889
  ## Version History
890
890
 
891
+ **v1.2.2** (May 24, 2013)
892
+
893
+ * Fixed `travis disable`.
894
+ * Fix edge cases around `travis encrypt`.
895
+
891
896
  **v1.2.1** (May 24, 2013)
892
897
 
893
898
  * Builds with high build numbers are properly aligned when running `travis history`.
@@ -5,7 +5,7 @@ module Travis
5
5
  class Disable < RepoCommand
6
6
  def run
7
7
  authenticate
8
- repository.enable
8
+ repository.disable
9
9
  say "disabled", color("#{slug}: %s :(", :error)
10
10
  end
11
11
  end
@@ -32,15 +32,7 @@ module Travis
32
32
  encrypted = data.map { |data| repository.encrypt(data) }
33
33
 
34
34
  if config_key
35
- travis_config = YAML.load_file(travis_yaml)
36
- travis_config = {} if [[], false, nil].include? travis_config
37
- keys = config_key.split('.')
38
- last_key = keys.pop
39
- nested_config = keys.inject(travis_config) { |c,k| c[k] ||= {}}
40
- nested_config = nested_config[last_key] ||= []
41
- encrypted.each do |encrypted|
42
- nested_config << { 'secure' => encrypted }
43
- end
35
+ set_config encrypted.map { |e| { 'secure' => e } }
44
36
  File.write(travis_yaml, travis_config.to_yaml)
45
37
  else
46
38
  list = encrypted.map { |data| format(data.inspect, " secure: %s") }
@@ -50,6 +42,52 @@ module Travis
50
42
 
51
43
  private
52
44
 
45
+ def travis_config
46
+ @travis_config ||= begin
47
+ payload = YAML.load_file(travis_yaml)
48
+ payload.respond_to?(:to_hash) ? payload.to_hash : {}
49
+ end
50
+ end
51
+
52
+ def set_config(result)
53
+ parent_config[last_key] = merge_config(result)
54
+ end
55
+
56
+ def merge_config(result)
57
+ case subconfig = parent_config[last_key]
58
+ when nil then result.size == 1 ? result.first : result
59
+ when Array then subconfig + result
60
+ else result.unshift(subconfig)
61
+ end
62
+ end
63
+
64
+ def subconfig
65
+ end
66
+
67
+ def key_chain
68
+ @key_chain ||= config_key.split('.')
69
+ end
70
+
71
+ def last_key
72
+ key_chain.last
73
+ end
74
+
75
+ def parent_config
76
+ @parent_config ||= traverse_config(travis_config, *key_chain[0..-2])
77
+ end
78
+
79
+ def traverse_config(hash, key = nil, *rest)
80
+ return hash unless key
81
+
82
+ hash[key] = case value = hash[key]
83
+ when nil then {}
84
+ when Hash then value
85
+ else { 'matrix' => Array(value) }
86
+ end
87
+
88
+ traverse_config(hash[key], *rest)
89
+ end
90
+
53
91
  def travis_yaml(dir = Dir.pwd)
54
92
  path = File.expand_path('.travis.yml', dir)
55
93
  if File.exist? path
@@ -1,3 +1,3 @@
1
1
  module Travis
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # general infos
4
4
  s.name = "travis"
5
- s.version = "1.2.1"
5
+ s.version = "1.2.2"
6
6
  s.description = "CLI and Ruby client library for Travis CI"
7
7
  s.homepage = "https://github.com/travis-ci/travis"
8
8
  s.summary = "Travis CI client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase