Class: Front::CLI::Controller
- Inherits:
-
Object
- Object
- Front::CLI::Controller
show all
- Includes:
- Loader
- Defined in:
- lib/front/cli/controller.rb
Constant Summary
Constants included
from Loader
Loader::LIB_DIR, Loader::ROOT_DIR
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Controller
Returns a new instance of Controller.
12
13
14
15
|
# File 'lib/front/cli/controller.rb', line 12
def initialize(options)
@options = options
@pool = VagrantPool.new(options.pool_size)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
67
68
69
|
# File 'lib/front/cli/controller.rb', line 67
def method_missing(method)
show_error "Unknown action: #{method}"
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10
11
12
|
# File 'lib/front/cli/controller.rb', line 10
def options
@options
end
|
Instance Method Details
#create ⇒ Object
18
19
20
21
|
# File 'lib/front/cli/controller.rb', line 18
def create
@pool.create
@pool.load
end
|
#destroy ⇒ Object
23
24
25
|
# File 'lib/front/cli/controller.rb', line 23
def destroy
@pool.unload
end
|
#inventory ⇒ Object
39
40
41
|
# File 'lib/front/cli/controller.rb', line 39
def inventory
puts File.read(@pool.get_inventory_file())
end
|
#next ⇒ Object
27
28
29
|
# File 'lib/front/cli/controller.rb', line 27
def next
@pool.next
end
|
#show_error(msg = @options.error) ⇒ Object
60
61
62
63
64
65
|
# File 'lib/front/cli/controller.rb', line 60
def show_error(msg = @options.error)
puts "Error: #{msg}"
puts
show_help
end
|
#show_help ⇒ Object
72
73
74
|
# File 'lib/front/cli/controller.rb', line 72
def show_help
puts @options.opts
end
|
#show_invalid_option ⇒ Object
48
49
50
|
# File 'lib/front/cli/controller.rb', line 48
def show_invalid_option
show_error @options.error
end
|
#show_missing_args ⇒ Object
52
53
54
|
# File 'lib/front/cli/controller.rb', line 52
def show_missing_args
show_error @options.error
end
|
#show_parser_error ⇒ Object
56
57
58
|
# File 'lib/front/cli/controller.rb', line 56
def show_parser_error
show_error @options.error
end
|
#show_version ⇒ Object
76
77
78
|
# File 'lib/front/cli/controller.rb', line 76
def show_version
puts VERSION
end
|
#ssh ⇒ Object
31
32
33
|
# File 'lib/front/cli/controller.rb', line 31
def ssh
@pool.ssh
end
|
#ssh_config ⇒ Object
35
36
37
|
# File 'lib/front/cli/controller.rb', line 35
def ssh_config
puts @pool.ssh_config
end
|
#status ⇒ Object
43
44
45
|
# File 'lib/front/cli/controller.rb', line 43
def status
@pool.status
end
|