ronniross commited on
Commit
ec01cd0
·
verified ·
1 Parent(s): 686340a

Create clone_ecosystem.sh

Browse files
Files changed (1) hide show
  1. scripts/clone_ecosystem.sh +45 -0
scripts/clone_ecosystem.sh ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # --- clone_ecosystem.sh ---
4
+ # This script extracts all GitHub repository URLs for the user 'ronniross' and clones each one into a 'repositories' subdirectory.
5
+
6
+ # Set the name for the directory where repos will be cloned.
7
+ CLONE_DIR="repositories"
8
+
9
+ # --- Main Execution ---
10
+ echo "🚀 Starting the ASI Ecosystem cloning process..."
11
+
12
+ # 1. Create the target directory if it doesn't exist.
13
+ if [ -d "$CLONE_DIR" ]; then
14
+ echo " Directory '$CLONE_DIR' already exists. Skipping creation."
15
+ else
16
+ echo " Creating directory: '$CLONE_DIR'..."
17
+ mkdir "$CLONE_DIR"
18
+ if [ $? -ne 0 ]; then
19
+ echo " Error: Could not create directory '$CLONE_DIR'. Aborting."
20
+ exit 1
21
+ fi
22
+ fi
23
+
24
+ # 2. Change into the cloning directory.
25
+ cd "$CLONE_DIR"
26
+
27
+ # 3. Parse README.md from the parent directory, find unique URLs, and clone them.
28
+ echo "🔎 Finding repositories in README.md..."
29
+
30
+ # This command chain does the following:
31
+ # - grep: Finds all lines in the parent directory's README containing the base URL.
32
+ # - sed: Extracts just the full HTTPS URL from the Markdown link format.
33
+ # - sort -u: Ensures each repository is only cloned once, even if duplicated in the README.
34
+ grep 'https://github.com/ronniross/' ../README.md | \
35
+ sed -n 's/.*(\(https:\/\/github\.com\/ronniross\/[a-zA-Z0-9_-]*\)).*/\1/p' | \
36
+ sort -u | \
37
+ while read repo_url; do
38
+ if [ -n "$repo_url" ]; then
39
+ echo " Cloning $repo_url..."
40
+ git clone "$repo_url"
41
+ fi
42
+ done
43
+
44
+ echo "All repositories have been cloned into the '$CLONE_DIR' directory."
45
+ echo "ASI Ecosystem clone setup complete!"