57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/tupperware.rb', line 57
def package
cls = check_driver
instance = nil
if cls == VagrantVirtualBox
if @options[:instance]
@kitchen_config.instances.each do |i|
if i.name.to_s == @options[:instance]
instance = i
break
end
end
unless instance
puts "#{@options[:instance]} is not a valid kitchen instance"
exit 1
end
instance_name = instance.name.to_s
puts "\n*** Converging #{instance_name} ***\n"
instance.converge
packager = VagrantVirtualBox.new(@options, @kitchen_config)
packager.provision_local_box(instance)
packager.halt(instance_name)
packager.package(instance_name)
instance.destroy
else
packager = VagrantVirtualBox.new(@options, @kitchen_config)
packager.kitchen_config.instances.each do |i|
instance_name = i.name.to_s
puts "\n*** Converging #{i.name.to_s} ***\n"
i.converge
packager.provision_local_box(i)
packager.halt(i.name.to_s)
packager.package(i.name.to_s)
i.destroy
end
done = <<-DONE
Your vagrant box file is named #{instance_name}.box. Import it by
running:
vagrant box add --name NAME #{instance_name}.box
Run the following command for more information on importing vagrant
boxes:
vagrant box add -h
DONE
puts done
end
end
end
|