deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/8] git commit: CIMI: Moved database initialization to models.rb
Date Mon, 21 Jan 2013 09:52:12 GMT
CIMI: Moved database initialization to models.rb

This will allow proper testing of database


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

Branch: refs/heads/master
Commit: 3c2e811f1b7bde009b801eb03a0b630f23b507cc
Parents: d39233c
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Jan 16 11:01:51 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Jan 21 10:51:52 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/models.rb |   13 +++++++++++++
 server/lib/cimi/server.rb |    2 --
 server/lib/db.rb          |   12 +-----------
 3 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3c2e811f/server/lib/cimi/models.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models.rb b/server/lib/cimi/models.rb
index 09c9552..356f5a7 100644
--- a/server/lib/cimi/models.rb
+++ b/server/lib/cimi/models.rb
@@ -18,6 +18,17 @@ module CIMI
 end
 
 require 'require_relative' if RUBY_VERSION < '1.9'
+require_relative '../db'
+
+unless Deltacloud.test_environment?
+  Deltacloud::initialize_database
+  require_relative './../db/provider'
+  require_relative './../db/entity'
+  require_relative './../db/machine_template'
+  require_relative './../db/address_template'
+  require_relative './../db/volume_configuration'
+  require_relative './../db/volume_template'
+end
 
 require_relative './models/schema'
 require_relative './models/base'
@@ -29,7 +40,9 @@ require_relative './models/disk'
 
 require_relative './models/resource_metadata'
 require_relative './models/cloud_entry_point'
+
 CIMI::Model::ResourceMetadata.acts_as_root_entity
+
 require_relative './models/volume'
 require_relative './models/volume_template'
 require_relative './models/volume_configuration'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3c2e811f/server/lib/cimi/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 41c8bd6..d23b949 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -20,8 +20,6 @@ require 'sinatra/base'
 require 'sinatra/rabbit'
 require_relative '../sinatra'
 
-require_relative '../db'
-
 require_relative './helpers'
 require_relative './collections'
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3c2e811f/server/lib/db.rb
----------------------------------------------------------------------
diff --git a/server/lib/db.rb b/server/lib/db.rb
index 49e6f33..c441021 100644
--- a/server/lib/db.rb
+++ b/server/lib/db.rb
@@ -1,7 +1,7 @@
 module Deltacloud
 
   def self.test_environment?
-    ENV['RACK_ENV'] == 'test' || ENV['DELTACLOUD_NO_DATABASE']
+    ENV['RACK_ENV'] == 'test'
   end
 
   require 'sequel' unless test_environment?
@@ -72,13 +72,3 @@ module Deltacloud
   end
 
 end
-
-unless Deltacloud.test_environment?
-  Deltacloud::initialize_database
-  require_relative './db/provider'
-  require_relative './db/entity'
-  require_relative './db/machine_template'
-  require_relative './db/address_template'
-  require_relative './db/volume_configuration'
-  require_relative './db/volume_template'
-end


Mime
View raw message