diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-17 19:20:49 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-19 10:33:22 -0700 |
| commit | 266f937ed7d859fb2aee94c76e1a20539357c1eb (patch) | |
| tree | 575c9d0497fdc1e9fd629dd73573ef410c3ed388 /lib/puppet | |
| parent | 32c667c79bc0d5151580ea79719f28739945bfb1 (diff) | |
| download | puppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.tar.gz puppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.tar.xz puppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.zip | |
(#6962) Add 'description' to faces and action.
This adds the 'description' method to the faces and actions, as well as
structured testing to ensure that the DSL works as expected.
Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/interface.rb | 16 | ||||
| -rw-r--r-- | lib/puppet/interface/action.rb | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 4a36b509a..d97e462de 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -68,9 +68,14 @@ class Puppet::Interface self.default_format = format.to_sym end - attr_accessor :summary + ######################################################################## + # Documentation. We currently have to rewrite both getters because we share + # the same instance between build-time and the runtime instance. When that + # splits out this should merge into a module that both the action and face + # include. --daniel 2011-04-17 + attr_accessor :summary, :description def summary(value = nil) - value.nil? or summary = value + self.summary = value unless value.nil? @summary end def summary=(value) @@ -81,6 +86,13 @@ class Puppet::Interface @summary = value end + def description(value = nil) + self.description = value unless value.nil? + @description + end + + + ######################################################################## attr_reader :name, :version def initialize(name, version, &block) diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index d2d4facaa..860ce4058 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -28,7 +28,7 @@ class Puppet::Interface::Action ######################################################################## # Documentation stuff, whee! - attr_accessor :summary + attr_accessor :summary, :description def summary=(value) value = value.to_s value =~ /\n/ and |
