lib/travis/cli/requests.rb in travis-1.11.1 vs lib/travis/cli/requests.rb in travis-1.12.0
- old
+ new
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
require 'travis/cli'
module Travis
module CLI
class Requests < RepoCommand
- description "lists recent requests"
+ description 'lists recent requests'
on '-l', '--limit LIMIT', 'Maximum number requests to display'
def run
requests = repository.requests
requests = requests[0, Integer(limit)] if limit
@@ -14,31 +16,30 @@
style ||= :error if request.rejected?
style ||= :info
case request.event_type
when 'push'
- result = request.result || "received"
+ result = request.result || 'received'
message = request.message
- message ||= "validation pending" unless request.rejected? or request.accepted?
- message ||= "unknown reason" unless request.accepted?
- message ||= "triggered new build" unless request.rejected?
- description = "push to #{request.branch || request.tag || "???"}"
+ message ||= 'validation pending' unless request.rejected? || request.accepted?
+ message ||= 'unknown reason' unless request.accepted?
+ message ||= 'triggered new build' unless request.rejected?
+ description = "push to #{request.branch || request.tag || '???'}"
when 'pull_request'
- result = request.result || "received"
+ result = request.result || 'received'
message = request.message
- message ||= "HEAD commit not updated" unless request.accepted?
- message ||= "triggered new build" unless request.rejected?
- description = "push to #{request.branch || request.tag || "???"}"
+ message ||= 'HEAD commit not updated' unless request.accepted?
+ message ||= 'triggered new build' unless request.rejected?
description = "PR ##{request.pull_request_number}"
end
say [
color(description, [:bold, style]),
color(result, style),
color("(#{message})", style)
- ].join(" ").strip + "\n"
+ ].join(' ').strip + "\n"
- say " " + color(request.commit.short_sha, :bold) + " - " + request.commit.subject if request.commit
+ say " #{color(request.commit.short_sha, :bold)} - #{request.commit.subject}" if request.commit
say " received at: #{formatter.time(request.created_at)}"
empty_line
end
end
end