-
Notifications
You must be signed in to change notification settings - Fork 2
/
plan.sh
67 lines (51 loc) · 1.53 KB
/
plan.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
pkg_name="hologit"
pkg_origin="jarvus"
pkg_description="A universal, git-native tool for assembling software"
pkg_upstream_url="https://github.com/JarvusInnovations/hologit"
pkg_license=("MIT")
pkg_maintainer="Chris Alfano <[email protected]>"
pkg_build_deps=(
jarvus/underscore
)
pkg_deps=(
core/git
"jarvus/node20" # use jarvus build until merged: https://github.com/habitat-sh/core-plans/pull/4708
core/hab/0.79.0 # last version before new license
)
pkg_bin_dirs=(bin)
pkg_version() {
underscore extract version --outfmt text --in "${PLAN_CONTEXT}/package.json"
}
# implement build workflow
do_before() {
do_default_before
update_pkg_version
}
do_build() {
pushd "${CACHE_PATH}" > /dev/null
build_line "Copying application to ${CACHE_PATH}"
cp "${PLAN_CONTEXT}/LICENSE" "${PLAN_CONTEXT}/package.json" ./
cp -r "${PLAN_CONTEXT}/commands" "${PLAN_CONTEXT}/lib" ./
cp -r "${PLAN_CONTEXT}/bin" ./node-bin
build_line "Installing dependencies with NPM"
npm install
build_line "Fixing interpreter"
sed -e "s#\#\!/usr/bin/env node#\#\!$(pkg_path_for node20)/bin/node#" --in-place "node-bin/cli.js"
popd > /dev/null
}
do_install() {
pushd "${CACHE_PATH}" > /dev/null
cp -r ./* "${pkg_prefix}/"
# TODO: remove this once habitat#4493 is resolved
build_line "Creating git-holo command"
cat > "${pkg_prefix}/bin/git-holo" <<- EOM
#!/bin/sh
export PATH="\${PATH}:$(_assemble_runtime_path)"
exec ${pkg_prefix}/node-bin/cli.js "\$@"
EOM
chmod +x "${pkg_prefix}/bin/git-holo"
popd > /dev/null
}
do_strip() {
return 0
}