Skip to content

Commit 1e38ebf

Browse files
committed
refactor: Rename 'BPM_PREFIX' to 'BPM_CELLAR'
1 parent e8e35fb commit 1e38ebf

File tree

14 files changed

+69
-69
lines changed

14 files changed

+69
-69
lines changed

completions/_bpm.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ case $state in
3838
_describe -t commands "gem subcommand" subcommandOptions
3939
;;
4040
(echo)
41-
local -a subcommandOptions=(BPM_ROOT BPM_PREFIX)
41+
local -a subcommandOptions=(BPM_ROOT BPM_CELLAR)
4242
_describe -t commands "gem subcommand" subcommandOptions
4343
;;
4444
(init)

completions/bpm.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ _bpm() {
6060
readarray -t COMPREPLY < <(IFS=' ' compgen -W "${subcommandOptions[*]}" -- "$currentWord")
6161
;;
6262
echo)
63-
subcommandOptions=(BPM_ROOT BPM_PREFIX)
63+
subcommandOptions=(BPM_ROOT BPM_CELLAR)
6464
readarray -t COMPREPLY < <(IFS=' ' compgen -W "${subcommandOptions[*]}" -- "$currentWord")
6565
;;
6666
init)

completions/bpm.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -l subcommandOptions --shh
1313
complete -c $cmd -f -n "__fish_seen_subcommand_from $subcmd" -a "$subcommandOptions"
1414

1515
set subcmd echo
16-
set -l subcommandOptions BPM_ROOT BPM_PREFIX
16+
set -l subcommandOptions BPM_ROOT BPM_CELLAR
1717
complete -c $cmd -f -n "__fish_seen_subcommand_from $subcmd" -a "$subcommandOptions"
1818

1919
set subcmd init

