diff --git a/Rakefile b/Rakefile index ddd5e684..78a0e198 100644 --- a/Rakefile +++ b/Rakefile @@ -3,36 +3,8 @@ require 'bundler' require 'bundler/setup' Bundler::GemHelper.install_tasks -#We set this in the ENV file -#ENV['GEM_PATH']=File.join(File.dirname(__FILE__),"gems") -#ENV['GEM_HOME']=File.join(File.dirname(__FILE__),"gems") - -def check_environment - begin - require 'vagrant' - rescue LoadError - puts "you need to install dependencies:" - puts "gem install vagrant" - exit - end - - begin - require 'net/ssh' - require 'virtualbox' - require 'webrick' - require 'popen4' - rescue LoadError - puts "hmm you had vagrant installed but are missing the net-ssh or virtualbox gem" - puts "gem install virtualbox net-ssh POpen4" - exit - end -end - -#See if all gems and so are installed -check_environment - #Setup some base variables to use -veewee_dir= File.dirname(__FILE__) +veewee_dir= "." 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")) @@ -41,8 +13,6 @@ vbox_dir=File.expand_path(File.join(veewee_dir, "tmp")) tmp_dir=File.expand_path(File.join(veewee_dir, "tmp")) iso_dir=File.expand_path(File.join(veewee_dir, "iso")) -#needs to be moved to the config files to be allowed override -ENV['VBOX_USER_HOME']=vbox_dir #Load Veewee::Session libraries Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| diff --git a/TODO b/TODO deleted file mode 100644 index 2af3a256..00000000 --- a/TODO +++ /dev/null @@ -1 +0,0 @@ -Maybe use Bittorrent to download iso - http://rubytorrent.rubyforge.org/ diff --git a/bin/veewee b/bin/veewee index 6e2494d7..2b298467 100755 --- a/bin/veewee +++ b/bin/veewee @@ -68,7 +68,7 @@ class VeeweeCLI < Thor end version=VirtualBox.version -if (version.match(/^4.x/)) +if (version.match(/^4./)) VeeweeCLI.start else puts "veewee only supports VirtualBox 4.x" diff --git a/gems/.gitignore b/gems/.gitignore deleted file mode 100644 index d6b7ef32..00000000 --- a/gems/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/lib/veewee/command.rb b/lib/veewee/command.rb index 78334b19..5731cded 100644 --- a/lib/veewee/command.rb +++ b/lib/veewee/command.rb @@ -1,63 +1,64 @@ require 'veewee/session' +#Load Veewee::Session libraries +lib_dir= File.expand_path(File.join(File.dirname(__FILE__),"..","..", "lib")) +Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| require f } + #Setup some base variables to use -veewee_dir= File.expand_path(File.join(File.dirname(__FILE__),"..","..")) -definition_dir= File.expand_path(File.join(".", "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")) +template_dir=File.expand_path(File.join(lib_dir,"..", "templates")) -#vbox_dir=File.expand_path(File.join(veewee_dir, "tmp")) +veewee_dir="." +definition_dir= File.expand_path(File.join(veewee_dir, "definitions")) tmp_dir=File.expand_path(File.join(veewee_dir, "tmp")) - iso_dir=File.expand_path(File.join(veewee_dir, "iso")) - -#needs to be moved to the config files to be allowed override -#ENV['VBOX_USER_HOME']=vbox_dir - -#Load Veewee::Session libraries -Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| - require f } +box_dir=File.expand_path(File.join(veewee_dir, "boxes")) #Initialize Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir, :template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir}) +class BaseBoxCommand < Vagrant::Command::GroupBase + register "basebox","Commands to manage baseboxes" + + desc "templates", "List the currently available box templates" + def templates + Veewee::Session.list_templates + end + + desc "define BOXNAME TEMPLATE", "Define a new box starting from a template" + def define(boxname, template) + puts "define a new box #{boxname}, starting from template #{template}" + Veewee::Session.define(boxname,template) + end + + desc "build BOXNAME", "Build the box BOXNAME" + def build(boxname) + puts "Building box #{boxname}" + Veewee::Session.build(boxname) + end + + desc "ostypes", "List the available Operating System types" + def ostypes + puts "Operating System types:" + Veewee::Session.list_ostypes + end + + desc "clean", "Clean all unfinished builds" + def clean + puts "Cleaning all unfinished builds" + end + +end + + +class SayHelloCommand < Vagrant::Command::Base + register "hello", "Says hello then goodbye" + + def hello + puts "HELLO!" + end -module Vagrant - module Command - class BoxCommand < Vagrant::Command::GroupBase - # Do not register anymore, as this registration is already done in Vagrant core - # Since Ruby classes are 'open', we are just adding subcommands to the 'box' command - - desc "templates", "List the currently available box templates" - def templates - Veewee::Session.list_templates - end - - desc "init BOXNAME TEMPLATE", "Define a new box starting from a template" - def init(boxname, template) - puts "Init a new box #{boxname}, starting from template #{template}" - Veewee::Session.define(boxname,template) - end - - desc "build BOXNAME", "Build the box BOXNAME" - def build(boxname) - puts "Building box #{boxname}" - Veewee::Session.build(boxname) - end - - desc "ostypes", "List the available Operating System types" - def ostypes - puts "Operating System types:" - Veewee::Session.list_ostypes - end - - desc "clean", "Clean all unfinished builds" - def clean - puts "Cleaning all unfinished builds" - end - - end + def goodbye + puts "GOODBYE!" end end diff --git a/templates/ubuntu-10.10-server-i386/postinstall.sh b/templates/ubuntu-10.10-server-i386/postinstall.sh index 714aebdd..7b39aab5 100644 --- a/templates/ubuntu-10.10-server-i386/postinstall.sh +++ b/templates/ubuntu-10.10-server-i386/postinstall.sh @@ -36,7 +36,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version) cd /tmp wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt -sh /mnt/VBoxLinuxAdditions-x86.run +sh /mnt/VBoxLinuxAdditions.run umount /mnt rm VBoxGuestAdditions_$VBOX_VERSION.iso