File tree Expand file tree Collapse file tree 3 files changed +128
-30
lines changed
Expand file tree Collapse file tree 3 files changed +128
-30
lines changed Original file line number Diff line number Diff line change @@ -45,38 +45,17 @@ Welcome to BuildCLI - Java Project Management!
4545
4646## Installation
4747
48- 1 . ** Clone the Repository** :
49- ``` bash
50- git clone https://github.com/wheslleyrimar/buildcli.git
51- cd buildcli
52- ```
53-
54- 2 . ** Build and Package the Project** :
55- ``` bash
56- mvn package
57- ```
48+ 1 . ** Script Installation** :
49+ Just download the .sh or .bat file and execute.
5850
59- 3 . ** Set up BuildCLI for Global Access** :
60- - Copy the ` buildcli ` file to a directory in your system PATH, such as ` ~/bin ` :
61- ``` bash
62- cp target/buildcli.jar ~ /bin/
63- ```
64- - Create a wrapper script:
65- ``` bash
66- nano ~ /bin/buildcli
67- ```
68- - Insert the following content into the file:
69- ``` bash
70- #! /bin/bash
71- java -jar " $HOME /bin/buildcli.jar.jar" " $@ "
72- ```
73- - Save and exit Nano:
74- - Press CTRL + O, then Enter to save.
75- - Press CTRL + X to exit.
76-
77- - Make the script executable:
51+ - On a Unix-like system (Linux, macOS), simply give execution permission to `install.sh` and run it:
7852 ```bash
79- chmod +x ~ /bin/buildcli
53+ sudo chmod +x install.sh
54+ ./install.sh
55+ ```
56+ - On Windows: Run `install.bat` by double-clicking it or executing the following command in the Command Prompt (cmd):
57+ ```cmd
58+ install.bat
8059 ```
8160
8261Now ` BuildCLI ` is ready to use. Test the ` buildcli ` command in the terminal.
Original file line number Diff line number Diff line change 1+ @ echo off
2+ setlocal
3+
4+ echo Cloning the BuildCLI repository...
5+ git clone https://github.com/BuildCLI/BuildCLI.git || (
6+ echo Failed to clone repository. Make sure Git is installed.
7+ pause
8+ exit /b 1
9+ )
10+
11+ cd BuildCLI || (
12+ echo Directory 'BuildCLI' not found. Cloning may have failed.
13+ pause
14+ exit /b 1
15+ )
16+
17+ echo Checking if Maven is installed...
18+ where mvn > nul 2 > nul
19+ if %errorlevel% neq 0 (
20+ echo Maven not found. Please install Maven.
21+ pause
22+ exit /b 1
23+ )
24+
25+ echo Checking if Java is installed...
26+ where java > nul 2 > nul
27+ if %errorlevel% neq 0 (
28+ echo Java not found. Please install Java.
29+ pause
30+ exit /b 1
31+ )
32+
33+ echo Building and packaging the project...
34+ mvn clean package || (
35+ echo Maven build failed.
36+ pause
37+ exit /b 1
38+ )
39+
40+ echo Configuring BuildCLI for global access...
41+
42+ if not exist %USERPROFILE% \bin (
43+ echo Creating directory %USERPROFILE% \bin...
44+ mkdir %USERPROFILE% \bin
45+ )
46+
47+ echo Copying BuildCLI JAR to %USERPROFILE% \bin...
48+ copy target\buildcli.jar %USERPROFILE% \bin\buildcli.jar
49+
50+ echo Creating buildcli.bat shortcut...
51+ (
52+ echo @echo off
53+ echo java -jar " %% USERPROFILE%% \bin\buildcli.jar" %% *
54+ ) > %USERPROFILE% \bin\buildcli.bat
55+
56+ echo Ensuring %USERPROFILE% \bin is in the PATH...
57+ echo If the command fails, add this manually to your environment variables:
58+ echo .
59+ echo setx PATH " %PATH% ;%USERPROFILE% \bin"
60+ echo .
61+
62+ echo Installation completed!
63+ echo You can now run BuildCLI using:
64+ echo buildcli
65+ pause
66+ endlocal
67+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ function check_command() {
6+ if ! command -v " $1 " & > /dev/null; then
7+ echo " $1 is not installed, please install it before proceeding."
8+ exit 1
9+ fi
10+ }
11+
12+ check_command java
13+ check_command mvn
14+
15+ if ! git clone https://github.com/BuildCLI/BuildCLI.git ; then
16+ echo " Failed to clone repository. Make sure Git is installed."
17+ exit 1
18+ fi
19+ cd BuildCLI
20+
21+ if ! mvn clean package; then
22+ echo " Error while creating Maven package."
23+ exit 1
24+ fi
25+
26+ if [ ! -d " $HOME /bin" ]; then
27+ mkdir -p " $HOME /bin"
28+ fi
29+
30+ cp target/buildcli.jar " $HOME /bin/"
31+
32+ cat << EOF > "$HOME /bin/buildcli"
33+ #!/bin/bash
34+ java -jar "\$ HOME/bin/buildcli.jar" "\$ @"
35+ EOF
36+
37+ chmod +x " $HOME /bin/buildcli"
38+
39+ if [[ " :$PATH :" != * " :$HOME /bin:" * ]]; then
40+ echo " The directory \$ HOME/bin is not in the PATH."
41+ echo " Please add the following line to your ~/.bashrc, ~/.zshrc, or the appropriate shell configuration file:"
42+ echo " "
43+ echo ' export PATH="$HOME/bin:$PATH"'
44+ echo " "
45+ echo " Then, reload your shell with:"
46+ echo " source ~/.bashrc # or source ~/.zshrc if you use Zsh"
47+ echo " "
48+ echo " After that, you can run the application with: buildcli"
49+ else
50+ echo " You can now run the application with: buildcli"
51+ fi
52+
You can’t perform that action at this time.
0 commit comments