Skip to content

Commit 139c1a5

Browse files
committed
feat: Search 'bins' directory when linking bins. Closes #37
1 parent 6d48fcb commit 139c1a5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

pkg/lib/util/abstract-bins.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ abstract.bins_search_heuristics() {
7171
for file in "$BPM_PACKAGES_PATH/$package"/bin/*; do
7272
abstract.bins_do_action "$action" "$file" "$remove_extensions"
7373
done
74+
elif [ -d "$BPM_PACKAGES_PATH/$package/bins" ]; then
75+
for file in "$BPM_PACKAGES_PATH/$package"/bins/*; do
76+
abstract.bins_do_action "$action" "$file" "$remove_extensions"
77+
done
7478
else
7579
for file in "$BPM_PACKAGES_PATH/$package"/*; do
7680
if [ -x "$file" ]; then

tests/do-plumbing-link-bins.bats

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ load 'util/init.sh'
111111
assert [ "$(readlink $BPM_INSTALL_BIN/exec2.sh)" = "$BPM_PACKAGES_PATH/$pkg/bin/exec2.sh" ]
112112
}
113113

114+
@test "adds bins determined with heuristics (bins directory)" {
115+
local pkg='username/package'
116+
117+
test_util.setup_pkg "$pkg"; {
118+
mkdir 'bins'
119+
touch 'bins/exec1'
120+
touch 'bins/exec2.sh'
121+
}; test_util.finish_pkg
122+
test_util.fake_install "$pkg"
123+
124+
run do-plumbing-link-bins "$pkg"
125+
126+
assert_success
127+
assert [ "$(readlink $BPM_INSTALL_BIN/exec1)" = "$BPM_PACKAGES_PATH/$pkg/bins/exec1" ]
128+
assert [ "$(readlink $BPM_INSTALL_BIN/exec2.sh)" = "$BPM_PACKAGES_PATH/$pkg/bins/exec2.sh" ]
129+
}
130+
114131
@test "adds bins determined with heuristics (root directory)" {
115132
local pkg='username/package'
116133

0 commit comments

Comments
 (0)