refactor: Improve herolib installation script
- Add script directory logging - Update organization name detection - Add symlink verification - Adjust herolib installation path logic
This commit is contained in:
@@ -44,8 +44,10 @@ fn addtoscript(tofind string, toadd string) ! {
|
||||
|
||||
abs_dir_of_script := dir(@FILE)
|
||||
|
||||
println('Script directory: ${abs_dir_of_script}')
|
||||
|
||||
// Determine the organization name from the current path
|
||||
// This makes the script work with any organization (incubaid, incubaid, etc.)
|
||||
// This makes the script work with any organization (incubaid, freeflowuniverse, etc.)
|
||||
path_parts := abs_dir_of_script.split('/')
|
||||
mut org_name := 'incubaid' // default fallback
|
||||
for i, part in path_parts {
|
||||
@@ -56,10 +58,11 @@ for i, part in path_parts {
|
||||
}
|
||||
|
||||
println('Detected organization: ${org_name}')
|
||||
println('Will create symlink: ${os.home_dir()}/.vmodules/${org_name}/herolib -> ${abs_dir_of_script}/lib')
|
||||
|
||||
// Reset symlinks for both possible organizations (cleanup)
|
||||
println('Resetting all symlinks...')
|
||||
os.rm('${os.home_dir()}/.vmodules/incubaid/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/incubaid/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/${org_name}/herolib') or {}
|
||||
|
||||
@@ -73,6 +76,18 @@ os.symlink('${abs_dir_of_script}/lib', '${os.home_dir()}/.vmodules/${org_name}/h
|
||||
panic('Failed to create herolib symlink: ${err}')
|
||||
}
|
||||
|
||||
// Verify the symlink was created
|
||||
symlink_path := '${os.home_dir()}/.vmodules/${org_name}/herolib'
|
||||
if os.exists(symlink_path) {
|
||||
println('✓ Symlink created successfully: ${symlink_path}')
|
||||
// Verify it points to the right location
|
||||
if os.is_link(symlink_path) {
|
||||
println('✓ Confirmed: ${symlink_path} is a symbolic link')
|
||||
}
|
||||
} else {
|
||||
panic('Failed to verify herolib symlink at ${symlink_path}')
|
||||
}
|
||||
|
||||
println('Herolib installation completed successfully!')
|
||||
|
||||
// Add vtest alias
|
||||
|
||||
11
install_v.sh
11
install_v.sh
@@ -635,8 +635,17 @@ fi
|
||||
check_and_start_redis
|
||||
|
||||
if [ "$HEROLIB" = true ]; then
|
||||
# Check if we're in GitHub Actions and already in the herolib directory
|
||||
if is_github_actions && [ -f "./install_herolib.vsh" ]; then
|
||||
echo "Running in GitHub Actions, using current directory for herolib installation"
|
||||
HEROLIB_DIR="$(pwd)"
|
||||
else
|
||||
hero_lib_get
|
||||
~/code/github/incubaid/herolib/install_herolib.vsh
|
||||
HEROLIB_DIR="$HOME/code/github/incubaid/herolib"
|
||||
fi
|
||||
|
||||
echo "Installing herolib from: $HEROLIB_DIR"
|
||||
"$HEROLIB_DIR/install_herolib.vsh"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user