summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-04-09 15:05:14 -0700
committerLuke Kanies <luke@puppetlabs.com>2011-04-09 19:31:54 -0700
commit379a3794c4ea3409ba4b1b36dea9a3d35510eb65 (patch)
treeaa64acdc4ec2bdf549c1b978c8e9c658e2594ff6
parent69db81746fee54e14ee3e46f2fc31e93c096d529 (diff)
downloadpuppet-379a3794c4ea3409ba4b1b36dea9a3d35510eb65.tar.gz
puppet-379a3794c4ea3409ba4b1b36dea9a3d35510eb65.tar.xz
puppet-379a3794c4ea3409ba4b1b36dea9a3d35510eb65.zip
Fixing 'puppet faces' application
It only had one available method, and the errors incorrectly specified what it was. This just defaults to listing all the time, and I've updated the docs to be correct, too. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
-rw-r--r--lib/puppet/application/faces.rb25
-rwxr-xr-xspec/unit/application/faces_spec.rb6
2 files changed, 15 insertions, 16 deletions
diff --git a/lib/puppet/application/faces.rb b/lib/puppet/application/faces.rb
index 904a0cccc..a7b227e23 100644
--- a/lib/puppet/application/faces.rb
+++ b/lib/puppet/application/faces.rb
@@ -10,6 +10,12 @@ class Puppet::Application::Faces < Puppet::Application
Puppet::Util::Log.level = :debug
end
+ option("--help", "-h") do |arg|
+ puts "Usage: puppet faces [actions|terminuses]
+Lists all available interfaces, and by default includes all available terminuses and actions.
+"
+ end
+
option("--verbose", "-v") do
Puppet::Util::Log.level = :info
end
@@ -44,11 +50,10 @@ class Puppet::Application::Faces < Puppet::Application
end
end
- attr_accessor :verb, :name, :arguments
+ attr_accessor :name, :arguments
def main
- # Call the method associated with the provided action (e.g., 'find').
- send(verb, *arguments)
+ list(*arguments)
end
def setup
@@ -56,20 +61,8 @@ class Puppet::Application::Faces < Puppet::Application
load_applications # Call this to load all of the apps
- @verb, @arguments = command_line.args
+ @arguments = command_line.args
@arguments ||= []
-
- validate
- end
-
- def validate
- unless verb
- raise "You must specify 'find', 'search', 'save', or 'destroy' as a verb; 'save' probably does not work right now"
- end
-
- unless respond_to?(verb)
- raise "Command '#{verb}' not found for 'faces'"
- end
end
def faces
diff --git a/spec/unit/application/faces_spec.rb b/spec/unit/application/faces_spec.rb
index 0b84493d2..c4d15a297 100755
--- a/spec/unit/application/faces_spec.rb
+++ b/spec/unit/application/faces_spec.rb
@@ -7,4 +7,10 @@ describe Puppet::Application::Faces do
it "should be an application" do
Puppet::Application::Faces.superclass.should equal(Puppet::Application)
end
+
+ it "should always call 'list'" do
+ faces = Puppet::Application::Faces.new
+ faces.expects(:list)
+ faces.main
+ end
end