Skip to content

Commit

Permalink
Merge branch 'BuildCLI:main' into feature/Auto-Assign-Issues-Based-on…
Browse files Browse the repository at this point in the history
…-Specific-Comments
  • Loading branch information
omatheusmesmo authored Feb 11, 2025
2 parents 580aabe + c382197 commit 96d3f47
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 30 deletions.
39 changes: 9 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,17 @@ Welcome to BuildCLI - Java Project Management!

## Installation

1. **Clone the Repository**:
```bash
git clone https://github.com/wheslleyrimar/buildcli.git
cd buildcli
```

2. **Build and Package the Project**:
```bash
mvn package
```
1. **Script Installation**:
Just download the .sh or .bat file and execute.

3. **Set up BuildCLI for Global Access**:
- Copy the `buildcli` file to a directory in your system PATH, such as `~/bin`:
```bash
cp target/buildcli.jar ~/bin/
```
- Create a wrapper script:
```bash
nano ~/bin/buildcli
```
- Insert the following content into the file:
```bash
#!/bin/bash
java -jar "$HOME/bin/buildcli.jar.jar" "$@"
```
- Save and exit Nano:
- Press CTRL + O, then Enter to save.
- Press CTRL + X to exit.

- Make the script executable:
- On a Unix-like system (Linux, macOS), simply give execution permission to `install.sh` and run it:
```bash
chmod +x ~/bin/buildcli
sudo chmod +x install.sh
./install.sh
```
- On Windows: Run `install.bat` by double-clicking it or executing the following command in the Command Prompt (cmd):
```cmd
install.bat
```

Now `BuildCLI` is ready to use. Test the `buildcli` command in the terminal.
Expand Down
67 changes: 67 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@echo off
setlocal

echo Cloning the BuildCLI repository...
git clone https://github.com/BuildCLI/BuildCLI.git || (
echo Failed to clone repository. Make sure Git is installed.
pause
exit /b 1
)

cd BuildCLI || (
echo Directory 'BuildCLI' not found. Cloning may have failed.
pause
exit /b 1
)

echo Checking if Maven is installed...
where mvn >nul 2>nul
if %errorlevel% neq 0 (
echo Maven not found. Please install Maven.
pause
exit /b 1
)

echo Checking if Java is installed...
where java >nul 2>nul
if %errorlevel% neq 0 (
echo Java not found. Please install Java.
pause
exit /b 1
)

echo Building and packaging the project...
mvn clean package || (
echo Maven build failed.
pause
exit /b 1
)

echo Configuring BuildCLI for global access...

if not exist %USERPROFILE%\bin (
echo Creating directory %USERPROFILE%\bin...
mkdir %USERPROFILE%\bin
)

echo Copying BuildCLI JAR to %USERPROFILE%\bin...
copy target\buildcli.jar %USERPROFILE%\bin\buildcli.jar

echo Creating buildcli.bat shortcut...
(
echo @echo off
echo java -jar "%%USERPROFILE%%\bin\buildcli.jar" %%*
) > %USERPROFILE%\bin\buildcli.bat

echo Ensuring %USERPROFILE%\bin is in the PATH...
echo If the command fails, add this manually to your environment variables:
echo.
echo setx PATH "%PATH%;%USERPROFILE%\bin"
echo.

echo Installation completed!
echo You can now run BuildCLI using:
echo buildcli
pause
endlocal

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

set -e

function check_command() {
if ! command -v "$1" &> /dev/null; then
echo "$1 is not installed, please install it before proceeding."
exit 1
fi
}

check_command java
check_command mvn

if ! git clone https://github.com/BuildCLI/BuildCLI.git ; then
echo "Failed to clone repository. Make sure Git is installed."
exit 1
fi
cd BuildCLI

if ! mvn clean package; then
echo "Error while creating Maven package."
exit 1
fi

if [ ! -d "$HOME/bin" ]; then
mkdir -p "$HOME/bin"
fi

cp target/buildcli.jar "$HOME/bin/"

cat <<EOF > "$HOME/bin/buildcli"
#!/bin/bash
java -jar "\$HOME/bin/buildcli.jar" "\$@"
EOF

chmod +x "$HOME/bin/buildcli"

if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "The directory \$HOME/bin is not in the PATH."
echo "Please add the following line to your ~/.bashrc, ~/.zshrc, or the appropriate shell configuration file:"
echo ""
echo 'export PATH="$HOME/bin:$PATH"'
echo ""
echo "Then, reload your shell with:"
echo "source ~/.bashrc # or source ~/.zshrc if you use Zsh"
echo ""
echo "After that, you can run the application with: buildcli"
else
echo "You can now run the application with: buildcli"
fi

0 comments on commit 96d3f47

Please sign in to comment.