Skip to content

Commit

Permalink
New package: volta-0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lohr authored and Alex Lohr committed Feb 3, 2020
1 parent 613c9ca commit 84ed616
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
27 changes: 27 additions & 0 deletions srcpkgs/volta/files/install.sh
@@ -0,0 +1,27 @@
createDir() {
if [ ! -d "$1" ]; then
mkdir "$1"
fi
}

installProfile() {
if [ -e "$1" ]; then
isInstalled=$(grep "$2" "$1")
if [ -z "$isInstalled" ]; then
echo "" >> "$1"
echo "export VOLTA_HOME=\"$HOME/.volta\"" >> "$1"
echo "export PATH=\"$HOME/.volta/bin:\$PATH\"" >> "$1"
echo "source $2" >> "$1"
fi
fi
}

# Create directories
createDir "$HOME/.volta"
createDir "$HOME/.volta/bin"

# Install profile
installProfile "$HOME/.bashrc" "/etc/volta/load.bash"
installProfile "$HOME/.cshrc" "/etc/volta/load.sh"
installProfile "$HOME/.config/fish/config.fish" "/etc/volta/load.fish"
installProfile "$HOME/.zshrc" "/etc/volta/load.sh"
33 changes: 33 additions & 0 deletions srcpkgs/volta/patches/bindir.patch
@@ -0,0 +1,33 @@
--- shell/unix/load.bash
+++ shell/unix/load.bash
@@ -75,7 +75,7 @@ volta() {
export VOLTA_POSTSCRIPT="${VOLTA_ROOT}/tmp/volta_tmp_$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ").sh"

# Forward the arguments to the Volta executable.
- VOLTA_SHELL=bash command "${VOLTA_ROOT}/volta" "$@"
+ VOLTA_SHELL=bash command volta "$@"
EXIT_CODE=$?

# Call the post-invocation script if it is present, then delete it.
--- shell/unix/load.fish
+++ shell/unix/load.fish
@@ -11,7 +11,7 @@ function volta
set -x VOLTA_POSTSCRIPT "$VOLTA_ROOT/tmp/volta_tmp_"(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")".fish"

# Forward the arguments to the Volta executable.
- env VOLTA_SHELL=fish "$VOLTA_ROOT/volta" $argv
+ env VOLTA_SHELL=fish volta $argv
set EXIT_CODE $status

# Call the post-invocation script if it is present, then delete it.
--- shell/unix/load.sh
+++ shell/unix/load.sh
@@ -10,7 +10,7 @@ volta() {
export VOLTA_POSTSCRIPT="${VOLTA_ROOT}/tmp/volta_tmp_$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ").sh"

# Forward the arguments to the Volta executable.
- VOLTA_SHELL=bash command "${VOLTA_ROOT}/volta" "$@"
+ VOLTA_SHELL=bash command volta "$@"
EXIT_CODE=$?

# Call the post-invocation script if it is present, then delete it.
36 changes: 36 additions & 0 deletions srcpkgs/volta/template
@@ -0,0 +1,36 @@
# Template file for 'volta'
pkgname=volta
version=0.7.1
revision=1
archs="x86_64 i686"
build_helper="rust"
hostmakedepends="cargo pkg-config"
makedepends="libressl-devel"
short_desc="JavaScript tool version sync helper"
maintainer="Alex Lohr <alex.lohr@logmein.com>"
license="BSD-2-Clause"
homepage="https://volta.sh/"
distfiles="https://github.com/volta-cli/${pkgname}/archive/v${version}.tar.gz"
checksum=e53a07e167bb64103f36901423f5a377a2ea89ecfdd7a1343e69d659f99f9c1b

pre_build() {
cargo update --package openssl-sys --precise 0.9.53
}

do_build() {
cargo build --release --target ${RUST_TARGET}
}

do_install() {
vlicense LICENSE

vbin target/${RUST_TARGET}/release/volta
vbin target/${RUST_TARGET}/release/volta-shim
vbin target/${RUST_TARGET}/release/volta-migrate

vmkdir etc/volta 755
vinstall shell/unix/load.bash 755 etc/volta
vinstall shell/unix/load.sh 755 etc/volta
vinstall shell/unix/load.fish 755 etc/volta
vinstall ${FILESDIR}/install.sh 755 etc/volta
}
2 changes: 2 additions & 0 deletions srcpkgs/volta/update
@@ -0,0 +1,2 @@
site="https://github.com/volta-cli/volta/releases"
pattern="\bv(\d+\.\d+\.\d+)\b"

0 comments on commit 84ed616

Please sign in to comment.