[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:30:34 UTC 2010


The following commit has been merged in the upstream branch:
commit 828098734fd219d40dd1e9546fc829061cdeeb7e
Author: Luke Kanies <luke at madstop.com>
Date:   Thu Oct 29 09:29:47 2009 -0700

    Adding "type" instance method to enhance Demeterness
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 2f7b57a..84f0b93 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -590,6 +590,10 @@ class Type
         rethash
     end
 
+    def type
+        self.class.name
+    end
+
     # Return a specific value for an attribute.
     def value(name)
         name = attr_alias(name)
diff --git a/spec/unit/type.rb b/spec/unit/type.rb
index 11bedaa..575b6c0 100755
--- a/spec/unit/type.rb
+++ b/spec/unit/type.rb
@@ -98,6 +98,10 @@ describe Puppet::Type do
         resource.source_descriptors.should == {:version=>50, :tags=>["mount", "foo"], :path=>"/Mount[foo]"}
     end
 
+    it "should consider its type to be the name of its class" do
+        Puppet::Type.type(:mount).new(:name => "foo").type.should == :mount
+    end
+
     describe "when choosing a default provider" do
         it "should choose the provider with the highest specificity" do
             # Make a fake type

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list