incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r961989 - in /incubator/deltacloud/trunk/framework: app/controllers/ app/helpers/ config/ lib/ lib/drivers/
Date Thu, 08 Jul 2010 23:15:13 GMT
Author: lutter
Date: Thu Jul  8 23:15:13 2010
New Revision: 961989

URL: http://svn.apache.org/viewvc?rev=961989&view=rev
Log:
Make swapping drivers easier.

Added:
    incubator/deltacloud/trunk/framework/lib/drivers.rb
Modified:
    incubator/deltacloud/trunk/framework/app/controllers/images_controller.rb
    incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
    incubator/deltacloud/trunk/framework/app/controllers/storage_snapshots_controller.rb
    incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb
    incubator/deltacloud/trunk/framework/app/helpers/driver_helper.rb
    incubator/deltacloud/trunk/framework/config/environment.rb
    incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb

Modified: incubator/deltacloud/trunk/framework/app/controllers/images_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/images_controller.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/images_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/images_controller.rb Thu Jul  8 23:15:13
2010
@@ -1,7 +1,3 @@
-#load 'representations/xml'
-load 'drivers/ec2.rb'
-#require 'right_aws'
-
 class ImagesController < ApplicationController
 
   include DriverHelper

Modified: incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb Thu Jul 
8 23:15:13 2010
@@ -1,8 +1,3 @@
-
-load 'drivers/ec2.rb'
-
-require 'ostruct'
-
 class InstancesController < ApplicationController
 
   include DriverHelper

Modified: incubator/deltacloud/trunk/framework/app/controllers/storage_snapshots_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/storage_snapshots_controller.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/storage_snapshots_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/storage_snapshots_controller.rb Thu
Jul  8 23:15:13 2010
@@ -1,5 +1,3 @@
-load 'drivers/ec2.rb'
-
 class StorageSnapshotsController < ApplicationController
 
   include DriverHelper

Modified: incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb Thu
Jul  8 23:15:13 2010
@@ -1,5 +1,3 @@
-load 'drivers/ec2.rb'
-
 class StorageVolumesController < ApplicationController
 
   include DriverHelper

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=961989&r1=961988&r2=961989&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:15:13
2010
@@ -2,7 +2,8 @@
 module DriverHelper
 
   def driver
-    @driver ||= Drivers::EC2.new
+    load "drivers/#{DRIVER}.rb"
+    @driver ||= eval( "Drivers::" + DRIVER.to_s.camelcase ).new
   end
 
   def catch_auth

Modified: incubator/deltacloud/trunk/framework/config/environment.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/config/environment.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/config/environment.rb (original)
+++ incubator/deltacloud/trunk/framework/config/environment.rb Thu Jul  8 23:15:13 2010
@@ -49,3 +49,5 @@ Rails::Initializer.run do |config|
   # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
   # config.i18n.default_locale = :de
 end
+
+DRIVER = :ec2

Added: incubator/deltacloud/trunk/framework/lib/drivers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/drivers.rb?rev=961989&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/drivers.rb (added)
+++ incubator/deltacloud/trunk/framework/lib/drivers.rb Thu Jul  8 23:15:13 2010
@@ -0,0 +1,7 @@
+
+module Drivers
+
+  class AuthException < Exception
+  end
+
+end

Modified: incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb?rev=961989&r1=961988&r2=961989&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/drivers/ec2.rb Thu Jul  8 23:15:13 2010
@@ -1,10 +1,9 @@
 
-module Drivers
+require 'drivers'
 
-  class AuthException < Exception
-  end
+module Drivers
 
-  class EC2
+  class Ec2
 
     def safely(&block) 
       begin



Mime
View raw message