Puppet Function: get_opengrok_fname

Defined in:
lib/puppet/functions/get_opengrok_fname.rb
Function type:
Ruby 4.x API

Overview

get_opengrok_fname(String $opengrok_url)String

get_opengrok_fname function

Examples:

Calling the function

get_opengrok_fname('https://github.com/OpenGrok/OpenGrok/files/467358/opengrok-0.12.1.6.tar.gz.zip')

Parameters:

Returns:

  • (String)

    Returns a string of just the filename of the download.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/puppet/functions/get_opengrok_fname.rb', line 2

Puppet::Functions.create_function(:get_opengrok_fname) do
  # @param opengrok_url Takes a full download url from https://github.com/OpenGrok/OpenGrok/releases
  # @return [String] Returns a string of just the filename of the download.
  # @example Calling the function
  #   get_opengrok_fname('https://github.com/OpenGrok/OpenGrok/files/467358/opengrok-0.12.1.6.tar.gz.zip')
  dispatch :get_opengrok_fname do
    param 'String', :opengrok_url
  end

  def get_opengrok_fname(opengrok_url)
    a = opengrok_url.split('/')
    a.last
  end
end