incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r1171772 - in /incubator/deltacloud/trunk/server: config.ru deltacloud.rb lib/deltacloud.rb lib/deltacloud/drivers.rb lib/deltacloud/helpers.rb lib/deltacloud/models.rb lib/drivers.rb server.rb tests/rabbit_test.rb
Date Fri, 16 Sep 2011 20:53:30 GMT
Author: lutter
Date: Fri Sep 16 20:53:28 2011
New Revision: 1171772

URL: http://svn.apache.org/viewvc?rev=1171772&view=rev
Log:
Simplify how the server is loaded

We had requires in all the wrong places, and were changing the load path in
way too many places, too.

This patch makes sure that the way we do requires follows common Ruby style.

The only place in which we touch the load path now is in config.ru

Added:
    incubator/deltacloud/trunk/server/lib/deltacloud.rb
      - copied, changed from r1171527, incubator/deltacloud/trunk/server/config.ru
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb   (contents, props changed)
      - copied, changed from r1171527, incubator/deltacloud/trunk/server/lib/drivers.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/models.rb   (contents, props changed)
      - copied, changed from r1171527, incubator/deltacloud/trunk/server/deltacloud.rb
Removed:
    incubator/deltacloud/trunk/server/deltacloud.rb
    incubator/deltacloud/trunk/server/lib/drivers.rb
Modified:
    incubator/deltacloud/trunk/server/config.ru
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb
    incubator/deltacloud/trunk/server/server.rb
    incubator/deltacloud/trunk/server/tests/rabbit_test.rb

Modified: incubator/deltacloud/trunk/server/config.ru
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/config.ru?rev=1171772&r1=1171771&r2=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/config.ru (original)
+++ incubator/deltacloud/trunk/server/config.ru Fri Sep 16 20:53:28 2011
@@ -16,8 +16,10 @@
 
 require 'rubygems'
 
-$:.unshift File.join(File.dirname(__FILE__), '.')
+top_srcdir = File.dirname(__FILE__)
 
-require 'server.rb'
+$:.unshift File.join(top_srcdir, 'lib')
+
+load File.join(top_srcdir, 'server.rb')
 
 run Sinatra::Application

Copied: incubator/deltacloud/trunk/server/lib/deltacloud.rb (from r1171527, incubator/deltacloud/trunk/server/config.ru)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud.rb?p2=incubator/deltacloud/trunk/server/lib/deltacloud.rb&p1=incubator/deltacloud/trunk/server/config.ru&r1=1171527&r2=1171772&rev=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/config.ru (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud.rb Fri Sep 16 20:53:28 2011
@@ -14,10 +14,14 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'rubygems'
+require 'deltacloud/drivers'
 
-$:.unshift File.join(File.dirname(__FILE__), '.')
+require 'deltacloud/core_ext'
 
-require 'server.rb'
-
-run Sinatra::Application
+require 'deltacloud/base_driver'
+require 'deltacloud/hardware_profile'
+require 'deltacloud/state_machine'
+require 'deltacloud/helpers'
+require 'deltacloud/models'
+require 'deltacloud/validation'
+require 'deltacloud/runner'

Copied: incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb (from r1171527, incubator/deltacloud/trunk/server/lib/drivers.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb?p2=incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb&p1=incubator/deltacloud/trunk/server/lib/drivers.rb&r1=1171527&r2=1171772&rev=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb Fri Sep 16 20:53:28 2011
@@ -34,7 +34,8 @@ module Deltacloud
     def driver_config
       if Thread::current[:drivers].nil?
         Thread::current[:drivers] = {}
-        Dir[File.join(File::dirname(__FILE__), '..', 'config', 'drivers', '*.yaml')].each
do |driver_file|
+        top_srcdir = File.join(File.dirname(__FILE__), '..', '..')
+        Dir[File.join(top_srcdir, 'config', 'drivers', '*.yaml')].each do |driver_file|
           Thread::current[:drivers].merge!(YAML::load(File::read(driver_file)))
         end
       end

Propchange: incubator/deltacloud/trunk/server/lib/deltacloud/drivers.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb?rev=1171772&r1=1171771&r2=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb Fri Sep 16 20:53:28 2011
@@ -18,5 +18,6 @@ require 'deltacloud/helpers/application_
 require 'deltacloud/helpers/json_helper'
 require 'deltacloud/helpers/conversion_helper'
 require 'deltacloud/helpers/hardware_profiles_helper'
+require 'deltacloud/helpers/blob_stream'
 
 helpers ApplicationHelper, ConversionHelper, HardwareProfilesHelper, JSONHelper

Copied: incubator/deltacloud/trunk/server/lib/deltacloud/models.rb (from r1171527, incubator/deltacloud/trunk/server/deltacloud.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/models.rb?p2=incubator/deltacloud/trunk/server/lib/deltacloud/models.rb&p1=incubator/deltacloud/trunk/server/deltacloud.rb&r1=1171527&r2=1171772&rev=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/deltacloud.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/models.rb Fri Sep 16 20:53:28 2011
@@ -14,16 +14,6 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-$:.unshift File.join(File.dirname(__FILE__), 'lib')
-
-require 'drivers'
-
-require 'deltacloud/core_ext'
-
-require 'deltacloud/base_driver'
-require 'deltacloud/hardware_profile'
-require 'deltacloud/state_machine'
-require 'deltacloud/helpers'
 require 'deltacloud/models/base_model'
 require 'deltacloud/models/realm'
 require 'deltacloud/models/image'
@@ -38,6 +28,3 @@ require 'deltacloud/models/blob'
 require 'deltacloud/models/load_balancer'
 require 'deltacloud/models/firewall'
 require 'deltacloud/models/firewall_rule'
-
-require 'deltacloud/validation'
-require 'deltacloud/runner'

Propchange: incubator/deltacloud/trunk/server/lib/deltacloud/models.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1171772&r1=1171771&r2=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Fri Sep 16 20:53:28 2011
@@ -15,7 +15,6 @@
 
 require 'sinatra'
 require 'deltacloud'
-require 'drivers'
 require 'json'
 require 'sinatra/rack_accept'
 require 'sinatra/static_assets'
@@ -25,7 +24,6 @@ require 'erb'
 require 'haml'
 require 'open3'
 require 'sinatra/sinatra_verbose'
-require 'lib/deltacloud/helpers/blob_stream'
 require 'sinatra/rack_driver_select'
 require 'sinatra/rack_runtime'
 require 'sinatra/rack_etag'

Modified: incubator/deltacloud/trunk/server/tests/rabbit_test.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/rabbit_test.rb?rev=1171772&r1=1171771&r2=1171772&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/rabbit_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/rabbit_test.rb Fri Sep 16 20:53:28 2011
@@ -17,7 +17,7 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
-require 'drivers'
+require 'deltacloud/drivers'
 require 'deltacloud/drivers/mock/mock_driver'
 
 module DeltacloudUnitTest



Mime
View raw message