Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
winks committed Feb 15, 2019
0 parents commit f1f86dc
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Leiningen packaging for sdkman.io

## Prerequisites

* A Leiningen release (online)
* wget
* zip
* sdkman credentials

## Packaging

```
./package.sh VERSION BUILD_DIR
```

* `BUILD_DIR needs to be empty`
* this yields a `zip` file in `BUILD_DIR/out/`

## Uploading

* Release this zip file in the `leiningen/leiningen-sdkman` repo and jot down the URL

## Releasing

```
export CONSUMER_KEY=x
export CONSUMER_TOKEN=y
./release.sh VERSION
```
47 changes: 47 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

if [ "$1" = "" -o "$2" = "" ]; then
echo "Usage: $0 VERSION BUILD_DIR"
exit
fi

VERSION="$1"
BUILD_DIR="$2"
SUB_DIR="leiningen-${VERSION}"
OUT_DIR="out"

test -d "$BUILD_DIR" && {
echo "The build dir ${BUILD_DIR} exists, choose a different dir."
exit 1
}

echo "Packaging Leiningen ${VERSION} for SDKMAN in ${BUILD_DIR} ..."

mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"

test -d "$SUB_DIR" || mkdir -p "$SUB_DIR"
cd "$SUB_DIR"

mkdir bin
cd bin

wget "https://raw.githubusercontent.com/technomancy/leiningen/${VERSION}/bin/lein-sdkman" -O "lein"
wget "https://raw.githubusercontent.com/technomancy/leiningen/${VERSION}/bin/lein.bat" -O "lein.bat"

cd ..
mkdir lib
cd lib

wget "https://github.com/technomancy/leiningen/releases/download/${VERSION}/leiningen-${VERSION}-standalone.zip" -O "leiningen-${VERSION}-standalone.jar"

cd ../..
test -d "$OUT_DIR" || mkdir -p "$OUT_DIR"

FILE_NAME="${OUT_DIR}/${SUB_DIR}.zip"

zip "FILE_NAME" "$SUB_DIR"

echo "Leiningen ${VERSION} was packaged to ${FILE_NAME}"


17 changes: 17 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo "Usage: $0 VERSION"
exit
fi

VERSION="$1"
URL="https://github.com/leiningen/leiningen-sdkman/releases/download/${VERSION}/leiningen-${VERSION}.zip"

curl -X POST \
-H "Consumer-Key: ${CONSUMER_KEY}" \
-H "Consumer-Token: ${CONSUMER_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "{\"candidate\": \"leiningen\", \"version\": \"${VERSION}\", \"url\": \"${URL}\"}" \
https://vendors.sdkman.io/release

0 comments on commit f1f86dc

Please sign in to comment.