Sha256: 15ea003898bbc20167e68a4eed9a7dc8a977a3c3edaf371dd36ffb465e4e85e8
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'thor' require 'bundler' require 'virtualbox' require 'vbox' #Setup some base variables to use vbox_dir= File.expand_path(File.join(File.dirname(__FILE__),"..")) definition_dir= File.expand_path(File.join(".", "definitions")) lib_dir= File.expand_path(File.join(vbox_dir, "lib")) box_dir= File.expand_path(File.join(vbox_dir, "boxes")) template_dir=File.expand_path(File.join(vbox_dir, "templates")) tmp_dir=File.expand_path(File.join(vbox_dir, "tmp")) iso_dir=File.expand_path(File.join(vbox_dir, "iso")) #Load Vbox::Session libraries Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| require f } #Initialize Vbox::Session.setenv({ :vbox_dir => vbox_dir, :definition_dir => definition_dir, :template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir}) class VboxCLI < Thor desc "init [NAME] [TEMPLATE]", "initializes a vbox from a template" method_options :force => :boolean def init(boxname=nil, template=nil) if (boxname.nil?) puts "please provide a boxname" exit end puts "Init a new box #{boxname}, starting from template #{template}" Vbox::Session.define(boxname,template) end desc "templates", "list the template available" def templates Vbox::Session.list_templates end desc "build [NAME]", "build the box defined" method_options :force => :boolean def build(boxname) puts "Building box #{boxname}" Vbox::Session.build(boxname) end desc "export [NAME]", "export the box" method_options :force => :boolean def export(boxname) if (!boxname.nil?) Vbox::Session.export_box(boxname) end end end version=VirtualBox.version if (version.match(/^4./)) VboxCLI.start else puts "Vbox only supports VirtualBox 4.x" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vbox-0.0.4 | bin/vbox |