-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed the dependency on vagrant ostypes, and introduced a mapping f…
…ile between ostypes as defined in each virtualization type
- Loading branch information
Showing
12 changed files
with
338 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
begin | ||
require 'vagrant' | ||
require 'veewee/vagrant/command' | ||
require 'veewee/command/vagrant' | ||
rescue LoadError | ||
require 'rubygems' | ||
require 'veewee/vagrant/command' | ||
require 'veewee/command/vagrant' | ||
require 'veewee/command/kvm' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
require 'veewee' | ||
|
||
module Veewee | ||
module Vagrant | ||
class Command < ::Vagrant::Command::GroupBase | ||
|
||
register "basebox", "Commands to manage baseboxes" | ||
desc "build [TEMPLATE_NAME] [BOX_NAME]", "Build box" | ||
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "force the build" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
method_option :nogui,:type => :boolean , :default => false, :aliases => "-n", :desc => "no gui" | ||
method_option :auto,:type => :boolean , :default => false, :aliases => "-a", :desc => "auto answers" | ||
def build(definition_name,box_name=nil) | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
venv.config.builders["virtualbox"].build(definition_name,box_name,options) | ||
end | ||
|
||
desc "destroy [BOXNAME]", "Destroys the virtualmachine that was build" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def destroy(box_name) | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
venv.config.builders["virtualbox"].get_box(box_name).destroy | ||
end | ||
|
||
desc "define [BOXNAME] [TEMPLATE]", "Define a new basebox starting from a template" | ||
method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "overwrite the definition" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def define(definition_name, template_name) | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
|
||
venv.define(definition_name,template_name,options) | ||
env.ui "The basebox '#{definition_name}' has been succesfully created from the template '#{template_name}'" | ||
env.ui "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:" | ||
env.ui "vagrant basebox build '#{definition_name}'" | ||
end | ||
|
||
desc "undefine [BOXNAME]", "Removes the definition of a basebox " | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def undefine(definition_name) | ||
env.ui "Removing definition #{definition_name}" | ||
begin | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
venv.undefine(definition_name,options) | ||
env.ui "Definition #{definition_name} succesfully removed" | ||
rescue Error => ex | ||
env.ui "#{ex}" | ||
exit -1 | ||
end | ||
end | ||
|
||
desc "templates", "List the currently available templates" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def templates | ||
env.ui.info "The following templates are available:" | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
|
||
venv.get_template_paths.keys.each do |name| | ||
env.ui.info "vagrant basebox define '<box_name>' '#{name}'" | ||
end | ||
end | ||
|
||
desc "list", "Lists all defined boxes" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def list | ||
env.ui.info "The following local definitions are available:" | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
|
||
venv.get_definition_paths.keys.each do |name| | ||
env.ui.info "- #{name}" | ||
end | ||
end | ||
|
||
desc "ostypes", "List the available Operating System types" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def ostypes | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
venv.list_ostypes | ||
end | ||
|
||
desc "validate [NAME]", "Validates a box against vagrant compliancy rules" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def validate(box_name) | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
|
||
venv.config.builders["virtualbox"].validate_vagrant(box_name,options) | ||
end | ||
|
||
desc "export [NAME]", "Exports the basebox to the vagrant box format" | ||
method_option :debug,:type => :boolean , :default => false, :aliases => "-d", :desc => "enable debugging" | ||
def export(box_name) | ||
venv=Veewee::Environment.new(options) | ||
venv.ui=env.ui | ||
venv.config.builders["virtualbox"].export_vagrant(box_name,options) | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.