Skip to content

Commit

Permalink
1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Nov 24, 2019
1 parent fe66234 commit 2f22969
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
31 changes: 31 additions & 0 deletions amm-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env sh

# This is a wrapper script, that automatically download ammonite from GitHub release pages
# You can give the required mill version with AMM_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_AMM_VERSION
DEFAULT_AMM_VERSION=

set -e

if [ -z "$AMM_VERSION" ] ; then
AMM_VERSION=$DEFAULT_AMM_VERSION
fi

AMM_DOWNLOAD_PATH="$HOME/.ammonite/download"
AMM_EXEC_PATH="${AMM_DOWNLOAD_PATH}/$AMM_VERSION"

if [ ! -x "$AMM_EXEC_PATH" ] ; then
mkdir -p $AMM_DOWNLOAD_PATH
DOWNLOAD_FILE=$AMM_EXEC_PATH-tmp-download
AMM_DOWNLOAD_URL="https://github.com/lihaoyi/ammonite/releases/download/${AMM_VERSION%%-*}/2.13-$AMM_VERSION"
curl --fail -L -o "$DOWNLOAD_FILE" "$AMM_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$AMM_EXEC_PATH"
unset DOWNLOAD_FILE
unset AMM_DOWNLOAD_URL
fi

unset AMM_DOWNLOAD_PATH
unset AMM_VERSION

exec $AMM_EXEC_PATH "$@"
9 changes: 9 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,15 @@ def publishExecutable() = {
s"$scalaBinaryVersion-$buildVersion",
sys.env("AMMONITE_BOT_AUTH_TOKEN")
)
upload(
os.temp(
os.read(os.pwd / "amm-template.sh")
.replace("DEFAULT_AMM_VERSION=", s"DEFAULT_AMM_VERSION=$latestTaggedVersion")
),
latestTaggedVersion,
s"$scalaBinaryVersion-$buildVersion-bootstrap",
sys.env("AMMONITE_BOT_AUTH_TOKEN")
)
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions readme/Footer.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@


@sect{Changelog}
@sect{1.8.2}
@ul
@li
Started publishing bootstrap scripts, that can be easily committed to version
control and download/launch Ammonite via `./amm`

@sect{1.8.1}
@ul
@li
Expand Down
10 changes: 10 additions & 0 deletions readme/Repl.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
@hl.sh
$ brew install ammonite-repl

@p
You can also download a bootstrap script, that can be downloaded and committed
to version control as a file `amm`:

@hl.sh
curl -L https://github.com/lihaoyi/ammonite/releases/download/@ammonite.Constants.version/2.13-@ammonite.Constants.version-boostrap > amm && chmod +x amm

@p
You can then run Ammonite via the `./amm` command.

@p
This will give you access to the Ammonite-REPL:

Expand Down

0 comments on commit 2f22969

Please sign in to comment.