diff --git a/Rakefile b/Rakefile index 814145d..065ef1c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ require "rake/clean" -CLEAN.include("gem") -CLOBBER.include("target", "avvoenv.1") +CLEAN.include("gem", "avvoenv") +CLOBBER.include("target", "avvoenv.1", "avvoenv-mac.zip", "avvoenv-linux.tar.gz") task default: [:"build:default", :man] namespace :build do @@ -9,6 +9,17 @@ namespace :build do end task man: "avvoenv.1" +# assumes you're building on a mac +task release: [:"build:default", :"build:linux", :man] do |t| + `mkdir -p avvoenv` + `cp target/release/avvoenv avvoenv` + `cp avvoenv.1 avvoenv` + `cp install.sh avvoenv` + `zip -r avvoenv-mac.zip avvoenv` + `cp target/x86_64-unknown-linux-musl/release/avvoenv avvoenv` + `tar -czf avvoenv-linux.tar.gz avvoenv` +end + task install: [:"build:default", :man] do |t| prefix = ENV["PREFIX"] || "." `mkdir -p #{prefix}/bin` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..eafc6ad --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +PREFIX=${@:-/usr/local} +DIR=$(cd $(dirname $0) && pwd) + +mkdir -p "$PREFIX/bin" +cp "$DIR/avvoenv" "$PREFIX/bin" + +mkdir -p "$PREFIX/share/man/man1" +cp "$DIR/avvoenv.1" "$PREFIX/share/man/man1" + +if [ command -v mandb >/dev/null 2>&1 ]; then + mandb +fi