Bash-wrapper-functions: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Overview=
=Overview=


A project that offers common bash wrapper functionality in form of a single function file to be sourced in the main wrapper.
A project that offers common bash wrapper functionality in form of a single function file to be sourced in the main wrapper, and a main wrapper template ("application-shell-wrapper-template")


Functionality:
Functionality:
* Build a classpath based on the JAR content of a repository.
* Basic error/warn/debug functionality.
* Building a classpath based on the JAR content of a repository.
* Getting the Java binary based on a combination of command line options, the content of the JAVA_HOME environment variable, and the "java" binary available in path.
* [[Nova_Ordis_Utilities_Version_Metadata_Handling#.22Light.22_Version_Reporting|"Light" version reporting functionality]], which relies on the presence of the lib/VERSION file.
* Command line argument pre-processing:
** Single-quote enclosed arguments are not broken down but passed as such to the lower layer.
 
=GitHub=
 
{{External|https://github.com/NovaOrdis/bash-wrapper-functions}}
 
=Procedure to Integrate into  New Project=
 
1. Copy "application-shell-wrapper-template" under the bin directory of the target project and change its name to match the project's application name.
 
2. Copy "bash-wrapper-functions" in the same directory.
 
3. Adapt "application-shell-wrapper-template" for the project:
 
3.1 Adjust MAIN_CLASS
 
MAIN_CLASS=...
 
4. Update the assembly file to include the top-level wrapper and "bash-wrapper-functions" in the distributable artifact.
 
=Usage=
 
Copy <tt>bash-wrapper-functions</tt> in the bin directory and refer it as following:
 
  [ -f $(dirname $0)/bash-wrapper-functions ] && .  $(dirname $0)/bash-wrapper-functions || { echo "$(dirname $0)/bash-wrapper-functions not found" 1>&2; exit 1; }

Latest revision as of 15:49, 28 October 2017

Internal

Overview

A project that offers common bash wrapper functionality in form of a single function file to be sourced in the main wrapper, and a main wrapper template ("application-shell-wrapper-template")

Functionality:

  • Basic error/warn/debug functionality.
  • Building a classpath based on the JAR content of a repository.
  • Getting the Java binary based on a combination of command line options, the content of the JAVA_HOME environment variable, and the "java" binary available in path.
  • "Light" version reporting functionality, which relies on the presence of the lib/VERSION file.
  • Command line argument pre-processing:
    • Single-quote enclosed arguments are not broken down but passed as such to the lower layer.

GitHub

https://github.com/NovaOrdis/bash-wrapper-functions

Procedure to Integrate into New Project

1. Copy "application-shell-wrapper-template" under the bin directory of the target project and change its name to match the project's application name.

2. Copy "bash-wrapper-functions" in the same directory.

3. Adapt "application-shell-wrapper-template" for the project:

3.1 Adjust MAIN_CLASS

MAIN_CLASS=...

4. Update the assembly file to include the top-level wrapper and "bash-wrapper-functions" in the distributable artifact.

Usage

Copy bash-wrapper-functions in the bin directory and refer it as following:

 [ -f $(dirname $0)/bash-wrapper-functions ] && .  $(dirname $0)/bash-wrapper-functions || { echo "$(dirname $0)/bash-wrapper-functions not found" 1>&2; exit 1; }