Sha256: e60d2f4d3be6878182cbc8dce8627afba4f04f9924036237f72592e8ff3950d8

Contents?: true

Size: 1.26 KB

Versions: 504

Compression:

Stored size: 1.26 KB

Contents

require 'puppet/face'

Puppet::Face.define(:basetest, '0.0.1') do
  copyright "Puppet Inc.", 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

  action :with_specific_exit_code do
    summary "just call exit with the desired exit code"
    when_invoked do |options| exit(5) end
  end
end

Version data entries

504 entries across 504 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/lib/puppet/face/basetest.rb
puppet-8.3.0-x86-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.3.0-x64-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.3.0-universal-darwin spec/lib/puppet/face/basetest.rb
puppet-8.4.0 spec/lib/puppet/face/basetest.rb
puppet-8.4.0-x86-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.4.0-x64-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.4.0-universal-darwin spec/lib/puppet/face/basetest.rb
puppet-7.28.0 spec/lib/puppet/face/basetest.rb
puppet-7.28.0-x86-mingw32 spec/lib/puppet/face/basetest.rb
puppet-7.28.0-x64-mingw32 spec/lib/puppet/face/basetest.rb
puppet-7.28.0-universal-darwin spec/lib/puppet/face/basetest.rb
puppet-8.3.1 spec/lib/puppet/face/basetest.rb
puppet-8.3.1-x86-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.3.1-x64-mingw32 spec/lib/puppet/face/basetest.rb
puppet-8.3.1-universal-darwin spec/lib/puppet/face/basetest.rb
puppet-7.27.0 spec/lib/puppet/face/basetest.rb
puppet-7.27.0-x86-mingw32 spec/lib/puppet/face/basetest.rb
puppet-7.27.0-x64-mingw32 spec/lib/puppet/face/basetest.rb
puppet-7.27.0-universal-darwin spec/lib/puppet/face/basetest.rb