Module: Travis::CLI

Extended by:
CLI
Included in:
CLI
Defined in:
lib/travis/cli.rb,
lib/travis/cli/env.rb,
lib/travis/cli/raw.rb,
lib/travis/cli/help.rb,
lib/travis/cli/init.rb,
lib/travis/cli/lint.rb,
lib/travis/cli/logs.rb,
lib/travis/cli/open.rb,
lib/travis/cli/show.rb,
lib/travis/cli/sync.rb,
lib/travis/cli/cache.rb,
lib/travis/cli/login.rb,
lib/travis/cli/repos.rb,
lib/travis/cli/setup.rb,
lib/travis/cli/token.rb,
lib/travis/cli/cancel.rb,
lib/travis/cli/enable.rb,
lib/travis/cli/logout.rb,
lib/travis/cli/parser.rb,
lib/travis/cli/pubkey.rb,
lib/travis/cli/report.rb,
lib/travis/cli/sshkey.rb,
lib/travis/cli/status.rb,
lib/travis/cli/whoami.rb,
lib/travis/cli/command.rb,
lib/travis/cli/console.rb,
lib/travis/cli/disable.rb,
lib/travis/cli/encrypt.rb,
lib/travis/cli/history.rb,
lib/travis/cli/monitor.rb,
lib/travis/cli/restart.rb,
lib/travis/cli/version.rb,
lib/travis/cli/whatsup.rb,
lib/travis/cli/accounts.rb,
lib/travis/cli/branches.rb,
lib/travis/cli/endpoint.rb,
lib/travis/cli/requests.rb,
lib/travis/cli/settings.rb,
lib/travis/cli/setup/s3.rb,
lib/travis/cli/setup/gcs.rb,
lib/travis/cli/setup/npm.rb,
lib/travis/cli/setup/deis.rb,
lib/travis/cli/setup/pypi.rb,
lib/travis/cli/api_command.rb,
lib/travis/cli/encrypt_file.rb,
lib/travis/cli/repo_command.rb,
lib/travis/cli/setup/appfog.rb,
lib/travis/cli/setup/heroku.rb,
lib/travis/cli/setup/biicode.rb,
lib/travis/cli/setup/divshot.rb,
lib/travis/cli/setup/hackage.rb,
lib/travis/cli/setup/modulus.rb,
lib/travis/cli/setup/service.rb,
lib/travis/cli/setup/anynines.rb,
lib/travis/cli/setup/cloud_66.rb,
lib/travis/cli/setup/ninefold.rb,
lib/travis/cli/setup/opsworks.rb,
lib/travis/cli/setup/releases.rb,
lib/travis/cli/setup/artifacts.rb,
lib/travis/cli/setup/nodejitsu.rb,
lib/travis/cli/setup/ruby_gems.rb,
lib/travis/cli/setup/open_shift.rb,
lib/travis/cli/setup/cloud_files.rb,
lib/travis/cli/setup/code_deploy.rb,
lib/travis/cli/setup/engine_yard.rb,
lib/travis/cli/setup/cloud_control.rb,
lib/travis/cli/setup/cloud_foundry.rb,
lib/travis/cli/setup/sauce_connect.rb,
lib/travis/cli/setup/elastic_beanstalk.rb

Defined Under Namespace

Modules: Parser Classes: Accounts, ApiCommand, Branches, Cache, Cancel, Command, Console, Disable, Enable, Encrypt, EncryptFile, Endpoint, Env, Help, History, Init, Lint, Login, Logout, Logs, Monitor, Open, Pubkey, Raw, RepoCommand, Report, Repos, Requests, Restart, Settings, Setup, Show, Sshkey, Status, Sync, Token, Version, Whatsup, Whoami

Instance Method Summary collapse

Instance Method Details

#command(name) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/travis/cli.rb', line 67

def command(name)
  const_name = command_name(name)
  constant   = CLI.const_get(const_name) if const_name =~ /^[A-Z][A-Za-z]+$/ and const_defined? const_name
  if command? constant
    constant
  else
    $stderr.puts "unknown command #{name}"
    exit 1
  end
end

#commandsObject



78
79
80
# File 'lib/travis/cli.rb', line 78

def commands
  CLI.constants.map { |n| try_const_get(n) }.select { |c| command? c }
end

#run(*args) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/travis/cli.rb', line 59

def run(*args)
  args, opts = preparse(args)
  name       = args.shift unless args.empty?
  command    = command(name).new(opts)
  command.parse(args)
  command.execute
end

#silentObject



82
83
84
85
86
87
88
89
# File 'lib/travis/cli.rb', line 82

def silent
  stderr, $stderr = $stderr, dummy_io
  stdout, $stdout = $stdout, dummy_io
  yield
ensure
  $stderr = stderr if stderr
  $stdout = stdout if stdout
end