routine update

This commit is contained in:
sanj 2024-08-03 00:22:15 -07:00
parent ead8573792
commit 50d2bb80ac
4 changed files with 44 additions and 9 deletions

BIN
.DS_Store vendored

Binary file not shown.

12
gitscan
View file

@ -1,15 +1,13 @@
#!/bin/bash
output_file=~/workshop/repos.txt
output_file="./repos.txt"
# Ensure the output directory exists
mkdir -p "$(dirname "$output_file")"
# Clear the existing file
# Clear the existing file or create it if it doesn't exist
> "$output_file"
# Find all .git directories, excluding hidden directories and suppressing permission denied errors
find ~/ -type d -name ".git" -not -path "*/.*/*" 2>/dev/null | while read -r gitdir; do
# Find all .git directories in the current folder and subfolders,
# excluding hidden directories and suppressing permission denied errors
find . -type d -name ".git" -not -path "*/.*/*" 2>/dev/null | while read -r gitdir; do
# Get the parent directory of the .git folder
repo_path=$(dirname "$gitdir")
echo "$repo_path" >> "$output_file"

34
pippin Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
# Check if an argument is provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <conda_environment_name>"
exit 1
fi
# Get the conda environment name from the command line argument
env_name="$1"
# Check if the conda environment already exists
if ! conda info --envs | grep -q "^$env_name "; then
echo "Creating new conda environment: $env_name"
conda create -n "$env_name" python=3.9 -y
else
echo "Conda environment '$env_name' already exists"
fi
# Activate the conda environment
eval "$(conda shell.bash hook)"
conda activate "$env_name"
# Get the path to the conda environment's python binary
conda_python=$(which python)
# Recursively search for requirements.txt files and install dependencies
find . -name "requirements.txt" | while read -r req_file; do
echo "Installing requirements from: $req_file"
"$conda_python" -m pip install -r "$req_file"
done
echo "All requirements.txt files processed."

7
pull
View file

@ -1,10 +1,10 @@
#!/bin/bash
repos_file=~/workshop/repos.txt
repos_file="./repos.txt"
# Check if the repos file exists
if [ ! -f "$repos_file" ]; then
echo "Error: $repos_file does not exist."
echo "Error: $repos_file does not exist in the current directory."
exit 1
fi
@ -34,6 +34,9 @@ while IFS= read -r repo_path || [[ -n "$repo_path" ]]; do
echo "Force pulling latest changes..."
git pull --force
# Return to the original directory
cd - > /dev/null
echo "Update complete for $repo_path"
echo "----------------------------------------"
done < "$repos_file"