Sha256: e82afc3f9350cd21e2fd957aa067f5343ea6b5b4e9a976289da8d393bfbe7578

Contents?: true

Size: 1.07 KB

Versions: 129

Compression:

Stored size: 1.07 KB

Contents

require 'travis/cli'
require 'travis/tools/safe_string'
require 'travis/tools/system'

module Travis
  module CLI
    class Logs < RepoCommand
      description "streams test logs"

      def setup
        super
        check_websocket
      end

      include Tools::SafeString
      def run(number = last_build.number)
        job ||= job(number) || error("no such job ##{number}")
        info "displaying logs for #{color(job.inspect_info, [:bold, :info])}"
        job.log.body { |part| print interactive? ? encoded(part) : clean(part) }
      end

      private

        def job(number)
          number = last_build.number + number if number.start_with? '.'
          job    = super(number) || build(number) || branch(number)
          job    = job.jobs.first if job.respond_to? :jobs
          job
        end

        def check_websocket
          require 'websocket-native'
        rescue LoadError => e
          raise e if e.respond_to?(:path) and e.path != 'websocket-native'
          info "speed up log streaming by installing the websocket-native gem"
        end
    end
  end
end

Version data entries

129 entries across 129 versions & 1 rubygems

Version Path
travis-1.6.12.travis.529.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.528.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.524.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.523.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.521.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.520.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.517.6 lib/travis/cli/logs.rb
travis-1.6.11 lib/travis/cli/logs.rb
travis-1.6.11.travis.516.6 lib/travis/cli/logs.rb
travis-1.6.11.travis.511.6 lib/travis/cli/logs.rb
travis-1.6.11.travis.510.6 lib/travis/cli/logs.rb
travis-1.6.11.travis.507.6 lib/travis/cli/logs.rb
travis-1.6.11.travis.503.6 lib/travis/cli/logs.rb
travis-1.6.10 lib/travis/cli/logs.rb
travis-1.6.11.travis.502.6 lib/travis/cli/logs.rb
travis-1.6.9 lib/travis/cli/logs.rb
travis-1.6.9.travis.484.6 lib/travis/cli/logs.rb
travis-1.6.9.travis.483.6 lib/travis/cli/logs.rb
travis-1.6.9.travis.479.6 lib/travis/cli/logs.rb
travis-1.6.9.travis.463.6 lib/travis/cli/logs.rb