Skip to content

Commit

Permalink
Earlier sed
Browse files Browse the repository at this point in the history
Running sed straight after clone
This ensures it's only run against starter pack
And it doesn't affect their existing repo
  • Loading branch information
ColmBhandal committed Aug 29, 2023
1 parent c3ce6b7 commit 4d6020c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ set +x
# Ask the user for the installation directory
read -p "Enter the installation directory (e.g., '.' or 'docs'): " install_directory

# Clone the starter pack repository
# Clone the starter pack repository to a temporary directory
echo "Cloning the starter pack repository..."
git clone [email protected]:canonical/sphinx-docs-starter-pack temp-starter-pack
rm -rf temp-starter-pack/.git

# Update file contents for install directory
echo "Updating working directory in workflow files..."
sed -i "s|working-directory: .*|working-directory: $install_directory|g" "temp-starter-pack/.github/workflows"/*
echo "Updating .readthedocs.yaml configuration..."
sed -i "s|configuration: .*conf\.py|configuration: $install_directory/conf.py|g" "temp-starter-pack/.readthedocs.yaml"
sed -i "s|requirements: .*|requirements: $install_directory/.sphinx/requirements.txt|g" "temp-starter-pack/.readthedocs.yaml"

# Create the specified installation directory
echo "Creating the installation directory: $install_directory"
mkdir -p "$install_directory"
Expand All @@ -23,15 +30,6 @@ echo "Copying workflow files..."
mkdir -p .github/workflows
cp -R "$install_directory/.github/workflows"/* .github/workflows

# Update working-directory field in workflow files
echo "Updating working directory in workflow files..."
sed -i "s|working-directory: .*|working-directory: $install_directory|g" .github/workflows/*

# Update .readthedocs.yaml configuration
echo "Updating .readthedocs.yaml configuration..."
sed -i "s|configuration: .*conf\.py|configuration: $install_directory/conf.py|g" "$install_directory/.readthedocs.yaml"
sed -i "s|requirements: .*|requirements: $install_directory/.sphinx/requirements.txt|g" "$install_directory/.readthedocs.yaml"

# Clean up
echo "Cleaning up..."
rm -rf temp-starter-pack
Expand Down

0 comments on commit 4d6020c

Please sign in to comment.