From 0d6ac040f4223725586c2b5d71ffcb0d36206080 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 3 May 2011 13:33:43 -0700 Subject: maint: remove emacs 'coding' cookie from files. This is unnecessary, and only turned up because Matz &c. impose their taste on the rest of the world through the Emacs Ruby mode. Since people are starting to clone that, and it doesn't add value, eliminate it everywhere. Reviewed-By: Pieter van de Bruggen --- lib/puppet/application/help.rb | 1 - lib/puppet/interface/face_collection.rb | 1 - 2 files changed, 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/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 -- cgit From 5490f7aee19f477914520f0735858f58136122e4 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 3 May 2011 14:38:57 -0700 Subject: (#6962) Added 'returns' block to action documentation. We want to be able to document the data returned from an action, since this is one of the most critical parts of the API for Ruby developers. This adds a multiline documentation block that captures that. Reviewed-By: Pieter van de Bruggen --- lib/puppet/interface/action.rb | 2 ++ 1 file changed, 2 insertions(+) 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}") -- cgit From bb889bf287f702e822d384f74af52fe2604ca37f Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 3 May 2011 13:41:57 -0700 Subject: (#7276) Create a plugin face application. We need a boilerplate application file and class to expose a face on the command line; this adds that for the plugin face, to expose it to users. Based on work by Luke Kaines in https://github.com/lak/puppet/commit/a61cc770ca9b2cad744b5b21b9776a834d6ca895 Reviewed-By: Pieter van de Bruggen --- lib/puppet/application/plugin.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lib/puppet/application/plugin.rb 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 -- cgit From 5120a95830183fdb30fc178452bfc3e6f44605b7 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 3 May 2011 14:36:13 -0700 Subject: (#7276) Better reporting from the plugin download action. Instead of just returning vague values, return useful information when rendering for a human being. Based on work by Luke Kaines in https://github.com/lak/puppet/commit/a61cc770ca9b2cad744b5b21b9776a834d6ca895 Reviewed-By: Pieter van de Bruggen --- lib/puppet/face/plugin.rb | 12 ++++++++++++ spec/unit/face/plugin_spec.rb | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100755 spec/unit/face/plugin_spec.rb 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/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 -- cgit