Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added export output

  • Loading branch information...
commit 2f88ab99537b0916493b65e855712577f36c052a 1 parent 4f684cb
@jedi4ever authored
View
14 Rakefile
@@ -29,6 +29,7 @@ check_environment
veewee_dir= File.dirname(__FILE__)
definition_dir= File.expand_path(File.join(veewee_dir, "definitions"))
lib_dir= File.expand_path(File.join(veewee_dir, "lib"))
+box_dir= File.expand_path(File.join(veewee_dir, "boxes"))
template_dir=File.expand_path(File.join(veewee_dir, "templates"))
vbox_dir=File.expand_path(File.join(veewee_dir, "tmp"))
iso_dir=File.expand_path(File.join(veewee_dir, "iso"))
@@ -39,7 +40,7 @@ Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f|
require f }
#Initialize
-Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir, :template_dir => template_dir, :iso_dir => iso_dir})
+Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir, :template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir})
desc 'Default: list templates'
task :default => [:templates]
@@ -86,6 +87,15 @@ task :boxes do
Veewee::Session.list_boxes
end
+desc 'Export box'
+task :export, [:boxname] do |t,args|
+ if args.to_hash.size!=1
+ puts "needs one arguments: rake export['boxname']"
+ exit
+ end
+ Veewee::Session.export_box(args.boxname)
+end
+
desc 'Remove box'
task :remove_box, [:boxname] do |t,args|
Veewee::Session.remove_box(args.boxname)
@@ -94,4 +104,4 @@ end
desc 'Clean all unfinished builds'
task :clean do
Veewee::Session.clean
-end
+end
View
9 lib/veewee/export.rb
@@ -3,12 +3,15 @@ class Export
# Shellutil.execute("vagrant package --base #{vmname} --include /tmp/Vagrantfile --output /tmp/#{vmname}.box", {:progress => "on"})
- def self.vagrant_box(boxname,boxdir)
+ def self.vagrant(boxname,boxdir)
+ box_path=File.join(boxdir,boxname+".box")
puts "To export the box you just created to vagrant, use the following commands:"
- puts "vagrant package --base '#{boxname}' --output #{boxname}.box'"
+ puts "vagrant package --base '#{boxname}' --output '#{box_path}'"
puts ""
puts "To import it into vagrant type:"
- puts "vagrant box add '#{boxname}' '#{boxname}.box'"
+ puts "vagrant box add '#{boxname}' '#{box_path}'"
+ puts ""
+ puts "To use it:"
puts "vagrant init '#{boxname}'"
puts "vagrant up"
puts "vagrant ssh"
View
7 lib/veewee/session.rb
@@ -102,6 +102,13 @@ def self.clean
puts "Not yet implemented"
end
+ def self.export_box(boxname)
+ #Now we have to load the definition (reads definition.rb)
+ load_definition(boxname)
+
+ Veewee::Export.vagrant(boxname,@box_dir)
+ end
+
def self.remove_box(boxname)
puts "Not yet implemented"
end
View
5 lib/veewee/web.rb
@@ -30,7 +30,10 @@ def self.wait_for_request(filename,options={:timeout => 10, :web_dir => "", :por
filename=filename
s= HTTPServer.new(:Port => options[:port])
s.mount("/#{filename}", FileServlet,File.join(web_dir,filename))
- trap("INT"){s.shutdown}
+ trap("INT"){
+ s.shutdown
+ exit
+ }
s.start
end
end
View
2  templates/ubuntu-10.04.1-server-i386/definition.rb
@@ -16,6 +16,8 @@
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "preseed.cfg",
:ssh_login_timeout => "10000",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "2222", :ssh_guest_port => "22",
+ :sudo_cmd="echo %p|sudo -S sh %f",
+ :shutdown_cmd="shutdown -H",
:postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
}
)
View
2  templates/ubuntu-10.10-server-i386/definition.rb
@@ -16,6 +16,8 @@
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "preseed.cfg",
:ssh_login_timeout => "10000",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "2222", :ssh_guest_port => "22",
+ :sudo_cmd="echo %p|sudo -S sh %f",
+ :shutdown_cmd="shutdown -H",
:postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
}
)
Please sign in to comment.
Something went wrong with that request. Please try again.