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.15.travis.559.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.558.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.557.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.556.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.555.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.554.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.552.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.551.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.550.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.547.6 lib/travis/cli/logs.rb
travis-1.6.15.travis.544.6 lib/travis/cli/logs.rb
travis-1.6.14.travis.543.6 lib/travis/cli/logs.rb
travis-1.6.14 lib/travis/cli/logs.rb
travis-1.6.14.travis.539.6 lib/travis/cli/logs.rb
travis-1.6.13.travis.538.6 lib/travis/cli/logs.rb
travis-1.6.13 lib/travis/cli/logs.rb
travis-1.6.13.travis.536.6 lib/travis/cli/logs.rb
travis-1.6.12 lib/travis/cli/logs.rb
travis-1.6.13.travis.534.6 lib/travis/cli/logs.rb
travis-1.6.12.travis.531.6 lib/travis/cli/logs.rb