incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962309 - in /incubator/deltacloud/trunk/server/lib: deltacloud/drivers/ec2/ec2_driver.rb drivers.rb
Date Thu, 08 Jul 2010 23:45:17 GMT
Author: lutter
Date: Thu Jul  8 23:45:17 2010
New Revision: 962309

URL: http://svn.apache.org/viewvc?rev=962309&view=rev
Log:
Handled LoadError for drivers

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
    incubator/deltacloud/trunk/server/lib/drivers.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=962309&r1=962308&r2=962309&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Thu Jul  8
23:45:17 2010
@@ -17,12 +17,7 @@
 
 
 require 'deltacloud/base_driver'
-begin
-  require 'AWS'
-rescue LoadError
-  puts "ERROR: Please install Amazon-EC2 gem first. (gem install amazon-ec2)"
-  exit(1)
-end
+require 'AWS'
 
 module Deltacloud
   module Drivers

Modified: incubator/deltacloud/trunk/server/lib/drivers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/drivers.rb?rev=962309&r1=962308&r2=962309&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/drivers.rb Thu Jul  8 23:45:17 2010
@@ -27,7 +27,15 @@ def driver_mock_source_name
 end
 
 def driver
-  require driver_source_name
+
+  begin
+    require driver_source_name
+  rescue LoadError => e
+    gem_name = e.message.match(/ -- (.+)$/).to_a.last
+    gem_name = "amazon-ec2" if gem_name.eql?('AWS')
+    $stderr.puts "ERROR: Please install required gem first. (gem install #{gem_name})"
+    exit 1
+  end
 
   if Sinatra::Application.environment.eql? :test
     require driver_mock_source_name



Mime
View raw message