deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [7/7] git commit: Core: Removed unnecessary stuff from config.ru
Date Wed, 12 Sep 2012 07:35:37 GMT
Core: Removed unnecessary stuff from config.ru

* Thinks like :default_driver and :logger are same
  for all three frontends.


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

Branch: refs/heads/master
Commit: 796db3193f980db445f2c38dc8d054b501cbeca0
Parents: 6d1be0a
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Sep 6 14:15:23 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Sep 11 12:08:27 2012 +0200

----------------------------------------------------------------------
 server/config.ru              |   32 ++++++++++----------------------
 server/lib/deltacloud_rack.rb |    4 ++--
 2 files changed, 12 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/796db319/server/config.ru
----------------------------------------------------------------------
diff --git a/server/config.ru b/server/config.ru
index 26c22d6..a5f1d0a 100644
--- a/server/config.ru
+++ b/server/config.ru
@@ -26,24 +26,18 @@ Deltacloud::configure do |server|
   server.root_url '/api'
   server.version Deltacloud::API_VERSION
   server.klass 'Deltacloud::API'
-  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  server.default_driver ENV['API_DRIVER']
 end
 
 Deltacloud::configure(:cimi) do |server|
   server.root_url '/cimi'
   server.version Deltacloud::API_VERSION
   server.klass 'CIMI::API'
-  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  server.default_driver ENV['API_DRIVER']
 end
 
 Deltacloud::configure(:ec2) do |server|
   server.root_url '/ec2'
   server.version '2012-04-01'
   server.klass 'Deltacloud::EC2::API'
-  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  server.default_driver ENV['API_DRIVER']
 end
 
 routes = {}
@@ -66,25 +60,19 @@ if ENV['API_FRONTEND'].split(',').size > 1
 else
   Deltacloud[ENV['API_FRONTEND'].to_sym].require!
   Deltacloud[ENV['API_FRONTEND'].to_sym].default_frontend!
-  class IndexEntrypoint < Sinatra::Base
-    get "/" do
-      redirect Deltacloud.default_frontend.root_url, 301
-    end
-  end
-  routes['/'] = IndexEntrypoint.new
-  routes[Deltacloud.default_frontend.root_url] = Deltacloud.default_frontend.klass
+  routes.merge!({
+    Deltacloud.default_frontend.root_url => Deltacloud.default_frontend.klass
+  })
 end
 
+# Mount static assets directory
+#
+routes.merge!({
+  "/stylesheets" =>  Rack::Directory.new( File.join(File.dirname(__FILE__), "public",
"stylesheets") ),
+  "/javascripts" =>  Rack::Directory.new( File.join(File.dirname(__FILE__), "public",
"javascripts") )
+})
 
 run Rack::Builder.new {
   use Rack::MatrixParams
-  use Rack::DriverSelect
-
-  routes.merge!({
-    "/stylesheets" =>  Rack::Directory.new( File.join(File.dirname(__FILE__), "public",
"stylesheets") ),
-    "/javascripts" =>  Rack::Directory.new( File.join(File.dirname(__FILE__), "public",
"javascripts") )
-  })
-
   run Rack::URLMap.new(routes)
-
-} if respond_to? :run
+}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/796db319/server/lib/deltacloud_rack.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud_rack.rb b/server/lib/deltacloud_rack.rb
index fe99be8..4b5898f 100644
--- a/server/lib/deltacloud_rack.rb
+++ b/server/lib/deltacloud_rack.rb
@@ -66,8 +66,8 @@ module Deltacloud
       @root_url = opts[:root_url]
       @version = opts[:version]
       @klass = opts[:klass]
-      @logger = opts[:logger] || Rack::DeltacloudLogger
-      @default_driver = opts[:default_driver] || :mock
+      @logger = opts[:logger] || Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
+      @default_driver = opts[:default_driver] || ENV['API_DRIVER'] || :mock
       instance_eval(&block)
     end
 


Mime
View raw message