blob: e5c9a9dc574a7d1947828fdb0b1a41f0b1f2673d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
require 'puppet/face'
Puppet::Face.define(:basetest, '0.0.1') do
copyright "Puppet Labs", 2011
license "Apache 2 license; see COPYING"
summary "This is just so tests don't fail"
option "--[no-]boolean"
option "--mandatory ARGUMENT"
action :foo do
option("--action")
when_invoked do |*args| args.length end
end
action :return_true do
summary "just returns true"
when_invoked do |options| true end
end
action :return_false do
summary "just returns false"
when_invoked do |options| false end
end
action :return_nil do
summary "just returns nil"
when_invoked do |options| nil end
end
action :raise do
summary "just raises an exception"
when_invoked do |options| raise ArgumentError, "your failure" end
end
action :with_s_rendering_hook do
summary "has a rendering hook for 's'"
when_invoked do |options| "this is not the hook you are looking for" end
when_rendering :s do |value| "you invoked the 's' rendering hook" end
end
action :count_args do
summary "return the count of arguments given"
when_invoked do |*args| args.length - 1 end
end
end
|