deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [3/7] git commit: Core: Added possibility to define multiple features for collection
Date Tue, 19 Feb 2013 13:00:57 GMT
Core: Added possibility to define multiple features for collection

Instead of:

feature :collection, :name
feature :collection, :second_name

You can now use:

feature :collection, :name, :second_name, ...


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

Branch: refs/heads/master
Commit: 815a80d0421d71f7fcd2bb9f15db671971c6bb3c
Parents: 4bbf4dd
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue Jan 29 12:19:03 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Feb 19 13:37:53 2013 +0100

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/base_driver.rb    |   16 +++++++-----
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   22 ++++++++++-------
 2 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/815a80d0/server/lib/deltacloud/drivers/base_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index 4496a46..61e1989 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -39,13 +39,15 @@ module Deltacloud
       @features ||= {}
     end
 
-    def self.feature(collection, feature_name)
-      return if has_feature?(collection, feature_name)
-      constraints[collection] ||= {}
-      constraints[collection][feature_name] ||= {}
-      constraints[collection][feature_name].merge!(yield) if block_given?
-      features[collection] ||= []
-      features[collection] << feature_name
+    def self.feature(collection, *feature_list)
+      feature_list.each do |feature_name|
+        next if has_feature?(collection, feature_name)
+        constraints[collection] ||= {}
+        constraints[collection][feature_name] ||= {}
+        constraints[collection][feature_name].merge!(yield) if block_given?
+        features[collection] ||= []
+        features[collection] << feature_name
+      end
     end
 
     def self.constraints(opts={})

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/815a80d0/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 2c86651..62c72cc 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -35,16 +35,20 @@ module Deltacloud
     module Ec2
       class Ec2Driver < Deltacloud::BaseDriver
 
-        feature :instances, :user_data
-        feature :instances, :authentication_key
-        feature :instances, :firewalls
-        feature :instances, :instance_count
-        feature :instances, :metrics
-        feature :images, :owner_id
-        feature :images, :image_name
-        feature :images, :image_description
+        feature :instances,
+          :user_data,
+          :authentication_key,
+          :firewalls,
+          :instance_count,
+          :metrics,
+          :attach_snapshot
+
+        feature :images,
+          :owner_id,
+          :image_name,
+          :image_description
+
         feature :buckets, :bucket_location
-        feature :instances, :attach_snapshot
 
         DEFAULT_REGION = 'us-east-1'
 


Mime
View raw message