Permalink
Browse files

Basic driver interface, the bare minimum for now.

  • Loading branch information...
1 parent 9e4d8ac commit 84d31617e6eccb23e5d6c6f508670ed409615170 @mitchellh mitchellh committed Dec 2, 2010
Showing with 55 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 .yardopts
  3. +7 −1 Gemfile
  4. +4 −0 Gemfile.lock
  5. +7 −0 Rakefile
  6. +11 −1 lib/virtuoso.rb
  7. +13 −0 lib/virtuoso/driver.rb
  8. +10 −0 lib/virtuoso/virtualbox.rb
View
@@ -2,3 +2,5 @@ pkg/*
*.gem
.bundle
test.rb
+.yardoc/
+doc/
View
@@ -0,0 +1 @@
+-m markdown
View
@@ -8,7 +8,13 @@ gem "virtuoso", :path => "."
gem "libvirt", :git => "git://github.com/mitchellh/libvirt-rb.git"
# Gems required for testing only.
-group :test do
+group :development do
gem "protest", "~> 0.4.0"
gem "mocha", "~> 0.9.8"
+
+ # Not JRuby, which doesn't like bluecloth
+ platforms :ruby, :mri do
+ gem "yard", "~> 0.6.1"
+ gem "bluecloth", "~> 2.0.9"
+ end
end
View
@@ -15,19 +15,23 @@ PATH
GEM
remote: http://rubygems.org/
specs:
+ bluecloth (2.0.9)
ffi (0.6.3)
rake (>= 0.8.7)
mocha (0.9.10)
rake
nokogiri (1.4.4)
protest (0.4.2)
rake (0.8.7)
+ yard (0.6.3)
PLATFORMS
ruby
DEPENDENCIES
+ bluecloth (~> 2.0.9)
libvirt!
mocha (~> 0.9.8)
protest (~> 0.4.0)
virtuoso!
+ yard (~> 0.6.1)
View
@@ -11,3 +11,10 @@ task :test do
files = ENV["TEST"] ? [ENV["TEST"]] : Dir["test/**/*_test.rb"]
files.each { |f| load f }
end
+
+begin
+ # Documentation task
+ require 'yard'
+ YARD::Rake::YardocTask.new
+rescue LoadError
+end
View
@@ -1,3 +1,13 @@
module Virtuoso
- # Your code goes here...
+ autoload :Driver, "virtuoso/driver"
+ autoload :VirtualBox, "virtuoso/virtualbox"
+
+ # Creates a new Virtuoso VM instance for the given hypervisor.
+ #
+ # @param [Symbol] hypervisor
+ # @return [Object]
+ def self.new(hypervisor)
+ mapping = { :virtualbox => :VirtualBox }
+ const_get(mapping[hypervisor]).new
+ end
end
View
@@ -0,0 +1,13 @@
+module Virtuoso
+ # Base class for a virtual machine driver. Every feature in this
+ # driver must be overloaded by the drivers in one way or another.
+ class Driver
+ # Specifies a main disk image to use as the primary boot disk
+ # for the VM.
+ attr_accessor :disk_image
+
+ # Creates the virtual machine based on the given options and
+ # starts it.
+ def create; end
+ end
+end
View
@@ -0,0 +1,10 @@
+module Virtuoso
+ # VirtualBox driver, allowing the control and management of
+ # VirtualBox virtual machines.
+ class VirtualBox < Driver
+ # Create the virtual machine based on the given options.
+ def create
+
+ end
+ end
+end

0 comments on commit 84d3161

Please sign in to comment.