deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [2/2] git commit: CIMI: Add CIMI Features (Sinatra rabbit features DSL)
Date Thu, 20 Dec 2012 09:54:36 GMT
CIMI: Add CIMI Features (Sinatra rabbit features DSL)


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

Branch: refs/heads/master
Commit: 6b34da0721b6510a61a60d1f19a2a40f5d4cbb61
Parents: 2876172
Author: marios <marios@redhat.com>
Authored: Wed Dec 19 15:20:28 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Wed Dec 19 15:20:28 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/helpers.rb                     |    3 +-
 server/lib/deltacloud/drivers/base_driver.rb   |    2 +-
 server/lib/deltacloud/drivers/cimi_features.rb |   42 +++++++++++++++++++
 3 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/6b34da07/server/lib/cimi/helpers.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/helpers.rb b/server/lib/cimi/helpers.rb
index ea71cbf..75f9770 100644
--- a/server/lib/cimi/helpers.rb
+++ b/server/lib/cimi/helpers.rb
@@ -14,12 +14,13 @@
 # under the License.
 
 require_relative '../deltacloud/drivers/features'
-
+require_relative '../deltacloud/drivers/cimi_features'
 module CIMI
   module Model; end
   class FakeCollection
     extend Sinatra::Rabbit::Features
     include Deltacloud::Features
+    include CIMI::Features
   end
 end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/6b34da07/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 c63f94f..f488f91 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -19,6 +19,7 @@ module Deltacloud
   require_relative '../core_ext.rb'
   require_relative './exceptions.rb'
   require_relative './features.rb'
+  require_relative './cimi_features.rb'
   require_relative '../models/state_machine.rb'
 
   class BaseDriver
@@ -38,7 +39,6 @@ module Deltacloud
       @features ||= {}
     end
 
-
     def self.feature(collection, feature_name)
       return if has_feature?(collection, feature_name)
       constraints[collection] ||= {}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/6b34da07/server/lib/deltacloud/drivers/cimi_features.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/cimi_features.rb b/server/lib/deltacloud/drivers/cimi_features.rb
new file mode 100644
index 0000000..2cea9d7
--- /dev/null
+++ b/server/lib/deltacloud/drivers/cimi_features.rb
@@ -0,0 +1,42 @@
+# 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.
+
+module CIMI
+  module Features
+
+    def self.included(k)
+      current_features = features
+      k.instance_eval do
+        features(&current_features)
+      end
+    end
+
+    def self.features(&block)
+      block_given? ? @features = block : @features || Proc.new{}
+    end
+
+
+    features do
+      feature :default_initial_state, :for => :machines do
+        description "Indicates what the default initial state of a new Machine "
+      end
+
+      feature :initial_states, :for => :machines do
+        description "Indicates the list of allowable initial states"
+      end
+
+    end
+  end
+end


Mime
View raw message