You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2011/06/07 15:22:26 UTC
svn commit: r1132998 - in /incubator/deltacloud/trunk/server:
lib/deltacloud/base_driver/features.rb views/api/show.xml.haml
Author: lutter
Date: Tue Jun 7 13:22:26 2011
New Revision: 1132998
URL: http://svn.apache.org/viewvc?rev=1132998&view=rev
Log:
Add (optional) constraints to features.
This is useful for defining something like a maximum length
of a parameter.
Signed-off-by: Chris Lalancette <cl...@redhat.com>
Modified:
incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb
incubator/deltacloud/trunk/server/views/api/show.xml.haml
Modified: incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb?rev=1132998&r1=1132997&r2=1132998&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb Tue Jun 7 13:22:26 2011
@@ -75,10 +75,11 @@ module Deltacloud
# A specific feature enabled by a driver (see +feature+)
class Feature
- attr_reader :decl
+ attr_reader :decl, :constraints
def initialize(decl, &block)
@decl = decl
+ @constraints = {}
instance_eval &block if block_given?
end
@@ -93,6 +94,10 @@ module Deltacloud
def description
decl.description
end
+
+ def constraint(name, value)
+ @constraints[name] = value
+ end
end
def self.feature_decls
Modified: incubator/deltacloud/trunk/server/views/api/show.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/api/show.xml.haml?rev=1132998&r1=1132997&r2=1132998&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/api/show.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/api/show.xml.haml Tue Jun 7 13:22:26 2011
@@ -3,3 +3,5 @@
%link{ :rel=>entry_point[0], :href=>entry_point[1] }
- for feature in driver.features(entry_point[0])
%feature{ :name=>feature.name }
+ - for name,value in feature.constraints
+ %constraint{ :name=>name, :value=>value }