Class: Travis::CLI::Logs
- Inherits:
-
RepoCommand
- Object
- Command
- ApiCommand
- RepoCommand
- Travis::CLI::Logs
- Includes:
- Tools::SafeString
- Defined in:
- lib/travis/cli/logs.rb
Constant Summary
Constants inherited from RepoCommand
RepoCommand::GIT_REGEX, RepoCommand::TRAVIS
Constants inherited from Command
Command::DAY, Command::HOUR, Command::MINUTE, Command::WEEK
Constants included from Tools::Assets
Instance Attribute Summary collapse
-
#delete ⇒ Object
Returns the value of attribute delete.
-
#reason ⇒ Object
Returns the value of attribute reason.
Attributes inherited from RepoCommand
Attributes inherited from ApiCommand
Attributes inherited from Command
#arguments, #config, #debug, #force_interactive, #formatter, #input, #output
Instance Method Summary collapse
- #delete_log(job) ⇒ Object
- #display_log(job) ⇒ Object
- #print_log(part) ⇒ Object
- #run(number = last_build.number) ⇒ Object
- #setup ⇒ Object
Methods included from Tools::SafeString
Methods inherited from RepoCommand
Methods inherited from ApiCommand
#authenticate, #detected_endpoint?, #endpoint_config, #enterprise?, #initialize, #org?, #pro?, #sync
Methods included from Travis::Client::Methods
#access_token, #access_token=, #account, #accounts, #api_endpoint, #api_endpoint=, #artifact, #broadcasts, #build, #cancel, #explicit_api_endpoint?, #github_auth, #hooks, #lint, #listen, #repo, #repos, #restart, #user
Methods inherited from Command
abstract, abstract?, #check_completion, #check_ruby, #check_version, command_name, #command_name, #debug?, description, #execute, #help, #info, #initialize, #last_check, #on_signal, #parse, #say, skip, subcommands, #terminal, #time, #usage, #usage_for, #write_to
Methods included from Tools::Assets
Methods included from Parser
Constructor Details
This class inherits a constructor from Travis::CLI::ApiCommand
Instance Attribute Details
#delete ⇒ Object
Returns the value of attribute delete.
8 9 10 |
# File 'lib/travis/cli/logs.rb', line 8 def delete @delete end |
#reason ⇒ Object
Returns the value of attribute reason.
8 9 10 |
# File 'lib/travis/cli/logs.rb', line 8 def reason @reason end |
Instance Method Details
#delete_log(job) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/travis/cli/logs.rb', line 26 def delete_log(job) unless force? error "not deleting logs without --force" unless interactive? error "aborted" unless danger_zone? "Do you really want to delete the build log for #{color(job.inspect_info, :underline)}?" end warn "deleting log for #{color(job.inspect_info, [:bold, :info])}" job.delete_log(reason || {}) end |
#display_log(job) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/travis/cli/logs.rb', line 36 def display_log(job) info "displaying logs for #{color(job.inspect_info, [:bold, :info])}" return print_log(job.log.body) unless stream? job.log.body { |part| print_log(part) } ensure print "\e[0m" if interactive? end |
#print_log(part) ⇒ Object
44 45 46 |
# File 'lib/travis/cli/logs.rb', line 44 def print_log(part) print interactive? ? encoded(part) : clean(part) end |
#run(number = last_build.number) ⇒ Object
20 21 22 23 24 |
# File 'lib/travis/cli/logs.rb', line 20 def run(number = last_build.number) self.stream = true if stream.nil? job ||= job(number) || error("no such job ##{number}") delete ? delete_log(job) : display_log(job) end |
#setup ⇒ Object
14 15 16 17 |
# File 'lib/travis/cli/logs.rb', line 14 def setup super check_websocket end |