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.2.travis.367.4 lib/travis/cli/logs.rb
travis-1.6.2.travis.366.4 lib/travis/cli/logs.rb
travis-1.6.2.travis.365.4 lib/travis/cli/logs.rb
travis-1.6.2.travis.364.4 lib/travis/cli/logs.rb
travis-1.6.1 lib/travis/cli/logs.rb
travis-1.6.1.travis.363.4 lib/travis/cli/logs.rb
travis-1.6.0 lib/travis/cli/logs.rb
travis-1.5.9.travis.362.4 lib/travis/cli/logs.rb
travis-1.5.9.travis.361.4 lib/travis/cli/logs.rb
travis-1.5.9.travis.360.4 lib/travis/cli/logs.rb
travis-1.5.9.travis.358.4 lib/travis/cli/logs.rb
travis-1.5.8 lib/travis/cli/logs.rb
travis-1.5.8.travis.356.4 lib/travis/cli/logs.rb
travis-1.5.7 lib/travis/cli/logs.rb
travis-1.5.7.travis.345.4 lib/travis/cli/logs.rb
travis-1.5.7.travis.341.4 lib/travis/cli/logs.rb
travis-1.5.7.travis.338.4 lib/travis/cli/logs.rb
travis-1.5.6 lib/travis/cli/logs.rb
travis-1.5.6.travis.337.4 lib/travis/cli/logs.rb
travis-1.5.6.travis.336.4 lib/travis/cli/logs.rb