Class: Dip::CLI
- Inherits:
-
Thor
show all
- Defined in:
- lib/dip/cli.rb,
lib/dip/cli/dns.rb,
lib/dip/cli/ssh.rb,
lib/dip/cli/base.rb,
lib/dip/cli/infra.rb,
lib/dip/cli/console.rb
Defined Under Namespace
Classes: Base, Console, DNS, Infra, SSH
Constant Summary
collapse
- TOP_LEVEL_COMMANDS =
%w[help version ls compose up stop down run provision ssh infra console].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
18
19
20
|
# File 'lib/dip/cli.rb', line 18
def exit_on_failure?
true
end
|
.is_thor_reserved_word?(word, type) ⇒ Boolean
Hackery. Take the run method away from Thor so that we can redefine it.
12
13
14
15
16
|
# File 'lib/dip/cli.rb', line 12
def is_thor_reserved_word?(word, type)
return false if word == "run"
super
end
|
Instance Method Details
#build(*argv) ⇒ Object
57
58
59
|
# File 'lib/dip/cli.rb', line 57
def build(*argv)
compose("build", *argv)
end
|
#compose(*argv) ⇒ Object
51
52
53
54
|
# File 'lib/dip/cli.rb', line 51
def compose(*argv)
require_relative "commands/compose"
Dip::Commands::Compose.new(*argv).execute
end
|
#down(*argv) ⇒ Object
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/dip/cli.rb', line 74
def down(*argv)
if options[:help]
invoke :help, ["down"]
elsif options[:all]
require_relative "commands/down_all"
Dip::Commands::DownAll.new.execute
else
compose("down", *argv.push("--remove-orphans"))
end
end
|
#ktl(*argv) ⇒ Object
86
87
88
89
|
# File 'lib/dip/cli.rb', line 86
def ktl(*argv)
require_relative "commands/kubectl"
Dip::Commands::Kubectl.new(*argv).execute
end
|
#ls ⇒ Object
45
46
47
48
|
# File 'lib/dip/cli.rb', line 45
def ls
require_relative "commands/list"
Dip::Commands::List.new.execute
end
|
#provision ⇒ Object
111
112
113
114
115
116
117
118
|
# File 'lib/dip/cli.rb', line 111
def provision
if options[:help]
invoke :help, ["provision"]
else
require_relative "commands/provision"
Dip::Commands::Provision.new.execute
end
end
|
#run(*argv) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/dip/cli.rb', line 95
def run(*argv)
if argv.empty? || options[:help]
invoke :help, ["run"]
else
require_relative "commands/run"
Dip::Commands::Run.new(
*argv,
**options.to_h.transform_keys!(&:to_sym)
).execute
end
end
|
#stop(*argv) ⇒ Object
67
68
69
|
# File 'lib/dip/cli.rb', line 67
def stop(*argv)
compose("stop", *argv)
end
|
#up(*argv) ⇒ Object
62
63
64
|
# File 'lib/dip/cli.rb', line 62
def up(*argv)
compose("up", *argv)
end
|
#version ⇒ Object
38
39
40
41
|
# File 'lib/dip/cli.rb', line 38
def version
require_relative "version"
puts Dip::VERSION
end
|