summaryrefslogtreecommitdiffstats
path: root/lib/puppet.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-08 00:02:23 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-08 00:02:23 +0000
commitcbf10c5e365fb7440c89321a2c329e40424d30b4 (patch)
tree6be719c4848e73d75d8661f240cd4e1e2f1f2a1d /lib/puppet.rb
parent23f982ecda3fd74867d404b5e784f072db9a1cde (diff)
downloadpuppet-cbf10c5e365fb7440c89321a2c329e40424d30b4.tar.gz
puppet-cbf10c5e365fb7440c89321a2c329e40424d30b4.tar.xz
puppet-cbf10c5e365fb7440c89321a2c329e40424d30b4.zip
Merging changes from the head of the rework1 branch, r 784
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@787 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet.rb')
-rw-r--r--lib/puppet.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index 5d0a3c579..c4a14ef7b 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -1,5 +1,6 @@
require 'singleton'
require 'puppet/log'
+require 'puppet/util'
# see the bottom of the file for further inclusions
@@ -239,9 +240,28 @@ PUPPETVERSION = '0.9.4'
return true
end
end
+
+ # Create a new type
+ def self.newtype(name, parent = nil, &block)
+ parent ||= Puppet::Type
+ Puppet::Util.symbolize(name)
+ t = Class.new(parent) do
+ @name = name
+ end
+ t.class_eval(&block)
+ @types ||= {}
+ @types[name] = t
+ end
+
+ # Retrieve a type by name
+ def self.type(name)
+ unless defined? @types
+ return nil
+ end
+ return @types[name]
+ end
end
-require 'puppet/util'
require 'puppet/server'
require 'puppet/type'
require 'puppet/storage'