Module: Buildkite::Builder::Commands
- Defined in:
- lib/buildkite/builder/commands.rb,
lib/buildkite/builder/commands/run.rb,
lib/buildkite/builder/commands/preview.rb,
lib/buildkite/builder/commands/abstract.rb
Defined Under Namespace
Classes: Abstract, Preview, Run
Constant Summary
collapse
- COMMANDS =
{
'preview' => :Preview,
'run' => :Run
}.freeze
Class Method Summary
collapse
Class Method Details
.print_help ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/buildkite/builder/commands.rb', line 30
def self.print_help
puts <<~HELP
#{'SYNOPSIS'.bright}
\t#{'buildkite-builder'.bright} COMMAND [OPTIONS] [PIPELINE]
\t#{'To see available options for specific commands:'.color(:dimgray)}
\t#{'buildkite-builder'.bright} COMMAND --help
#{'COMMANDS'.bright}
HELP
COMMANDS.each do |command, klass|
puts <<~HELP
\t#{command.bright}
\t#{const_get(klass).description.color(:dimgray)}\n
HELP
end
end
|
.run ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/buildkite/builder/commands.rb', line 17
def self.run
if ARGV.empty? || ARGV.first == '--help'
return print_help
end
command = ARGV.shift
unless (command_class = COMMANDS[command])
raise "Invalid command: #{command}"
end
const_get(command_class).execute
end
|