summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-05-03 14:55:14 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-05-03 14:55:14 -0700
commitb17b49c97380cd64e75ac5e2ef12fb939ae953bb (patch)
treeb285f8ae0a1c7359632e81f5b10655bb64145f36
parentb7ba66c8ebd7d59de40188a70b4e6fa0ddd8d2ad (diff)
parent5120a95830183fdb30fc178452bfc3e6f44605b7 (diff)
downloadpuppet-b17b49c97380cd64e75ac5e2ef12fb939ae953bb.tar.gz
puppet-b17b49c97380cd64e75ac5e2ef12fb939ae953bb.tar.xz
puppet-b17b49c97380cd64e75ac5e2ef12fb939ae953bb.zip
Merge branch 'bug/2.7.x/7276-return-value-from-plugin-download-is-not-user-friendly' into 2.7.x
-rw-r--r--lib/puppet/application/help.rb1
-rw-r--r--lib/puppet/application/plugin.rb3
-rw-r--r--lib/puppet/face/plugin.rb12
-rw-r--r--lib/puppet/interface/action.rb2
-rw-r--r--lib/puppet/interface/face_collection.rb1
-rwxr-xr-xspec/unit/face/plugin_spec.rb10
6 files changed, 27 insertions, 2 deletions
diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb
index 0d7767632..4829a2036 100644
--- a/lib/puppet/application/help.rb
+++ b/lib/puppet/application/help.rb
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
require 'puppet/application/face_base'
class Puppet::Application::Help < Puppet::Application::FaceBase
diff --git a/lib/puppet/application/plugin.rb b/lib/puppet/application/plugin.rb
new file mode 100644
index 000000000..2d0402e43
--- /dev/null
+++ b/lib/puppet/application/plugin.rb
@@ -0,0 +1,3 @@
+require 'puppet/application/face_base'
+class Puppet::Application::Plugin < Puppet::Application::FaceBase
+end
diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb
index 19060942a..4b45ed3a1 100644
--- a/lib/puppet/face/plugin.rb
+++ b/lib/puppet/face/plugin.rb
@@ -7,6 +7,10 @@ Puppet::Face.define(:plugin, '0.0.1') do
action :download do
summary "Download plugins from the configured master"
+ returns <<-EOT
+ An array containing the files actually downloaded.
+ This will be empty array when everything was in sync.
+ EOT
when_invoked do |options|
require 'puppet/configurer/downloader'
@@ -15,5 +19,13 @@ Puppet::Face.define(:plugin, '0.0.1') do
Puppet[:pluginsource],
Puppet[:pluginsignore]).evaluate
end
+
+ when_rendering :for_humans do |value|
+ if value.empty? then
+ "No plugins downloaded."
+ else
+ "Downloaded these plugins: #{value.join(', ')}"
+ end
+ end
end
end
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index 203d80827..d4cf23fce 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -3,6 +3,7 @@ require 'puppet/interface/documentation'
require 'prettyprint'
class Puppet::Interface::Action
+ extend Puppet::Interface::DocGen
include Puppet::Interface::FullDocs
def initialize(face, name, attrs = {})
@@ -44,6 +45,7 @@ class Puppet::Interface::Action
########################################################################
# Documentation...
+ attr_doc :returns
def synopsis
output = PrettyPrint.format do |s|
s.text("puppet #{@face.name}")
diff --git a/lib/puppet/interface/face_collection.rb b/lib/puppet/interface/face_collection.rb
index baa424692..12d3c56b1 100644
--- a/lib/puppet/interface/face_collection.rb
+++ b/lib/puppet/interface/face_collection.rb
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
require 'puppet/interface'
module Puppet::Interface::FaceCollection
diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb
new file mode 100755
index 000000000..383aaa3d3
--- /dev/null
+++ b/spec/unit/face/plugin_spec.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env rspec
+require 'spec_helper'
+require 'puppet/face'
+
+describe Puppet::Face[:plugin, '0.0.1'] do
+ [:download].each do |action|
+ it { should be_action action }
+ it { should respond_to action }
+ end
+end