mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-01 14:15:11 +00:00
Make the script a bit more resilient
This commit is contained in:
parent
a87ffa58ff
commit
a83d626912
1 changed files with 13 additions and 8 deletions
|
@ -1,5 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if the script is run from the root of the repository
|
||||||
|
if [ ! -f "Cargo.toml" ] || [ ! -d "crates/zed" ]; then
|
||||||
|
echo "Please run the script from the root of the repository."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set the environment variables
|
# Set the environment variables
|
||||||
TARGET_DIR="../zed-docs"
|
TARGET_DIR="../zed-docs"
|
||||||
PUSH_CHANGES=false
|
PUSH_CHANGES=false
|
||||||
|
@ -21,17 +27,10 @@ while getopts "pc" opt; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if "$CLEAN_FOLDERS"; then
|
|
||||||
echo "Cleaning ./doc and ./debug folders..."
|
|
||||||
rm -rf "$TARGET_DIR/doc"
|
|
||||||
rm -rf "$TARGET_DIR/debug"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the target documentation directory exists
|
# Check if the target documentation directory exists
|
||||||
if [ ! -d "$TARGET_DIR" ]; then
|
if [ ! -d "$TARGET_DIR" ]; then
|
||||||
# Prompt the user for input
|
# Prompt the user for input
|
||||||
read -p "The zed-docs directory does not exist. Make sure you are running this from the zed repo root." -n 1 -r
|
read -p "Can't find ../zed-docs. Do you want to clone the repository (y/n)?" -n 1 -r
|
||||||
read -p "Do you want to clone the repository (y/n)? " -n 1 -r
|
|
||||||
echo # Move to a new line
|
echo # Move to a new line
|
||||||
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
@ -49,6 +48,12 @@ else
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if "$CLEAN_FOLDERS"; then
|
||||||
|
echo "Cleaning ./doc and ./debug folders..."
|
||||||
|
rm -rf "$TARGET_DIR/doc"
|
||||||
|
rm -rf "$TARGET_DIR/debug"
|
||||||
|
fi
|
||||||
|
|
||||||
# Build the documentation
|
# Build the documentation
|
||||||
CARGO_TARGET_DIR="$TARGET_DIR" cargo doc --workspace --no-deps --open \
|
CARGO_TARGET_DIR="$TARGET_DIR" cargo doc --workspace --no-deps --open \
|
||||||
--exclude activity_indicator \
|
--exclude activity_indicator \
|
||||||
|
|
Loading…
Reference in a new issue