Module: Travis::CLI

Extended by:
CLI
Included in:
CLI
Defined in:
lib/travis/cli.rb,
lib/travis/cli/raw.rb,
lib/travis/cli/help.rb,
lib/travis/cli/logs.rb,
lib/travis/cli/open.rb,
lib/travis/cli/show.rb,
lib/travis/cli/sync.rb,
lib/travis/cli/login.rb,
lib/travis/cli/token.rb,
lib/travis/cli/enable.rb,
lib/travis/cli/parser.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/restart.rb,
lib/travis/cli/version.rb,
lib/travis/cli/whatsup.rb,
lib/travis/cli/endpoint.rb,
lib/travis/cli/api_command.rb,
lib/travis/cli/repo_command.rb

Defined Under Namespace

Modules: Parser Classes: ApiCommand, Command, Console, Disable, Enable, Encrypt, Endpoint, Help, History, Login, Logs, Open, Raw, RepoCommand, Restart, Show, Status, Sync, Token, Version, Whatsup, Whoami

Instance Method Summary collapse

Instance Method Details

#command(name) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/travis/cli.rb', line 55

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

#commandsObject



66
67
68
# File 'lib/travis/cli.rb', line 66

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

#run(*args) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/travis/cli.rb', line 47

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

#windows?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/travis/cli.rb', line 43

def windows?
  File::ALT_SEPARATOR == "\\"
end