You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2012/05/22 22:19:37 UTC

[3/50] [abbrv] git commit: Core: Moved the library to 'deltacloud/api' prefix to not conflict with client gem

Core: Moved the library to 'deltacloud/api' prefix to not conflict with client gem


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

Branch: refs/heads/master
Commit: 1dfbe8655bc4a9702f4b17fefb224a258c71b876
Parents: 08c1955
Author: Michal Fojtik <mf...@redhat.com>
Authored: Tue May 22 17:06:41 2012 +0200
Committer: Michal fojtik <mf...@redhat.com>
Committed: Tue May 22 22:17:40 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud.rb         |   81 ---------------------------------
 server/lib/deltacloud/api.rb     |   79 ++++++++++++++++++++++++++++++++
 server/tests/api/driver_test.rb  |    2 +-
 server/tests/api/library_test.rb |    2 +-
 4 files changed, 81 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1dfbe865/server/lib/deltacloud.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud.rb b/server/lib/deltacloud.rb
deleted file mode 100644
index bf5345f..0000000
--- a/server/lib/deltacloud.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'ostruct'
-
-load File.join(File.dirname(__FILE__), 'deltacloud/core_ext.rb')
-
-require_relative 'deltacloud/core_ext'
-require_relative 'deltacloud/models'
-require_relative 'deltacloud/drivers'
-require_relative 'deltacloud/helpers/driver_helper'
-
-module Deltacloud
-
-  API_VERSION = '0.5.0'
-
-  def self.drivers
-    Drivers.driver_config
-  end
-
-  class Library
-    include Helpers::Drivers
-
-    attr_reader :backend, :credentials
-
-    def initialize(driver_name, opts={}, &block)
-      Thread.current[:driver] = driver_name.to_s
-      Thread.current[:provider] = opts[:provider]
-      @backend = driver
-      opts[:user] ||= 'mockuser'
-      opts[:password] ||= 'mockpassword'
-      @credentials = OpenStruct.new(:user => opts[:user], :password => opts[:password])
-      yield backend if block_given?
-    end
-
-    def version
-      Deltacloud::API_VERSION
-    end
-
-    def current_provider
-      Thread.current[:provider]
-    end
-
-    def current_driver
-      Thread.current[:driver]
-    end
-
-    def providers
-      Deltacloud.drivers[current_driver.to_sym]
-    end
-
-    def method_missing(name, *args)
-      return super unless backend.respond_to? name
-      begin
-        params = ([@credentials] + args).flatten
-        backend.send(name, *params)
-      rescue ArgumentError
-        backend.send(name, *args)
-      end
-    end
-
-  end
-
-  def self.new(driver_name, opts={}, &block)
-    Library.new(driver_name, opts, &block)
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1dfbe865/server/lib/deltacloud/api.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/api.rb b/server/lib/deltacloud/api.rb
new file mode 100644
index 0000000..8406394
--- /dev/null
+++ b/server/lib/deltacloud/api.rb
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'rubygems'
+require 'ostruct'
+
+load File.join(File.dirname(__FILE__), 'core_ext.rb')
+require_relative 'models'
+require_relative 'drivers'
+require_relative 'helpers/driver_helper'
+
+module Deltacloud
+
+  API_VERSION = '0.5.0'
+
+  def self.drivers
+    Drivers.driver_config
+  end
+
+  class Library
+    include Helpers::Drivers
+
+    attr_reader :backend, :credentials
+
+    def initialize(driver_name, opts={}, &block)
+      Thread.current[:driver] = driver_name.to_s
+      Thread.current[:provider] = opts[:provider]
+      @backend = driver
+      opts[:user] ||= 'mockuser'
+      opts[:password] ||= 'mockpassword'
+      @credentials = OpenStruct.new(:user => opts[:user], :password => opts[:password])
+      yield backend if block_given?
+    end
+
+    def version
+      Deltacloud::API_VERSION
+    end
+
+    def current_provider
+      Thread.current[:provider]
+    end
+
+    def current_driver
+      Thread.current[:driver]
+    end
+
+    def providers
+      Deltacloud.drivers[current_driver.to_sym]
+    end
+
+    def method_missing(name, *args)
+      return super unless backend.respond_to? name
+      begin
+        params = ([@credentials] + args).flatten
+        backend.send(name, *params)
+      rescue ArgumentError
+        backend.send(name, *args)
+      end
+    end
+
+  end
+
+  def self.new(driver_name, opts={}, &block)
+    Library.new(driver_name, opts, &block)
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1dfbe865/server/tests/api/driver_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/api/driver_test.rb b/server/tests/api/driver_test.rb
index 20f9197..c9facbf 100644
--- a/server/tests/api/driver_test.rb
+++ b/server/tests/api/driver_test.rb
@@ -1,5 +1,5 @@
 require_relative './common'
-require_relative '../../lib/deltacloud'
+require_relative '../../lib/deltacloud/api'
 
 begin
   require 'arguments'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1dfbe865/server/tests/api/library_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/api/library_test.rb b/server/tests/api/library_test.rb
index 72d00ef..025ece6 100644
--- a/server/tests/api/library_test.rb
+++ b/server/tests/api/library_test.rb
@@ -1,5 +1,5 @@
 require_relative './common'
-require_relative '../../lib/deltacloud'
+require_relative '../../lib/deltacloud/api'
 
 require 'pp'