Skip to content

Commit eeefad9

Browse files
committed
fix: Small changes
1 parent c5ecd65 commit eeefad9

File tree

4 files changed

+41
-28
lines changed

4 files changed

+41
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ There is a small, but growing number of packages installable with Basalt. See th
5454

5555
## License
5656

57-
Original code is licensed under MIT by Juan Ibiapina. Modifications are licensed under BSD 3-Clause by Edwin Kofler
57+
Original code is licensed under `MIT` by Juan Ibiapina. Modifications are licensed under `BSD-3-Clause` by Edwin Kofler

pkg/lib/public/basalt-package.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,29 @@ basalt.package-load() {
1818
shopt -s nullglob
1919

2020
local __basalt_site= __basalt_repository_owner= __basalt_package=
21-
for __basalt_site in "$BASALT_PACKAGE_PATH"/.basalt/packages/*; do
22-
for __basalt_repository_owner in "$__basalt_site"/*; do
23-
for __basalt_package in "$__basalt_repository_owner"/*; do
24-
if [ "$__basalt_shopt_nullglob" = 'yes' ]; then
25-
shopt -s nullglob
26-
else
27-
shopt -u nullglob
28-
fi
29-
30-
if [ -f "$__basalt_package/.basalt/generated/source-package.sh" ]; then
31-
source "$__basalt_package/.basalt/generated/source-package.sh"
32-
fi
21+
if [ -d "$BASALT_PACKAGE_PATH"/.basalt/packages ]; then
22+
for __basalt_site in "$BASALT_PACKAGE_PATH"/.basalt/packages/*/; do
23+
for __basalt_repository_owner in "$__basalt_site"/*/; do
24+
for __basalt_package in "$__basalt_repository_owner"/*/; do
25+
if [ "$__basalt_shopt_nullglob" = 'yes' ]; then
26+
shopt -s nullglob
27+
else
28+
shopt -u nullglob
29+
fi
30+
31+
if [ -f "$__basalt_package.basalt/generated/source_package.sh" ]; then
32+
source "$__basalt_package.basalt/generated/source_package.sh"
33+
fi
3334

34-
shopt -s nullglob
35+
shopt -s nullglob
36+
done
3537
done
3638
done
37-
done
39+
fi
3840
unset __basalt_site __basalt_repository_owner __basalt_package
3941

40-
if [ -f "$BASALT_PACKAGE_PATH/.basalt/generated/source-package.sh" ]; then
41-
source "$BASALT_PACKAGE_PATH/.basalt/generated/source-package.sh"
42+
if [ -f "$BASALT_PACKAGE_PATH/.basalt/generated/source_package.sh" ]; then
43+
source "$BASALT_PACKAGE_PATH/.basalt/generated/source_package.sh"
4244
fi
4345

4446
if [ "$__basalt_shopt_nullglob" = 'yes' ]; then

pkg/lib/util/pkg.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ pkg.install_package() {
5252
fi
5353

5454
# Only after all the dependencies are installed do we muck with the package
55-
pkg.phase_global-integration "$package_id"
55+
pkg.phase_global_integration "$package_id"
5656
done
5757
unset pkg
5858

5959
# Only if all the previous modifications to the global package store has been successfull
6060
# do we muck with the current local project
61-
pkg.phase_local-integration "$project_dir" 'yes' "$symlink_mode" "$@"
62-
pkg.phase_local-generate-scripts "$project_dir"
61+
pkg.phase_local_integration "$project_dir" 'yes' "$symlink_mode" "$@"
62+
pkg.phase_local_generate-scripts "$project_dir"
6363
}
6464

6565
# @description Downloads package tarballs from the internet to the global store. If a git revision is specified, it
@@ -172,7 +172,7 @@ pkg.phase_extract_tarball() {
172172

173173
# TODO: properly cache transformations
174174
# @description This performs modifications a particular package in the global store
175-
pkg.phase_global-integration() {
175+
pkg.phase_global_integration() {
176176
local package_id="$1"
177177
ensure.nonzero 'package_id'
178178

@@ -186,16 +186,16 @@ pkg.phase_global-integration() {
186186
if [ -f "$project_dir/basalt.toml" ]; then
187187
# Install dependencies
188188
if util.get_toml_array "$project_dir/basalt.toml" 'dependencies'; then
189-
pkg.phase_local-integration "$project_dir" 'yes' 'strict' "${REPLIES[@]}"
190-
pkg.phase_local-generate-scripts "$project_dir"
189+
pkg.phase_local_integration "$project_dir" 'yes' 'strict' "${REPLIES[@]}"
190+
pkg.phase_local_generate-scripts "$project_dir"
191191
fi
192192
fi
193193

194194
print.indent-green "Transformed" "$package_id"
195195
}
196196

197197
# Create a './.basalt' directory for a particular project directory
198-
pkg.phase_local-integration() {
198+
pkg.phase_local_integration() {
199199
unset REPLY; REPLY=
200200
local original_package_dir="$1"
201201
local is_direct="$2" # Whether the "$package_dir" dependency is a direct or transitive dependency of "$original_package_dir"
@@ -247,15 +247,15 @@ pkg.phase_local-integration() {
247247
ensure.dir "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id"
248248
if [ -f "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id/basalt.toml" ]; then
249249
if util.get_toml_array "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id/basalt.toml" 'dependencies'; then
250-
pkg.phase_local-integration "$original_package_dir" 'no' 'strict' "${REPLIES[@]}"
250+
pkg.phase_local_integration "$original_package_dir" 'no' 'strict' "${REPLIES[@]}"
251251
fi
252252
fi
253253
done
254254
unset pkg
255255
}
256256

257257
# @description Generate scripts for './.basalt/generated' directory
258-
pkg.phase_local-generate-scripts() {
258+
pkg.phase_local_generate-scripts() {
259259
local project_dir="$1"
260260
local mode="$2"
261261

@@ -269,8 +269,11 @@ pkg.phase_local-generate-scripts() {
269269
for source_dir in "${REPLIES[@]}"; do
270270
# TODO: use BASALT_GLOBAL_DATA_DIR
271271
printf -v content '%s%s\n' "$content" "for __basalt_f in \"$project_dir/$source_dir\"/*; do
272-
source \"\$__basalt_f\"
273-
done"
272+
if [ -f \"\$__basalt_f\" ]; then
273+
source \"\$__basalt_f\"
274+
fi
275+
done
276+
"
274277
done
275278
unset source_dir
276279

tests/pkg-phase-download-tarball.bats

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
# shellcheck shell=bash
2+
3+
load './util/init.sh'
4+
5+
@test "Fails for invalid repository" {
6+
skip
7+
8+
pkg.phase_download_tarball 'remote' 'https://github.com/hyperupcall/bash-object.git' 'github.com' 'hyperupcall/bash-object' 'v0.3.0'
9+
}

0 commit comments

Comments
 (0)