File tree Expand file tree Collapse file tree 8 files changed +37
-12
lines changed Expand file tree Collapse file tree 8 files changed +37
-12
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,17 @@ do-add() {
32
32
esac
33
33
done
34
34
35
+ if [[ " $BPM_IS_LOCAL " == no && " $flag_all " == yes ]]; then
36
+ die " Cannot pass '--all' without a 'bpm.toml' file"
37
+ fi
38
+
35
39
if [ " $flag_all " = yes ]; then
36
40
local bpm_toml_file=" $BPM_ROOT /bpm.toml"
37
41
38
42
if (( ${# pkgs[@]} > 0 )) ; then
39
43
die " No packages may be supplied when using '--all'"
40
44
fi
41
45
42
- # TODO: this may be ran under 'global' mode?
43
46
if util.get_toml_array " $bpm_toml_file " ' dependencies' ; then
44
47
log.info " Adding all dependencies"
45
48
@@ -88,7 +91,6 @@ do-actual-add() {
88
91
do-plumbing-link-completions " $site /$package "
89
92
do-plumbing-link-man " $site /$package "
90
93
91
- # TODO: install for packages.sh
92
94
# Install transitive dependencies
93
95
local subDep=" $BPM_PACKAGES_PATH /$site /$package "
94
96
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ do-plumbing-clone() {
9
9
ensure.non_zero ' uri' " $uri "
10
10
ensure.non_zero ' id' " $id "
11
11
12
- # TODO this is invalid in the test suite
13
12
if [ -e " $BPM_PACKAGES_PATH /$id " ]; then
14
13
die " Package '$id ' is already present"
15
14
fi
Original file line number Diff line number Diff line change @@ -24,10 +24,14 @@ do-upgrade() {
24
24
esac
25
25
done
26
26
27
- if [[ $upgrade_bpm = yes && $flag_all = yes ]]; then
27
+ if [[ $upgrade_bpm == yes && " $flag_all " = yes ]]; then
28
28
die " Upgrading bpm and using '--all' are mutually exclusive behaviors"
29
29
fi
30
30
31
+ if [[ $upgrade_bpm == yes && " $BPM_IS_LOCAL " == yes ]]; then
32
+ die " Cannot upgrade bpm with a local 'bpm.toml' file"
33
+ fi
34
+
31
35
if [ " $upgrade_bpm " = ' yes' ]; then
32
36
if (( ${# pkgs[@]} > 0 )) ; then
33
37
die ' Packages cannot be upgraded at the same time as bpm'
Original file line number Diff line number Diff line change @@ -163,9 +163,8 @@ abstract.completions_do_action_zsh() {
163
163
fi
164
164
165
165
case " $action " in
166
- link)
166
+ link)
167
167
if [ -L " $BPM_INSTALL_COMPLETIONS /zsh/compsys/$fileName " ]; then
168
- # TODO: ?
169
168
log.error " Skipping '$fileName ' since an existing symlink with the same name already exists"
170
169
else
171
170
mkdir -p " $BPM_INSTALL_COMPLETIONS /zsh/compsys"
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ load 'util/init.sh'
28
28
assert_line -n 0 -p " Cannot install packages owned by username 'local' because that conflicts with linked packages"
29
29
}
30
30
31
- # TODO: do for link
32
31
@test " fails when input is an absolute path to a directory" {
33
32
local site=' github.com'
34
33
local pkg=' username/main'
@@ -289,7 +288,7 @@ load 'util/init.sh'
289
288
@test " --all prints warning when no dependencies are specified in bpm.toml" {
290
289
touch ' bpm.toml'
291
290
292
- run do-add --all
291
+ BPM_IS_LOCAL= ' yes ' run do-add --all
293
292
294
293
assert_success
295
294
assert_line -p " No dependencies specified in 'dependencies' key"
@@ -299,8 +298,15 @@ load 'util/init.sh'
299
298
@test " --all errors when a package is specified as argument" {
300
299
touch ' bpm.toml'
301
300
302
- run do-add --all pkg
301
+ BPM_IS_LOCAL= ' yes ' run do-add --all pkg
303
302
304
303
assert_failure
305
304
assert_line -p " No packages may be supplied when using '--all'"
306
305
}
306
+
307
+ @test " --all errors in global mode" {
308
+ run do-add --all
309
+
310
+ assert_failure
311
+ assert_line -p " Cannot pass '--all' without a 'bpm.toml' file"
312
+ }
Original file line number Diff line number Diff line change 2
2
3
3
load ' util/init.sh'
4
4
5
- # TODO: replace output checking with actual cloning using file://
6
-
7
5
@test " installs a specific version" {
8
6
local site=' github.com'
9
7
local pkg=' username/package'
@@ -129,3 +127,10 @@ load 'util/init.sh'
129
127
assert_success
130
128
assert_line -n 1 " git clone --recursive --depth=1 --single-branch --branch a_branch https://github.com/username/package.git $BPM_PACKAGES_PATH /$site /username/package"
131
129
}
130
+
131
+ @test " --all errors in global mode" {
132
+ run do-add --all
133
+
134
+ assert_failure
135
+ assert_line -p " Cannot pass '--all' without a 'bpm.toml' file"
136
+ }
Original file line number Diff line number Diff line change @@ -189,10 +189,19 @@ load 'util/init.sh'
189
189
assert_line -p " Upgrading bpm and using '--all' are mutually exclusive behaviors"
190
190
}
191
191
192
+ @test " fail if bpm is specified in local mode" {
193
+ touch ' bpm.toml'
194
+
195
+ BPM_IS_LOCAL=' yes' run do-upgrade bpm
196
+
197
+ assert_failure
198
+ assert_line -p " Cannot upgrade bpm with a local 'bpm.toml' file"
199
+ }
200
+
192
201
@test " --all errors when a package is specified as argument" {
193
202
touch ' bpm.toml'
194
203
195
- run do-remove --all pkg
204
+ run do-upgrade --all some/ pkg
196
205
197
206
assert_failure
198
207
assert_line -p " No packages may be supplied when using '--all'"
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export BPM_TEST_DIR="$BATS_TMPDIR/bpm"
17
17
export BPM_CWD=" $BPM_TEST_DIR /cwd"
18
18
export BPM_ORIGIN_DIR=" $BPM_TEST_DIR /origin"
19
19
export BPM_MODE_TEST=
20
+ export BPM_IS_LOCAL=' no' # normal default is 'yes'
20
21
21
22
# Stub common variables
22
23
test_util.get_bpm_root
You can’t perform that action at this time.
0 commit comments