You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:16:41 UTC
svn commit: r962009 - in /incubator/deltacloud/trunk/framework: app/helpers/
config/ lib/ lib/deltacloud/ lib/drivers/ mock/images/ mock/instances/
mock/storage_snapshots/ mock/storage_volumes/
Author: lutter
Date: Thu Jul 8 23:16:40 2010
New Revision: 962009
URL: http://svn.apache.org/viewvc?rev=962009&view=rev
Log:
Break drivers out of the framework
Added:
incubator/deltacloud/trunk/framework/lib/deltacloud/
incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb
- copied, changed from r962008, incubator/deltacloud/trunk/framework/lib/drivers.rb
Removed:
incubator/deltacloud/trunk/framework/lib/drivers.rb
incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb
incubator/deltacloud/trunk/framework/lib/drivers/mock.rb
incubator/deltacloud/trunk/framework/mock/images/.gitignore
incubator/deltacloud/trunk/framework/mock/images/img1.yml
incubator/deltacloud/trunk/framework/mock/images/img2.yml
incubator/deltacloud/trunk/framework/mock/images/img3.yml
incubator/deltacloud/trunk/framework/mock/instances/.gitignore
incubator/deltacloud/trunk/framework/mock/instances/inst1.yml
incubator/deltacloud/trunk/framework/mock/instances/inst2.yml
incubator/deltacloud/trunk/framework/mock/storage_snapshots/.gitignore
incubator/deltacloud/trunk/framework/mock/storage_volumes/.gitignore
Modified:
incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb
incubator/deltacloud/trunk/framework/config/environment.rb
Modified: incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb?rev=962009&r1=962008&r2=962009&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb (original)
+++ incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb Thu Jul 8 23:16:40 2010
@@ -2,14 +2,14 @@
module DriverHelper
def driver
- load "drivers/#{DRIVER}.rb"
- @driver ||= eval( "Drivers::" + DRIVER.to_s.camelcase ).new
+ load "#{DRIVER_CLASS_NAME.underscore}.rb"
+ @driver ||= eval( DRIVER_CLASS_NAME ).new
end
def catch_auth
begin
yield
- rescue Drivers::AuthException => e
+ rescue DeltaCloud::AuthException => e
authenticate_or_request_with_http_basic() do |n,p|
end
end
Modified: incubator/deltacloud/trunk/framework/config/environment.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/config/environment.rb?rev=962009&r1=962008&r2=962009&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/config/environment.rb (original)
+++ incubator/deltacloud/trunk/framework/config/environment.rb Thu Jul 8 23:16:40 2010
@@ -50,5 +50,16 @@ Rails::Initializer.run do |config|
# config.i18n.default_locale = :de
end
-#DRIVER = :ec2
-DRIVER = :mock
+
+DRIVER=:ec2
+
+DRIVER_ROOT = File.dirname( __FILE__ ) + "/../../deltacloud-driver-#{DRIVER}"
+$: << DRIVER_ROOT+'/lib'
+
+case DRIVER
+ when :mock
+ DRIVER_CLASS_NAME = "MockDriver"
+ when :ec2
+ DRIVER_CLASS_NAME = "Ec2Driver"
+end
+
Copied: incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb (from r962008, incubator/deltacloud/trunk/framework/lib/drivers.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb?p2=incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb&p1=incubator/deltacloud/trunk/framework/lib/drivers.rb&r1=962008&r2=962009&rev=962009&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb Thu Jul 8 23:16:40 2010
@@ -1,5 +1,5 @@
-module Drivers
+module DeltaCloud
class AuthException < Exception
end