diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 0000000..d181d95 --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,41 @@ +name: Deploy GitHub Pages + +on: + push: + branches: [main] + paths: + - "docs/**" + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + deploy: + name: Deploy to GitHub Pages + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/ + + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 6dbd99d..05c8b71 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,12 @@ [](https://github.com/llerandi/java-runner/commits/main) [](https://openjdk.org/) [](https://medium.com/@llerandi/run-any-compiled-language-without-an-ide-6d910879ac04) +[](https://llerandi.github.io/java-runner/) A command-line tool to compile and run Java exercises instantly, without an IDE, a build system, or any project structure. Point it at a `.java` file and it handles the rest. +**Live site:** [llerandi.github.io/java-runner](https://llerandi.github.io/java-runner/) + The same pattern -- wrap the compile-and-run loop into a single command, add watch mode and clean error output -- applies to any compiled language. This project implements it for Java. --- @@ -162,7 +165,15 @@ The tests cover successful runs, compilation errors, runtime errors, and missing java-runner/ ├── .github/ │ └── workflows/ -│ └── ci.yaml # GitHub Actions CI pipeline +│ ├── ci.yaml # Test pipeline (Linux, macOS, Windows) +│ └── pages.yaml # GitHub Pages deploy pipeline +├── docs/ +│ ├── diagrams/ # draw.io source files +│ ├── img/ # Exported images +│ ├── article.md # Published Medium article +│ ├── index.html # GitHub Pages site +│ ├── robots.txt +│ └── sitemap.xml ├── examples/ │ ├── HelloWorld.java # Basic output │ ├── FizzBuzz.java # Classic exercise @@ -222,11 +233,11 @@ The `examples/` folder contains three files you can use to verify the setup or a ### Phase 3 - Polish +- [x] ANSI color output on Windows +- [x] Auto-detect test added to `test.sh` and `test.bat` +- [x] GitHub Pages site with project documentation - [ ] Clear screen between runs in watch mode -- [ ] ANSI color output on Windows -- [ ] Auto-detect test added to `test.sh` and `test.bat` - [ ] `runner.ps1` using PowerShell `FileSystemWatcher` for event-based watch mode on Windows -- [ ] `article2.md` moved to `docs/`, root cleaned up ### Phase 4 - Features diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..7394808 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,465 @@ + + +
+ + +Run Java files from the terminal - no IDE required. + Source: github.com/llerandi/java-runner +
+No IDE, no build system, no project structure. Point it at a .java file and it handles the rest.
Wraps javac and java into one step. Compiles, runs, prints output, and cleans up.
Reruns automatically every time you save the file. Uses inotifywait on Linux, fswatch on macOS, timestamp polling on Windows.
No argument needed if there is only one .java file in the directory. Falls back to examples/ automatically.
Strips absolute path noise from compiler errors so they are shorter and easier to read.
+Shows how long the program took to run after every execution, in milliseconds.
+runner.sh for Linux and macOS. runner.bat for Windows. Same behavior on all three.
Requires Java JDK 11 or higher. No other dependencies for the basic run.
+For watch mode on Linux, install inotify-tools:
For watch mode on macOS, install fswatch:
On Windows, replace ./runner.sh with runner.bat or .\runner.bat from PowerShell.
| Tool | +Purpose | +Notes | +
|---|---|---|
| Java JDK | +Compile and run | +Version 11+. Must include javac. Not just the JRE. |
+
| Bash 3.2+ | +Run runner.sh |
+ Linux and macOS only. | +
| inotify-tools | +Watch mode on Linux | +sudo apt install inotify-tools |
+
| fswatch | +Watch mode on macOS | +brew install fswatch |
+
Windows users need no extra tools. Watch mode polls the file timestamp every 2 seconds.
+Successful run:
+Compilation error:
+