reachable-watcher 1.0.110 → 1.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reachable-watcher",
3
- "version": "1.0.110",
3
+ "version": "1.0.111",
4
4
  "license": "CC-BY-3.0",
5
5
  "description": "Check status codes of web servers and sends notification e-mails",
6
6
  "homepage": "https://torben.website/reachable-watcher",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "bashlink": "^1.0.265",
42
- "documentation-website": "^1.0.344",
42
+ "documentation-website": "^1.0.345",
43
43
  "rimraf": "^6.0.1",
44
44
  "shellcheck": "^3.1.0"
45
45
  },
@@ -12,7 +12,20 @@
12
12
  # 3.0 unported license. See https://creativecommons.org/licenses/by/3.0/deed.de
13
13
  # endregion
14
14
  # shellcheck disable=SC1004,SC2016,SC2034,SC2155
15
+ shopt -s expand_aliases
15
16
  # region import
17
+ alias rw.download=rw_download
18
+ rw_download() {
19
+ local -r __documentation__='
20
+ Simply downloads missing modules.
21
+
22
+ >>> br.download --silent https://domain.tld/path/to/file.ext; echo $?
23
+ 6
24
+ '
25
+ command curl --insecure "$@"
26
+ return $?
27
+ }
28
+
16
29
  if [ -f "$(dirname "${BASH_SOURCE[0]}")/node_modules/bashlink/module.sh" ]; then
17
30
  # shellcheck disable=SC1090
18
31
  source "$(dirname "${BASH_SOURCE[0]}")/node_modules/bashlink/module.sh"
@@ -20,23 +33,33 @@ elif [ -f "/usr/lib/bashlink/module.sh" ]; then
20
33
  # shellcheck disable=SC1091
21
34
  source "/usr/lib/bashlink/module.sh"
22
35
  else
23
- declare -gr RW_BASHLINK_PATH="$(
24
- mktemp --directory --suffix -reachable-watcher-bashlink
25
- )/bashlink/"
26
- mkdir "$RW_BASHLINK_PATH"
27
- if wget \
28
- https://torben.website/bashlink/data/distributionBundle/module.sh \
29
- --output-document "${RW_BASHLINK_PATH}module.sh"
30
- then
31
- declare -gr BL_MODULE_RETRIEVE_REMOTE_MODULES=true
32
- # shellcheck disable=SC1091
33
- source "${RW_BASHLINK_PATH}/module.sh"
34
- rm --force --recursive "$RW_BASHLINK_PATH"
35
- else
36
- echo Needed bashlink library not found 1>&2
37
- rm --force --recursive "$RW_BASHLINK_PATH"
36
+ declare -g RW_CACHE_PATH="$(
37
+ echo "$@" | \
38
+ sed \
39
+ --regexp-extended \
40
+ 's/(^| )(-o|--cache-path)(=| +)(.+[^ ])($| +-)/\4/'
41
+ )"
42
+ [ "$RW_CACHE_PATH" = "$*" ] && \
43
+ RW_CACHE_PATH=reachableWatcherInstallCache
44
+ RW_CACHE_PATH="${RW_CACHE_PATH%/}/"
45
+ declare -gr BL_MODULE_REMOTE_MODULE_CACHE_PATH="${RW_CACHE_PATH}bashlink"
46
+ mkdir --parents "$BL_MODULE_REMOTE_MODULE_CACHE_PATH"
47
+ declare -gr BL_MODULE_RETRIEVE_REMOTE_MODULES=true
48
+ if ! (
49
+ [ -f "${BL_MODULE_REMOTE_MODULE_CACHE_PATH}/module.sh" ] || \
50
+ rw.download \
51
+ https://raw.githubusercontent.com/thaibault/bashlink/main/module.sh \
52
+ >"${BL_MODULE_REMOTE_MODULE_CACHE_PATH}/module.sh"
53
+ ); then
54
+ echo Needed bashlink library could not be retrieved. 1>&2
55
+ rm \
56
+ --force \
57
+ --recursive \
58
+ "${BL_MODULE_REMOTE_MODULE_CACHE_PATH}/module.sh"
38
59
  exit 1
39
60
  fi
61
+ # shellcheck disable=SC1091
62
+ source "${BL_MODULE_REMOTE_MODULE_CACHE_PATH}/module.sh"
40
63
  fi
41
64
  bl.module.import bashlink.array
42
65
  bl.module.import bashlink.dictionary