Class: Veewee::Command::Vbox
Instance Attribute Summary
Attributes inherited from GroupBase
#env
Instance Method Summary
collapse
Methods inherited from GroupBase
#initialize, register
Methods included from Helpers
#initialize_environment
Instance Method Details
#build(box_name) ⇒ Object
15
16
17
18
19
|
# File 'lib/veewee/command/vbox.rb', line 15
def build(box_name)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).build(options)
end
|
#copy(box_name, src, dst) ⇒ Object
68
69
70
71
72
|
# File 'lib/veewee/command/vbox.rb', line 68
def copy(box_name,src,dst)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).copy_to_box(src,dst)
end
|
#define(definition_name, template_name) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/veewee/command/vbox.rb', line 78
def define(definition_name, template_name)
begin
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.definitions.define(definition_name,template_name,options)
env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
env.ui.info "veewee vbox build '#{definition_name}'"
rescue Error => ex
env.ui.error("#{ex}",:prefix => false)
exit -1
end
end
|
#destroy(box_name) ⇒ Object
25
26
27
28
29
|
# File 'lib/veewee/command/vbox.rb', line 25
def destroy(box_name)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).destroy(options)
end
|
#halt(box_name) ⇒ Object
34
35
36
37
38
|
# File 'lib/veewee/command/vbox.rb', line 34
def halt(box_name)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).halt(options)
end
|
#list ⇒ Object
130
131
132
133
134
135
136
137
|
# File 'lib/veewee/command/vbox.rb', line 130
def list
env.ui.info "The following local definitions are available:",:prefix => false
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.definitions.each do |name,definition|
env.ui.info "- #{name}",:prefix => false
end
end
|
#ostypes ⇒ Object
109
110
111
112
113
114
115
|
# File 'lib/veewee/command/vbox.rb', line 109
def ostypes
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.ostypes.each do |name|
env.ui.info "- #{name}"
end
end
|
#screenshot(box_name, pngfilename) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/veewee/command/vbox.rb', line 155
def screenshot(box_name,pngfilename)
begin
venv=Veewee::Environment.new(options)
venv.ui = ::Veewee::UI::Shell.new(venv, shell)
venv.providers["virtualbox"].get_box(box_name).screenshot(pngfilename,options)
rescue Veewee::Error => ex
venv.ui.error(ex, :prefix => false)
exit -1
end
end
|
#ssh(box_name, command = nil) ⇒ Object
51
52
53
54
55
|
# File 'lib/veewee/command/vbox.rb', line 51
def ssh(box_name,command=nil)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).issh(command)
end
|
#templates ⇒ Object
119
120
121
122
123
124
125
126
|
# File 'lib/veewee/command/vbox.rb', line 119
def templates
env.ui.info "The following templates are available:",:prefix => false
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.templates.each do |name,template|
env.ui.info "veewee vbox define '<box_name>' '#{name}'",:prefix => false
end
end
|
#undefine(definition_name) ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/veewee/command/vbox.rb', line 94
def undefine(definition_name)
env.ui.info "Removing definition #{definition_name}", :prefix => false
begin
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.definitions.undefine(definition_name,options)
env.ui.info "Definition #{definition_name} successfully removed" , :prefix => false
rescue Error => ex
env.ui.error("#{ex}",:prefix => false)
exit -1
end
end
|
#up(box_name) ⇒ Object
43
44
45
46
47
|
# File 'lib/veewee/command/vbox.rb', line 43
def up(box_name)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).up(options)
end
|
#validate(box_name) ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/veewee/command/vbox.rb', line 142
def validate(box_name)
begin
venv=Veewee::Environment.new(options)
venv.ui = ::Veewee::UI::Shell.new(venv, shell)
venv.providers["virtualbox"].get_box(box_name).validate_vagrant(options)
rescue Veewee::Error => ex
venv.ui.error(ex, :prefix => false)
exit -1
end
end
|
#winrm(box_name, command = nil) ⇒ Object
60
61
62
63
64
|
# File 'lib/veewee/command/vbox.rb', line 60
def winrm(box_name,command=nil)
venv=Veewee::Environment.new(options)
venv.ui=env.ui
venv.providers["virtualbox"].get_box(box_name).winrm(command,{:exitcode => "*"})
end
|