blob: 61545b762b040a399202d47d48e6e4ba5dc60168 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# Get the absolute path of the directory where the current script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Switch to the script's directory, exit if it fails
cd "$SCRIPT_DIR" || exit 1
# Define the target path for the CLI tool
cliPath=".Temp/Debug/JustEnoughVCS"
# Check if the CLI already exists at the target path
if [ ! -f "$cliPath" ]; then
# Check if the CommandLine directory exists in the parent directory
if [ -d "./../CommandLine/" ]; then
# Check if a built CLI executable already exists
if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then
# Create the target directory (if it doesn't exist)
mkdir -p "$(dirname "$cliPath")"
# Copy the CLI executable to the target path
cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath"
# Add execute permission
chmod +x "$cliPath"
echo "CLI copied to $cliPath"
else
# Check if a deployment script exists
if [ -f "./../CommandLine/deploy.sh" ]; then
echo "Building CLI from deploy.sh..."
# Enter the CommandLine directory and execute the deployment script
(cd "./../CommandLine" && ./deploy.sh)
# Check if the CLI executable was generated after deployment
if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then
# Create the target directory (if it doesn't exist)
mkdir -p "$(dirname "$cliPath")"
# Copy the newly built CLI executable
cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath"
# Add execute permission
chmod +x "$cliPath"
echo "CLI built and copied to $cliPath"
else
# CLI executable still not found after deployment, error and exit
echo "Error: ./../CommandLine/.temp/deploy/bin/jv Not Found after deployment!"
exit 1
fi
else
# Deployment script not found, error and exit
echo "Error: ./../CommandLine/deploy.sh Not Found!"
exit 1
fi
fi
else
# CommandLine directory not found, error and exit
echo "Error: ./../CommandLine/ Not Found!"
exit 1
fi
fi
|