|
1 | | -# π€ Java Projects Site Automation |
| 1 | +# π€ Java Projects Automation |
2 | 2 |
|
3 | | -This directory contains scripts to automatically build and maintain the Java projects showcase website. |
| 3 | +This repository automatically builds and showcases Java projects on GitHub Pages. |
4 | 4 |
|
5 | | -## π Scripts Overview |
| 5 | +## οΏ½ How It Works |
6 | 6 |
|
7 | | -### 1. `generate-site.py` - Main Site Generator |
8 | | -Generates the complete static website with all project pages. |
| 7 | +When you push to the `main` branch, GitHub Actions automatically: |
9 | 8 |
|
10 | | -**Usage:** |
| 9 | +1. **Detects** all Java projects (any folder with a `src/` directory containing `.java` files) |
| 10 | +2. **Compiles** each project using `javac` |
| 11 | +3. **Runs** the compiled programs and captures their output |
| 12 | +4. **Generates** a beautiful HTML showcase website |
| 13 | +5. **Deploys** to GitHub Pages automatically |
| 14 | + |
| 15 | +## β¨ Adding a New Project |
| 16 | + |
| 17 | +Simply create a new folder with your project: |
| 18 | + |
| 19 | +``` |
| 20 | +YourProject/ |
| 21 | +βββ src/ |
| 22 | +β βββ MainClass.java |
| 23 | +β βββ OtherClasses.java |
| 24 | +βββ README.md (optional) |
| 25 | +``` |
| 26 | + |
| 27 | +Then commit and push: |
11 | 28 | ```bash |
12 | | -cd /path/to/JavaProjects |
13 | | -python3 .github/scripts/generate-site.py |
| 29 | +git add . |
| 30 | +git commit -m "Add new project: YourProject" |
| 31 | +git push |
14 | 32 | ``` |
15 | 33 |
|
16 | | -**What it does:** |
17 | | -- Reads project configurations from the `projects` list |
18 | | -- Generates individual HTML pages for each project |
19 | | -- Creates an index page with project cards |
20 | | -- Applies consistent styling and interactive features |
| 34 | +**That's it!** GitHub Actions handles everything automatically. |
21 | 35 |
|
22 | | -### 2. `auto-add-project.py` - Automatic Project Detection π |
23 | | -**The smart way!** Automatically detects new Java projects and adds them to the website. |
| 36 | +## π οΈ Local Scripts |
| 37 | + |
| 38 | +### 1. `generate-site.py` - Site Generator |
| 39 | +Generates the complete static website with all project pages. |
24 | 40 |
|
25 | 41 | **Usage:** |
26 | 42 | ```bash |
27 | | -# From project root |
28 | | -python3 .github/scripts/auto-add-project.py |
29 | | - |
30 | | -# Or use the convenient wrapper |
31 | | -.github/scripts/auto-add.fish |
| 43 | +python3 .github/scripts/generate-site.py |
32 | 44 | ``` |
33 | 45 |
|
34 | | -**What it does:** |
35 | | -1. π Scans the workspace for Java projects (directories with `src/` folders) |
36 | | -2. π Compares with existing projects already in the website |
37 | | -3. βοΈ Compiles and runs each new project |
38 | | -4. π€ Captures the output |
39 | | -5. πΎ Saves output and compile logs to `docs/` |
40 | | -6. π Adds project configuration to `generate-site.py` |
41 | | -7. π Regenerates the entire website |
42 | | -8. β¨ Done! Your new project is live on the site |
43 | | - |
44 | | -**Interactive prompts:** |
45 | | -- Asks whether each project is `teoria` or `laboratorio` |
46 | | -- Shows compilation output and any errors |
47 | | -- Provides clear feedback at each step |
48 | | - |
49 | | -### 3. `auto-add.fish` - Convenient Wrapper |
50 | | -A fish shell wrapper that makes running the auto-add script even easier. |
| 46 | +### 2. `auto-add-project.py` - Local Project Detection (Optional) |
| 47 | +For testing locally before pushing. Automatically detects new projects and adds them. |
51 | 48 |
|
52 | 49 | **Usage:** |
53 | 50 | ```bash |
54 | | -# From anywhere in the project |
55 | | -./.github/scripts/auto-add.fish |
| 51 | +python3 .github/scripts/auto-add-project.py |
56 | 52 | ``` |
57 | 53 |
|
58 | | -## π― Quick Start Guide |
59 | | - |
60 | | -### Adding a New Project Automatically |
61 | | - |
62 | | -1. **Create your Java project** with this structure: |
63 | | - ``` |
64 | | - MyNewProject/ |
65 | | - βββ src/ |
66 | | - β βββ MyClass.java |
67 | | - β βββ TestMyClass.java (with main method) |
68 | | - βββ bin/ |
69 | | - βββ lib/ |
70 | | - ``` |
71 | | - |
72 | | -2. **Run the auto-add script:** |
73 | | - ```bash |
74 | | - cd JavaProjects |
75 | | - python3 .github/scripts/auto-add-project.py |
76 | | - ``` |
77 | | - |
78 | | -3. **Follow the prompts:** |
79 | | - - The script will detect your new project |
80 | | - - It will compile and run it |
81 | | - - You'll be asked if it's `teoria` or `laboratorio` |
82 | | - - The website will be automatically regenerated |
| 54 | +**What it does:** |
| 55 | +1. π Scans for Java projects |
| 56 | +2. βοΈ Compiles and runs each new project |
| 57 | +3. π Adds project configuration to `generate-site.py` |
| 58 | +4. π Regenerates the website |
83 | 59 |
|
84 | | -4. **That's it!** π |
85 | | - - Your project page is at `docs/mynewproject.html` |
86 | | - - It's added to the index page |
87 | | - - Output is saved to `docs/mynewproject-output.txt` |
| 60 | +**Note:** This is mainly for local testing. The GitHub workflow handles everything automatically when you push. |
88 | 61 |
|
89 | 62 | ## π¦ Project Structure Requirements |
90 | 63 |
|
|
0 commit comments