Permalink
Browse files

remove the nokogiri dep

  • Loading branch information...
1 parent 44af15d commit f0451912bafc40d9832eb15ce5f2e7d6bed73bea @jcran jcran committed Apr 11, 2012
Showing with 11 additions and 11 deletions.
  1. +0 −3 lab.gemspec
  2. +11 −8 lib/lab/driver/virtualbox_driver.rb
View
@@ -23,9 +23,6 @@ Gem::Specification.new do |s|
## Dependencies
##
- # necessary??
- s.add_runtime_dependency "nokogiri"
-
# Fallback execute / copy in the drivers
s.add_runtime_dependency "net-ssh"
s.add_runtime_dependency "net-scp"
@@ -1,5 +1,8 @@
require 'vm_driver'
-require 'nokogiri'
+require 'rexml/document'
+
+include REXML
+
##
## $Id$
@@ -38,16 +41,16 @@ def initialize(config)
def register_and_return_vmid
- xml = Nokogiri::XML(File.new(@location))
- vmid = xml.root.xpath("//Machine[@name]")
+ vmid = nil
+ doc = Document.new(File.open(@location).read)
+ doc.elements.each("//Machine"){|x| vmid = x.attributes['name'] }
- ## only register if we don't already know the vmid
- if !::Lab::Controllers::VirtualBoxController::config_list.include? vmid
- system_command("VBoxManage registervm \"#{@location}\"")
- end
+ #
+ # only register if we don't already know the vmid
+ #
+ system_command("VBoxManage registervm \"#{@location}\"") unless ::Lab::Controllers::VirtualBoxController::config_list.include? vmid
return vmid
-
end
def unregister

0 comments on commit f045191

Please sign in to comment.