docs/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The location of the root `bpm` folder. Defaults to `"${XDG_DATA_HOME:-$HOME/.loc
1010

1111
Set to a non-null string to clone the full repository history instead of only the last commit. By default, only the latest commit is cloned (`--depth=1`). The only exception to this is when a specific version is specified with `@v0.1.0` notation. When that is specified, the whole history is downloaded
1212

13-
### `BPM_PREFIX`
13+
### `BPM_CELLAR`
1414

1515
Set the installation and package checkout prefix (default is `$BPM_ROOT/cellar`). Setting this to `/usr/local`, for example, will install binaries to `/usr/local/bin`, manpages to `/usr/local/man`, completions to `/usr/local/completions`, and clone packages to `/usr/local/packages`
1616

pkg/lib/cmd/bpm.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ shopt -s nullglob extglob
55

66
main() {
77
: "${BPM_ROOT:="${XDG_DATA_HOME:-$HOME/.local/share}/bpm"}"
8-
: "${BPM_PREFIX:="$BPM_ROOT/cellar"}"
9-
: "${BPM_PACKAGES_PATH:="$BPM_PREFIX/packages"}"
10-
: "${BPM_INSTALL_BIN:="$BPM_PREFIX/bin"}"
11-
: "${BPM_INSTALL_MAN:="$BPM_PREFIX/man"}"
12-
: "${BPM_INSTALL_COMPLETIONS:="$BPM_PREFIX/completions"}"
8+
: "${BPM_CELLAR:="$BPM_ROOT/cellar"}"
9+
: "${BPM_PACKAGES_PATH:="$BPM_CELLAR/packages"}"
10+
: "${BPM_INSTALL_BIN:="$BPM_CELLAR/bin"}"
11+
: "${BPM_INSTALL_MAN:="$BPM_CELLAR/man"}"
12+
: "${BPM_INSTALL_COMPLETIONS:="$BPM_CELLAR/completions"}"
1313

1414
for f in "$PROGRAM_LIB_DIR"/{commands,util}/?*.sh; do
1515
source "$f"

pkg/lib/commands/do-init.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo_bpm_variables_posix() {
55
# bpm variables
66
export BPM_ROOT="$BPM_ROOT"
77
export BPM_REPO_ROOT="$BPM_ROOT/source"
8-
export BPM_PREFIX="$BPM_PREFIX"
8+
export BPM_CELLAR="$BPM_CELLAR"
99
1010
EOF
1111
}
@@ -23,8 +23,8 @@ echo_bpm_include_posix() {
2323
echo_bpm_package_path_posix() {
2424
cat <<-"EOF"
2525
# bpm packages PATH
26-
if [ "${PATH#*$BPM_PREFIX/bin}" = "$PATH" ]; then
27-
export PATH="$BPM_PREFIX/bin:$PATH"
26+
if [ "${PATH#*$BPM_CELLAR/bin}" = "$PATH" ]; then
27+
export PATH="$BPM_CELLAR/bin:$PATH"
2828
fi
2929
3030
EOF
@@ -54,7 +54,7 @@ do-init() {
5454
# bpm variables
5555
set -gx BPM_ROOT $BPM_ROOT
5656
set -gx BPM_REPO_ROOT $BPM_ROOT/source
57-
set -gx BPM_PREFIX $BPM_PREFIX
57+
set -gx BPM_CELLAR $BPM_CELLAR
5858
5959
# bpm completion
6060
source \$BPM_REPO_ROOT/completions/bpm.fish
@@ -65,14 +65,14 @@ do-init() {
6565
end
6666
6767
# bpm packages PATH
68-
if not contains \$BPM_PREFIX/bin \$PATH
69-
set -gx PATH \$BPM_PREFIX/bin \$PATH
68+
if not contains \$BPM_CELLAR/bin \$PATH
69+
set -gx PATH \$BPM_CELLAR/bin \$PATH
7070
end
7171
7272
# bpm packages completions
7373
# set -gx fish_complete_path \$fish_complete_path
74-
if [ -d \$BPM_PREFIX/completions/fish ]
75-
for f in \$BPM_PREFIX/completions/fish/?*.fish
74+
if [ -d \$BPM_CELLAR/completions/fish ]
75+
for f in \$BPM_CELLAR/completions/fish/?*.fish
7676
source \$f
7777
end
7878
end
@@ -92,8 +92,8 @@ do-init() {
9292
echo_bpm_package_path_posix
9393
cat <<-"EOF"
9494
# bpm packages completions
95-
if [ -d "$BPM_PREFIX/completions/bash" ]; then
96-
for f in "$BPM_PREFIX"/completions/bash/*; do
95+
if [ -d "$BPM_CELLAR/completions/bash" ]; then
96+
for f in "$BPM_CELLAR"/completions/bash/*; do
9797
source "$f"
9898
done
9999
unset f
@@ -113,9 +113,9 @@ do-init() {
113113
echo_bpm_package_path_posix
114114
cat <<-"EOF"
115115
# bpm packages completions
116-
fpath=("$BPM_PREFIX/completions/zsh/compsys" $fpath)
117-
if [ -d "$BPM_PREFIX/completions/zsh/compctl" ]; then
118-
for f in "$BPM_PREFIX"/completions/zsh/compctl/*; do
116+
fpath=("$BPM_CELLAR/completions/zsh/compsys" $fpath)
117+
if [ -d "$BPM_CELLAR/completions/zsh/compctl" ]; then
118+
for f in "$BPM_CELLAR"/completions/zsh/compctl/*; do
119119
source "$f"
120120
done
121121
unset f

pkg/lib/util/util.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ util.setup_mode() {
278278
fi
279279

280280
BPM_ROOT="$project_root_dir"
281-
BPM_PREFIX="$project_root_dir/bpm_packages"
282-
BPM_PACKAGES_PATH="$BPM_PREFIX/packages"
283-
BPM_INSTALL_BIN="$BPM_PREFIX/bin"
284-
BPM_INSTALL_MAN="$BPM_PREFIX/man"
285-
BPM_INSTALL_COMPLETIONS="$BPM_PREFIX/completions"
281+
BPM_CELLAR="$project_root_dir/bpm_packages"
282+
BPM_PACKAGES_PATH="$BPM_CELLAR/packages"
283+
BPM_INSTALL_BIN="$BPM_CELLAR/bin"
284+
BPM_INSTALL_MAN="$BPM_CELLAR/man"
285+
BPM_INSTALL_COMPLETIONS="$BPM_CELLAR/completions"
286286
else
287287
die "No 'bpm.toml' file found"
288288
fi

pkg/share/include.fish

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ function include
33
set package $argv[1]
44
set file $argv[2]
55

6-
if [ -z $BPM_PREFIX ]
7-
printf "%s\n" "Error: 'BPM_PREFIX' is empty" >&2
6+
if [ -z $BPM_CELLAR ]
7+
printf "%s\n" "Error: 'BPM_CELLAR' is empty" >&2
88
return 1
99
end
1010

@@ -13,15 +13,15 @@ function include
1313
return 1
1414
end
1515

16-
if [ ! -d $BPM_PREFIX/packages/$package ]
16+
if [ ! -d $BPM_CELLAR/packages/$package ]
1717
printf "%s\n" "Error: Package '$package' not installed" >&2
1818
return 1
1919
end
2020

21-
if [ ! -f $BPM_PREFIX/packages/$package/$file ]
22-
printf "%s\n" "Error: File '$BPM_PREFIX/packages/$package/$file' not found" >&2
21+
if [ ! -f $BPM_CELLAR/packages/$package/$file ]
22+
printf "%s\n" "Error: File '$BPM_CELLAR/packages/$package/$file' not found" >&2
2323
return 1
2424
end
2525

26-
source "$BPM_PREFIX/packages/$package/$file" >&2
26+
source "$BPM_CELLAR/packages/$package/$file" >&2
2727
end

pkg/share/include.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ include() {
44
package="$1"
55
file="$2"
66

7-
if [ -z "$BPM_PREFIX" ]; then
8-
printf "%s\n" "Error: 'BPM_PREFIX' is empty" >&2
7+
if [ -z "$BPM_CELLAR" ]; then
8+
printf "%s\n" "Error: 'BPM_CELLAR' is empty" >&2
99
return 1
1010
fi
1111

@@ -14,17 +14,17 @@ include() {
1414
return 1
1515
fi
1616

17-
if [ ! -d "$BPM_PREFIX/packages/$package" ]; then
17+
if [ ! -d "$BPM_CELLAR/packages/$package" ]; then
1818
printf "%s\n" "Error: Package '$package' not installed" >&2
1919
return 1
2020
fi
2121

22-
if [ ! -f "$BPM_PREFIX/packages/$package/$file" ]; then
23-
printf "%s\n" "Error: File '$BPM_PREFIX/packages/$package/$file' not found" >&2
22+
if [ ! -f "$BPM_CELLAR/packages/$package/$file" ]; then
23+
printf "%s\n" "Error: File '$BPM_CELLAR/packages/$package/$file' not found" >&2
2424
return 1
2525
fi
2626

27-
. "$BPM_PREFIX/packages/$package/$file" >&2
27+
. "$BPM_CELLAR/packages/$package/$file" >&2
2828

2929
unset package file
3030
}

tests/do-echo.bats

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ load 'util/init.sh'
1212
assert_output "/tmp/bpm"
1313
}
1414

15-
@test "default BPM_PREFIX" {
16-
BPM_ROOT= BPM_PREFIX= run bpm --global echo BPM_PREFIX
15+
@test "default BPM_CELLAR" {
16+
BPM_ROOT= BPM_CELLAR= run bpm --global echo BPM_CELLAR
1717
assert_output "$HOME/.local/share/bpm/cellar"
1818
}
1919

20-
@test "inherited BPM_PREFIX" {
21-
BPM_PREFIX=/usr/local run bpm --global echo BPM_PREFIX
20+
@test "inherited BPM_CELLAR" {
21+
BPM_CELLAR=/usr/local run bpm --global echo BPM_CELLAR
2222
assert_output "/usr/local"
2323
}
2424

25-
@test "BPM_PREFIX based on BPM_ROOT" {
26-
BPM_ROOT=/tmp/bpm BPM_PREFIX= run bpm --global echo BPM_PREFIX
25+
@test "BPM_CELLAR based on BPM_ROOT" {
26+
BPM_ROOT=/tmp/bpm BPM_CELLAR= run bpm --global echo BPM_CELLAR
2727
assert_output "/tmp/bpm/cellar"
2828
}
2929

@@ -32,13 +32,13 @@ load 'util/init.sh'
3232
assert_output "/usr/local/packages"
3333
}
3434

35-
@test "BPM_PACKAGES_PATH based on BPM_PREFIX" {
36-
BPM_PREFIX=/tmp/bpm BPM_PACKAGES_PATH= run bpm --global echo BPM_PACKAGES_PATH
35+
@test "BPM_PACKAGES_PATH based on BPM_CELLAR" {
36+
BPM_CELLAR=/tmp/bpm BPM_PACKAGES_PATH= run bpm --global echo BPM_PACKAGES_PATH
3737
assert_output "/tmp/bpm/packages"
3838
}
3939

4040
@test "default BPM_INSTALL_BIN" {
41-
BPM_ROOT= BPM_PREFIX= BPM_INSTALL_BIN= run bpm --global echo BPM_INSTALL_BIN
41+
BPM_ROOT= BPM_CELLAR= BPM_INSTALL_BIN= run bpm --global echo BPM_INSTALL_BIN
4242
assert_output "$HOME/.local/share/bpm/cellar/bin"
4343
}
4444

@@ -47,13 +47,13 @@ load 'util/init.sh'
4747
assert_output "/opt/bin"
4848
}
4949

50-
@test "BPM_INSTALL_BIN based on BPM_PREFIX" {
51-
BPM_INSTALL_BIN= BPM_ROOT=/tmp/bpm BPM_PREFIX=/usr/local run bpm --global echo BPM_INSTALL_BIN
50+
@test "BPM_INSTALL_BIN based on BPM_CELLAR" {
51+
BPM_INSTALL_BIN= BPM_ROOT=/tmp/bpm BPM_CELLAR=/usr/local run bpm --global echo BPM_INSTALL_BIN
5252
assert_output "/usr/local/bin"
5353
}
5454

5555
@test "default BPM_INSTALL_MAN" {
56-
BPM_ROOT= BPM_PREFIX= BPM_INSTALL_MAN= run bpm --global echo BPM_INSTALL_MAN
56+
BPM_ROOT= BPM_CELLAR= BPM_INSTALL_MAN= run bpm --global echo BPM_INSTALL_MAN
5757
assert_output "$HOME/.local/share/bpm/cellar/man"
5858
}
5959

@@ -62,13 +62,13 @@ load 'util/init.sh'
6262
assert_output "/opt/man"
6363
}
6464

65-
@test "BPM_INSTALL_MAN based on BPM_PREFIX" {
66-
BPM_INSTALL_MAN= BPM_PREFIX=/usr/local run bpm --global echo BPM_INSTALL_MAN
65+
@test "BPM_INSTALL_MAN based on BPM_CELLAR" {
66+
BPM_INSTALL_MAN= BPM_CELLAR=/usr/local run bpm --global echo BPM_INSTALL_MAN
6767
assert_output "/usr/local/man"
6868
}
6969

7070
@test "default BPM_INSTALL_COMPLETIONS" {
71-
BPM_ROOT= BPM_PREFIX= BPM_INSTALL_COMPLETIONS= run bpm --global echo BPM_INSTALL_COMPLETIONS
71+
BPM_ROOT= BPM_CELLAR= BPM_INSTALL_COMPLETIONS= run bpm --global echo BPM_INSTALL_COMPLETIONS
7272
assert_output "$HOME/.local/share/bpm/cellar/completions"
7373
}
7474

@@ -77,8 +77,8 @@ load 'util/init.sh'
7777
assert_output "/opt/completions"
7878
}
7979

80-
@test "BPM_INSTALL_COMPLETIONS based on BPM_PREFIX" {
81-
BPM_INSTALL_COMPLETIONS= BPM_PREFIX=/usr/local run bpm --global echo BPM_INSTALL_COMPLETIONS
80+
@test "BPM_INSTALL_COMPLETIONS based on BPM_CELLAR" {
81+
BPM_INSTALL_COMPLETIONS= BPM_CELLAR=/usr/local run bpm --global echo BPM_INSTALL_COMPLETIONS
8282
assert_output "/usr/local/completions"
8383
}
8484

@@ -91,10 +91,10 @@ load 'util/init.sh'
9191
assert_line -p "$PWD"
9292
}
9393

94-
@test "non-global default BPM_PREFIX" {
94+
@test "non-global default BPM_CELLAR" {
9595
touch 'bpm.toml'
9696

97-
BPM_ROOT= BPM_PREFIX= run bpm echo BPM_PREFIX
97+
BPM_ROOT= BPM_CELLAR= run bpm echo BPM_CELLAR
9898

9999
assert_success
100100
assert_line -p "$PWD/bpm_packages"

0 commit comments

Comments
 (0)