|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
| 4 | +VERSION="1.0.0" |
| 5 | +INSTALL_DIR="$HOME/.library-insight" |
| 6 | +ZIP_NAME="library-insight-cli-$VERSION.zip" |
| 7 | +RELEASE_URL="https://github.com/Coding-Meet/Library-Insight/releases/download/v$VERSION/$ZIP_NAME" |
| 8 | + |
4 | 9 | echo "==================================================" |
5 | | -echo " Building Library Insight CLI Distribution..." |
| 10 | +echo " Installing Library Insight v$VERSION..." |
6 | 11 | echo "==================================================" |
7 | | -./gradlew :library-insight-cli:installDist |
8 | 12 |
|
9 | | -INSTALL_DIR="$HOME/.library-insight" |
10 | | -echo "Installing binaries into $INSTALL_DIR..." |
| 13 | +# Create install directory |
11 | 14 | mkdir -p "$INSTALL_DIR" |
12 | | -cp -R library-insight-cli/build/install/library-insight/* "$INSTALL_DIR/" |
| 15 | + |
| 16 | +# Temporary download path |
| 17 | +TEMP_ZIP="/tmp/$ZIP_NAME" |
| 18 | + |
| 19 | +echo "Attempting to download pre-compiled release from GitHub..." |
| 20 | +echo "URL: $RELEASE_URL" |
| 21 | + |
| 22 | +# Download using curl |
| 23 | +if curl -L --fail -o "$TEMP_ZIP" "$RELEASE_URL"; then |
| 24 | + echo "Download successful! Extracting..." |
| 25 | + unzip -o "$TEMP_ZIP" -d "$INSTALL_DIR/" |
| 26 | + |
| 27 | + # Check if files were extracted into a subdirectory and move them up |
| 28 | + if [ -d "$INSTALL_DIR/library-insight-cli-$VERSION" ]; then |
| 29 | + cp -R "$INSTALL_DIR/library-insight-cli-$VERSION"/* "$INSTALL_DIR/" |
| 30 | + rm -rf "$INSTALL_DIR/library-insight-cli-$VERSION" |
| 31 | + fi |
| 32 | + rm -f "$TEMP_ZIP" |
| 33 | + echo "Pre-compiled release installed successfully!" |
| 34 | +else |
| 35 | + echo "--------------------------------------------------" |
| 36 | + echo " Note: Release download failed (e.g. tag not pushed yet)." |
| 37 | + echo " Falling back to compiling from local source code..." |
| 38 | + echo "--------------------------------------------------" |
| 39 | + ./gradlew :library-insight-cli:installDist |
| 40 | + cp -R library-insight-cli/build/install/library-insight/* "$INSTALL_DIR/" |
| 41 | +fi |
13 | 42 |
|
14 | 43 | echo "Configuring executable permissions..." |
15 | 44 | chmod +x "$INSTALL_DIR/bin/library-insight" |
|
0 commit comments