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.7.travis.434.6 lib/travis/cli/logs.rb
travis-1.6.7.travis.431.6 lib/travis/cli/logs.rb
travis-1.6.7.travis.428.9 lib/travis/cli/logs.rb
travis-1.6.7.travis.427.9 lib/travis/cli/logs.rb
travis-1.6.7.travis.426.8 lib/travis/cli/logs.rb
travis-1.6.7.travis.425.8 lib/travis/cli/logs.rb
travis-1.6.7.travis.422.4 lib/travis/cli/logs.rb
travis-1.6.7.travis.420.4 lib/travis/cli/logs.rb
travis-1.6.6 lib/travis/cli/logs.rb
travis-1.6.6.travis.419.4 lib/travis/cli/logs.rb
travis-1.6.6.travis.417.4 lib/travis/cli/logs.rb
travis-1.6.5 lib/travis/cli/logs.rb
travis-1.6.4.travis.414.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.413.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.410.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.411.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.406.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.405.4 lib/travis/cli/logs.rb
travis-1.6.4.travis.395.4 lib/travis/cli/logs.rb
travis-1.6.3 lib/travis/cli/logs.rb