travis 1.6.15.travis.559.6 → 1.6.15.travis.560.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWZhNzk4MTMxMzAyZGVjYWIwMTY1N2I4NWU4NTBiMWZiZjk1OGY4Yg==
4
+ MTFkODFiZjBmMDczZDMyOWRlOTYwMzQ1OGVjNGQ1NGZlYjAxODgzZA==
5
5
  data.tar.gz: !binary |-
6
- MGZlZjBhNzE2NmNkZjU2NzU4MjY5NzY4NzE4NjQ5ZmIxNGE0OWI4MQ==
6
+ ODIwNDA5YzkyODgzZTZlZjgzOTQzMjJkMTM4N2FlYzU5OWVkYzgzNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDNmMzhmZmUwNDk3ODcxMmEwNTJjZjk0ZjU5N2M2YjhlYzRmOTgxYzFlYWIx
10
- MThiZWI1ZjlmZWFiYzZkMmZkNGIxZDBlMjBmMDhkZjY3YzMzZmY2ODc1MjFk
11
- YmQ1MjA4ODkzZDgyZjA5NGE5ODFhMDdiYzNmNTg4OGFmMzc4MWQ=
9
+ Y2E1MDMzZDc0ZDQwYWRhYmFjZjM3ZGZmMmQxNmI2MzI1M2RlYjZiMTM1MmY0
10
+ YjdlMTkwN2QyYmU2MTE5ZmZlZjZhN2I2OWZlZjA5MmY2N2NjZGM0ZmNlMmM0
11
+ ZjI2ODJjZTM5YWM5MjRlOWYxZDkxZDVlZjlkMTk5ZmExMTVjZWY=
12
12
  data.tar.gz: !binary |-
13
- OTIzZTZlYzI5OWM0MjVmNGQ2MDFmMjRlMWQwZTgwZDNlMGZjNTA0YzkxNWMy
14
- NzIxOTJmYTk2YjE4Y2NlNTE1MGZkMzZmZDlmYTJhZWIyZWIzNjMwMDMzZjE2
15
- MmM4NTA1OTZiNzRhODgzNmNlODc3YWNhM2M5M2Q3ZTRmMmYzY2M=
13
+ MWU1NWUzOTJjMWFkMjlkYzYxZWY4Njc2Y2FkNGM1MWYzZDIzZTk1MjNjNDMy
14
+ YmU1ZTIzYTZjYzIyNjA4OThiNWVlMjJjZGViNmNhMDlhYzg2YjI2NzFjZWVj
15
+ OTU3MDg0ZDJlZGJmY2YzOTM2Nzk3NjEyOTZjNDkyZGNlMjVlODY=
data/README.md CHANGED
@@ -810,6 +810,14 @@ A branch name:
810
810
  $ travis logs ghe
811
811
  displaying logs for travis-ci/travis.rb#270.1
812
812
 
813
+ You can delete the logs with the `--delete` flag, which optionally takes a reason as argument:
814
+
815
+ $ travis logs --delete
816
+ DANGER ZONE: Do you really want to delete the build log for travis-ci/travis.rb#559.1? |no| yes
817
+ deleting log for travis-ci/travis.rb#559.1
818
+
819
+ $ travis logs 1.7 --delete "contained confidential data" --force
820
+ deleting log for travis-ci/travis.rb#1.7
813
821
 
814
822
  #### `open`
815
823
 
@@ -1646,6 +1654,8 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
1646
1654
  **1.6.15** (not yet released)
1647
1655
 
1648
1656
  * Add `travis setup ghc`.
1657
+ * Add `Log#delete_body`, `Job#delete_log` and `Build#delete_logs` to Ruby API.
1658
+ * Add `--delete`, `--force` and `--no-stream` options to `travis logs`.
1649
1659
 
1650
1660
  **1.6.14** (June 17, 2014)
1651
1661
 
@@ -5,7 +5,11 @@ require 'travis/tools/system'
5
5
  module Travis
6
6
  module CLI
7
7
  class Logs < RepoCommand
8
+ attr_accessor :delete, :reason
8
9
  description "streams test logs"
10
+ on('-d', '--delete [REASON]', 'remove logs') { |c, reason| c.delete, c.reason = true, reason }
11
+ on('-f', '--force', 'do not ask user to confirm deleting the logs')
12
+ on('--[no-]stream', 'only print current logs, do not stream')
9
13
 
10
14
  def setup
11
15
  super
@@ -14,9 +18,29 @@ module Travis
14
18
 
15
19
  include Tools::SafeString
16
20
  def run(number = last_build.number)
21
+ self.stream = true if stream.nil?
17
22
  job ||= job(number) || error("no such job ##{number}")
23
+ delete ? delete_log(job) : display_log(job)
24
+ end
25
+
26
+ def delete_log(job)
27
+ unless force?
28
+ error "not deleting logs without --force" unless interactive?
29
+ error "aborted" unless danger_zone? "Do you really want to delete the build log for #{color(job.inspect_info, :underline)}?"
30
+ end
31
+
32
+ warn "deleting log for #{color(job.inspect_info, [:bold, :info])}"
33
+ job.delete_log(reason || {})
34
+ end
35
+
36
+ def display_log(job)
18
37
  info "displaying logs for #{color(job.inspect_info, [:bold, :info])}"
19
- job.log.body { |part| print interactive? ? encoded(part) : clean(part) }
38
+ return print_log(job.log.body) unless stream?
39
+ job.log.body { |part| print_log(part) }
40
+ end
41
+
42
+ def print_log(part)
43
+ print interactive? ? encoded(part) : clean(part)
20
44
  end
21
45
 
22
46
  private
@@ -29,7 +53,7 @@ module Travis
29
53
  end
30
54
 
31
55
  def check_websocket
32
- require 'websocket-native'
56
+ require 'websocket-native' if stream?
33
57
  rescue LoadError => e
34
58
  raise e if e.respond_to?(:path) and e.path != 'websocket-native'
35
59
  info "speed up log streaming by installing the websocket-native gem"
@@ -14,7 +14,7 @@ module Travis
14
14
  has :job
15
15
 
16
16
  def delete_body(reason = {})
17
- reason = { reason: reason } unless reason.is_a? Hash
17
+ reason = { :reason => reason } unless reason.is_a? Hash
18
18
  session.patch_raw("jobs/#{job_id}/log", reason)
19
19
  reload
20
20
  rescue Travis::Client::Error => error
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.6.15.travis.559.6
4
+ version: 1.6.15.travis.560.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase