wci-bash 0.20181204135618.0 → 0.20181204141227.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acf252b607003ba087ab3d71072c2a59bf85245f
4
- data.tar.gz: 5859506db64dce938b0fc36e5e0b6a59e1b56ed9
3
+ metadata.gz: e6cd5af397b0c94cc0ba9a0a3326584d3c0faf1b
4
+ data.tar.gz: 64a9f5f3542f67b99cec55a25cb4050e6a532236
5
5
  SHA512:
6
- metadata.gz: 9fcd918a973f721d229af947c3a58e0d39e7b7ad0c373f75c658de4d8a39b5019da46a79b4ec5cc13f5a7a11fdd85505443749f6227365fcce8b658c1affa7f4
7
- data.tar.gz: 90b7f45fe4b3f0fc2cee931ec4e5dee8692f49c58043714297c8e0df09a34b21d243f37926aba4192602f72af880a194ddaab7f733e6af8cca1a6a335df835cb
6
+ metadata.gz: 9250d8243c4e9f7ea52503f902ba8168b4d53f5abd85269048d321749eeac0add732b820542ef8f28e61d90d37ae39996dc905eec767fe091f5a1ccf42abd855
7
+ data.tar.gz: 7d0ab880d67324f56b50753a0dd86999ac10cb58bceed4bf428b69fd31801f23052c306df73cca4cd7a23edf77e39938a40fef62356b626cd16118793f6efbce
@@ -1,6 +1,66 @@
1
1
 
2
2
  ### function include file for wci-libs-bash
3
3
 
4
- function test-fish-head {
5
- echo fish-head
4
+ function log_error {
5
+ ERROR_MESSAGE="$1"
6
+ ERROR_MESSAGE=${ERROR_MESSAGE:-ERROR_MESSAGE NOT SET}
7
+ THIS_PID="$$"
8
+ THIS_PID=${THIS_PID:-THIS_PID NOT SET}
9
+ SCRIPT_NAME=${SCRIPT_NAME:-SCRIPT_NAME NOT SET}
10
+ LOG_TIMESTAMP=`date "+%F %H:%M:%S %z"`
11
+ echo "${LOG_TIMESTAMP} - ${THIS_PID} - ${SCRIPT_NAME} - ERROR: ${ERROR_MESSAGE}" >&2
12
+ }
13
+
14
+ function log_error_line {
15
+ ERROR_MESSAGE="$1"
16
+ echo "${ERROR_MESSAGE}" >&2
17
+ }
18
+
19
+ function usage {
20
+ ERROR_MESSAGE="$1"
21
+ ERROR_MESSAGE=${ERROR_MESSAGE:-ERROR_MESSAGE NOT SET}
22
+ SCRIPT_NAME=${SCRIPT_NAME:-SCRIPT_NAME NOT SET}
23
+ EXIT_STATUS="1"
24
+ SLEEP_DURATION="3"
25
+ log_error_line
26
+ log_error "##### ***** ERROR ***** ######"
27
+ log_error
28
+ log_error "Message: ${ERROR_MESSAGE}"
29
+ log_error "CMD: ${SCRIPT_NAME} ${THIS_ARGS}"
30
+ if [ ! -z "${USAGE_INFO}" ] ; then
31
+ log_error
32
+ log_error "Usage: ${SCRIPT_NAME} ${USAGE_INFO}"
33
+ log_error
34
+ fi
35
+ log_error "##### ***** ERROR ***** ######"
36
+ log_error "##### Sleeping for ${SLEEP_DURATION} seconds then exiting with status: ${EXIT_STATUS}"
37
+ log_error_line
38
+ sleep "${SLEEP_DURATION}"
39
+ exit "${EXIT_STATUS}"
40
+ }
41
+
42
+ function log_event {
43
+ if [ "${WCI_ENABLE_LOGGING}" == "TRUE" ] ; then
44
+ LOG_MESSAGE="$1"
45
+ THIS_PID="$$"
46
+ THIS_PID=${THIS_PID:-THIS_PID NOT SET}
47
+ SCRIPT_NAME=${SCRIPT_NAME:-SCRIPT_NAME NOT SET}
48
+ LOG_TIMESTAMP=`date "+%F %H:%M:%S %z"`
49
+ echo "${LOG_TIMESTAMP} - ${THIS_PID} - ${SCRIPT_NAME} - ${LOG_MESSAGE}"
50
+ fi
51
+ }
52
+
53
+ function log_line {
54
+ if [ "${WCI_ENABLE_LOGGING}" == "TRUE" ] ; then
55
+ LOG_MESSAGE="$1"
56
+ echo "${LOG_MESSAGE}"
57
+ fi
58
+ }
59
+
60
+ function log_pipe {
61
+ while read LINE ; do
62
+ if [ "${WCI_ENABLE_LOGGING}" == "TRUE" ] ; then
63
+ echo "${LINE}"
64
+ fi
65
+ done < "/dev/stdin"
6
66
  }
data/lib/wci.bash CHANGED
@@ -1,7 +1,10 @@
1
1
 
2
2
  ### index include file for wci-libs-bash
3
3
 
4
- export WCI_LIBS_BASH_INSTALLED='TRUE'
4
+ WCI_LIBS_BASH_INSTALLED='TRUE'
5
+
6
+ ### enable wci logging functionality
7
+ WCI_ENABLE_LOGGING="${WCI_ENABLE_LOGGING:-TRUE}"
5
8
 
6
9
  ENTRY_SYMLINK_PATH="$(which wci.bash)"
7
10
  ENTRY_PATH="$(realpath "${ENTRY_SYMLINK_PATH}")"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wci-bash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20181204135618.0
4
+ version: 0.20181204141227.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WCI