Skip to content

Commit

Permalink
app/resource: auto-apply path tweaks when loading helpers for app usi…
Browse files Browse the repository at this point in the history
…ng the nodejs/ruby/go resource
  • Loading branch information
alexAubin committed Mar 9, 2025
1 parent 4a1d5f4 commit adda31a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 8 additions & 2 deletions helpers/helpers.v2.1.d/go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ _ynh_load_go_in_path_and_other_tweaks() {
PATH_with_go="$PATH"

# Sets the local application-specific go version
pushd "$install_dir"
$GOENV_INSTALL_DIR/bin/goenv local "$go_version"
pushd "${install_dir}"
"$GOENV_ROOT/bin/goenv" local "$go_version"
popd
}

# Auto-load Nodejs path tweaks if this app uses the nodejs resource in the manifest
if [ -n "${go_version:-}" ] && (cat "$YNH_APP_BASEDIR/manifest.toml" | toml_to_json | jq -q ".resources.go" >/dev/null)
then
_ynh_load_go_in_path_and_other_tweaks
fi

# Install a specific version of Go using goenv
#
# The installed version is defined by `$go_version` which should be defined as global prior to calling this helper
Expand Down
7 changes: 7 additions & 0 deletions helpers/helpers.v2.1.d/nodejs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ _ynh_load_nodejs_in_path_and_other_tweaks() {
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
}

# Auto-load Nodejs path tweaks if this app uses the nodejs resource in the manifest
if [ -n "${nodejs_version:-}" ] && (cat "$YNH_APP_BASEDIR/manifest.toml" | toml_to_json | jq -q ".resources.nodejs" >/dev/null)
then
_ynh_load_nodejs_in_path_and_other_tweaks
fi


# Install a specific version of nodejs, using 'n'
#
# The installed version is defined by `$nodejs_version` which should be defined as global prior to calling this helper
Expand Down
10 changes: 8 additions & 2 deletions helpers/helpers.v2.1.d/ruby
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ _ynh_load_ruby_in_path_and_other_tweaks() {
PATH_with_ruby="$PATH"

# Sets the local application-specific Ruby version
pushd "$install_dir"
$RBENV_ROOT/bin/rbenv local "$ruby_version"
pushd "${install_dir}"
"$RBENV_ROOT/bin/rbenv" local "$ruby_version"
popd
}

# Auto-load Ruby path tweaks if this app uses the ruby resource in the manifest
if [ -n "${ruby_version:-}" ] && (cat "$YNH_APP_BASEDIR/manifest.toml" | toml_to_json | jq -q ".resources.ruby" >/dev/null)
then
_ynh_load_ruby_in_path_and_other_tweaks
fi

# Install a specific version of Ruby using rbenv
#
# The installed version is defined by `$ruby_version` which should be defined as global prior to calling this helper
Expand Down

0 comments on commit adda31a

Please sign in to comment.