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/nginx.rb,
lib/dip/cli/console.rb
Defined Under Namespace
Classes: Console, DNS, Nginx, SSH
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(cmd, *args) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/dip/cli.rb', line 23
def method_missing(cmd, *args)
if Dip.config.interaction.key?(cmd.to_sym)
self.class.start(["run", cmd.to_s, *args])
else
super
end
end
|
Class Method Details
.is_thor_reserved_word?(word, type) ⇒ Boolean
Hackery. Take the run method away from Thor so that we can redefine it.
10
11
12
13
14
|
# File 'lib/dip/cli.rb', line 10
def is_thor_reserved_word?(word, type)
return false if word == "run"
super
end
|
.start(argv) ⇒ Object
16
17
18
|
# File 'lib/dip/cli.rb', line 16
def start(argv)
super Dip::RunVars.call(argv, ENV)
end
|
Instance Method Details
#compose(*argv) ⇒ Object
49
50
51
52
|
# File 'lib/dip/cli.rb', line 49
def compose(*argv)
require_relative 'commands/compose'
Dip::Commands::Compose.new(*argv).execute
end
|
#down(*argv) ⇒ Object
65
66
67
|
# File 'lib/dip/cli.rb', line 65
def down(*argv)
compose("down", *argv)
end
|
#ls ⇒ Object
43
44
45
46
|
# File 'lib/dip/cli.rb', line 43
def ls
require_relative 'commands/list'
Dip::Commands::List.new.execute
end
|
#provision ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/dip/cli.rb', line 78
def provision
if options[:help]
invoke :help, ['provision']
else
require_relative 'commands/provision'
Dip::Commands::Provision.new.execute
end
end
|
#respond_to_missing?(cmd) ⇒ Boolean
31
32
33
|
# File 'lib/dip/cli.rb', line 31
def respond_to_missing?(cmd)
Dip.config.interaction.key?(cmd.to_sym)
end
|
#run(*argv) ⇒ Object
70
71
72
73
|
# File 'lib/dip/cli.rb', line 70
def run(*argv)
require_relative 'commands/run'
Dip::Commands::Run.new(*argv).execute
end
|
#stop(*argv) ⇒ Object
60
61
62
|
# File 'lib/dip/cli.rb', line 60
def stop(*argv)
compose("stop", *argv)
end
|
#up(*argv) ⇒ Object
55
56
57
|
# File 'lib/dip/cli.rb', line 55
def up(*argv)
compose("up", *argv)
end
|
#version ⇒ Object
36
37
38
39
|
# File 'lib/dip/cli.rb', line 36
def version
require_relative 'version'
puts Dip::VERSION
end
|