Class: Travis::CLI::Cache

Inherits:
RepoCommand show all
Defined in:
lib/travis/cli/cache.rb

Constant Summary

Constants inherited from RepoCommand

RepoCommand::GIT_REGEX, RepoCommand::TRAVIS

Constants inherited from Command

Travis::CLI::Command::DAY, Travis::CLI::Command::HOUR, Travis::CLI::Command::MINUTE, Travis::CLI::Command::WEEK

Constants included from Tools::Assets

Tools::Assets::BASE

Instance Attribute Summary

Attributes inherited from RepoCommand

#slug

Attributes inherited from ApiCommand

#enterprise_name, #session

Attributes inherited from Command

#arguments, #config, #debug, #force_interactive, #formatter, #input, #output

Instance Method Summary collapse

Methods inherited from RepoCommand

#repository, #setup

Methods inherited from ApiCommand

#authenticate, #detected_endpoint?, #endpoint_config, #enterprise?, #initialize, #org?, #pro?, #setup, #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, #job, #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, #setup, skip, subcommands, #terminal, #time, #usage, #usage_for, #write_to

Methods included from Tools::Assets

#asset, #asset_path

Methods included from Parser

#new, #on, #on_initialize

Constructor Details

This class inherits a constructor from Travis::CLI::ApiCommand

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/travis/cli/cache.rb', line 12

def run
  error "not allowed to access caches for #{color(repository.slug, :bold)}" unless repository.push?
  branches = caches.group_by(&:branch)
  check_caches

  warn "Deleted the following caches:\n" if delete?
  branches.each { |name, list| display_branch(name, list) }
  size = caches.inject(0) { |s,c| s + c.size }
  say "Overall size of above caches: " << formatter.file_size(size)
end