deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [2/6] git commit: Core: Allow to pass :mock_initialize option when requiring frontend
Date Wed, 10 Apr 2013 19:38:18 GMT
Core: Allow to pass :mock_initialize option when requiring frontend

If you have Deltacloud::API as a middleware, the recent switch to
using initializers will broke your code, because the Mock driver
needs to be initialized first.

This option will make sure the 'mock_initialize' file is properly
required.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/fd4f40cc
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/fd4f40cc
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/fd4f40cc

Branch: refs/heads/master
Commit: fd4f40ccfb383b29832490dc6394d831c76e2418
Parents: 5a19b0d
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Apr 10 11:25:05 2013 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Wed Apr 10 21:31:36 2013 +0200

----------------------------------------------------------------------
 server/lib/deltacloud_rack.rb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fd4f40cc/server/lib/deltacloud_rack.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud_rack.rb b/server/lib/deltacloud_rack.rb
index dbf51fc..79e4db4 100644
--- a/server/lib/deltacloud_rack.rb
+++ b/server/lib/deltacloud_rack.rb
@@ -147,7 +147,12 @@ module Deltacloud
       @logger = logger
     end
 
-    def require!
+    # Require the Deltacloud API Rack middleware
+    #
+    # opts[:initialize] = true will require 'initialize.rb'
+    #
+    def require!(opts={})
+      require_relative './initializers/mock_initialize' if opts[:mock_initialize]
       Deltacloud.require_frontend!(@name)
     end
 


Mime
View raw message