summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-11-10 09:57:07 +0800
committer魏曹先生 <1992414357@qq.com>2025-11-10 09:57:07 +0800
commit69288ba9e9a4a297857cc6aba8f79b0a1e49fb1d (patch)
tree07347290c3a3ee06513903b7f27daf1d6e02fd8f
parent0c9e803cf7ba8431e201ee2c732d9ecd71fc4b56 (diff)
Add installation script for JustEnoughVCS
This script automates the setup process by: - Checking for required tools (cargo and git) - Cloning the necessary repositories - Building the CLI with cargo - Configuring the user's shell to include the CLI in PATH The script provides interactive shell selection for Zsh, Bash, and Fish.
-rw-r--r--scripts/installation.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/scripts/installation.sh b/scripts/installation.sh
new file mode 100644
index 0000000..c109301
--- /dev/null
+++ b/scripts/installation.sh
@@ -0,0 +1,70 @@
+# Check if required tools are installed
+echo "Checking for required tools..."
+if ! command -v cargo &> /dev/null; then
+ echo "Error: cargo is not installed. Please install Rust and Cargo first."
+ exit 1
+fi
+if ! command -v git &> /dev/null; then
+ echo "Error: git is not installed. Please install git first."
+ exit 1
+fi
+
+# Set installation directory to current directory
+echo "Installation directory set to current directory: $(pwd)"
+install_dir="$(pwd)"
+
+# Clone repos
+echo "Cloning repositories..."
+mkdir -p "$install_dir"
+cd "$install_dir"
+git clone https://github.com/JustEnoughVCS/CommandLine
+git clone https://github.com/JustEnoughVCS/VersionControl
+
+# Setup VersionControl repo
+echo "Setting up VersionControl..."
+cd VersionControl
+chmod +x setup.sh
+./setup.sh
+
+# Build CLI
+echo "Building CLI..."
+cd ../CommandLine
+cargo build --release
+cargo pub
+
+# Configure shell to include CLI in PATH
+echo "Now adding JustEnoughVCS CLI to your environment. Please select your target shell:"
+echo "1) ~/.zshrc (Zsh)"
+echo "2) ~/.bashrc (Bash)"
+echo "3) ~/.config/fish/config.fish (Fish)"
+echo "4) Skip shell configuration"
+echo -n "Enter your choice (1-4): "
+read choice
+
+case $choice in
+ 1)
+ config_file="$HOME/.zshrc"
+ ;;
+ 2)
+ config_file="$HOME/.bashrc"
+ ;;
+ 3)
+ config_file="$HOME/.config/fish/config.fish"
+ ;;
+ 4)
+ echo "Skipping shell configuration."
+ echo "Installation completed! You can manually add the CLI to your PATH later."
+ exit 0
+ ;;
+ *)
+ echo "Invalid choice. Skipping shell configuration."
+ exit 0
+ ;;
+esac
+
+cli_path="$(pwd)/.temp/publish/cli.sh"
+echo "# JustEnoughVCS CLI" >> "$config_file"
+echo "source \"$cli_path\"" >> "$config_file"
+echo "CLI has been added to $config_file"
+echo "Please restart your shell or run: source $config_file"
+echo "Installation completed successfully!"