Compare commits
13 Commits
809f2a8949
...
85355efe8f
| Author | SHA1 | Date | |
|---|---|---|---|
| 85355efe8f | |||
| 57093441c3 | |||
| f084f8380a | |||
| a9bd96b377 | |||
| c6d34847d5 | |||
| 4b8ffcdd1c | |||
| e9fc745d20 | |||
| 9cf698c67d | |||
| 20d40f069d | |||
| b0f104927c | |||
| 0ecb6860bd | |||
| c41ab99841 | |||
| 8cdd88d053 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -8,3 +8,7 @@ build
|
|||||||
|
|
||||||
# Ignore local configuration files
|
# Ignore local configuration files
|
||||||
run.yml
|
run.yml
|
||||||
|
|
||||||
|
# Ignore accidentally extracted distribution files in project root
|
||||||
|
/bin/
|
||||||
|
/lib/
|
||||||
|
|||||||
13
CLAUDE.md
13
CLAUDE.md
@ -25,22 +25,19 @@ gradle test
|
|||||||
Build distribution package:
|
Build distribution package:
|
||||||
```bash
|
```bash
|
||||||
gradle build
|
gradle build
|
||||||
# Creates app/build/distributions/app.zip
|
# Creates jrunner/build/distributions/jrunner.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
Deploy to /opt (as documented in readme.md):
|
Deploy to /opt (as documented in readme.md):
|
||||||
```bash
|
```bash
|
||||||
sudo cp app/build/distributions/app.zip /opt/
|
sudo unzip jrunner/build/distributions/jrunner.zip -d /opt/
|
||||||
sudo rm -rf /opt/app/
|
sudo ln -sf /opt/jrunner/bin/jrunner /usr/local/bin/jrunner
|
||||||
sudo unzip /opt/app.zip -d /opt/
|
|
||||||
sudo rm /opt/app.zip
|
|
||||||
sudo chown ptrowbridge:ptrowbridge -R /opt/app/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
### Single-File Design
|
### Single-File Design
|
||||||
The entire application logic resides in `app/src/main/java/jrunner/jrunner.java`. This is a monolithic command-line tool with no abstraction layers or separate modules.
|
The entire application logic resides in `jrunner/src/main/java/jrunner/jrunner.java`. This is a monolithic command-line tool with no abstraction layers or separate modules.
|
||||||
|
|
||||||
### Data Flow
|
### Data Flow
|
||||||
1. Parse command-line arguments (-scu, -scn, -scp for source; -dcu, -dcn, -dcp for destination)
|
1. Parse command-line arguments (-scu, -scn, -scp for source; -dcu, -dcn, -dcp for destination)
|
||||||
@ -55,7 +52,7 @@ The entire application logic resides in `app/src/main/java/jrunner/jrunner.java`
|
|||||||
The tool includes explicit handling for different SQL data types in a switch statement (lines 229-312). Supported types include VARCHAR, TEXT, CHAR, CLOB, DATE, TIME, TIMESTAMP, and BIGINT. String types get quote escaping and optional trimming.
|
The tool includes explicit handling for different SQL data types in a switch statement (lines 229-312). Supported types include VARCHAR, TEXT, CHAR, CLOB, DATE, TIME, TIMESTAMP, and BIGINT. String types get quote escaping and optional trimming.
|
||||||
|
|
||||||
### Database Drivers
|
### Database Drivers
|
||||||
JDBC drivers are configured in `app/build.gradle`:
|
JDBC drivers are configured in `jrunner/build.gradle`:
|
||||||
- PostgreSQL: org.postgresql:postgresql:42.5.0
|
- PostgreSQL: org.postgresql:postgresql:42.5.0
|
||||||
- IBM AS/400 (JT400): net.sf.jt400:jt400:11.0
|
- IBM AS/400 (JT400): net.sf.jt400:jt400:11.0
|
||||||
- Microsoft SQL Server: com.microsoft.sqlserver:mssql-jdbc:9.2.0.jre8
|
- Microsoft SQL Server: com.microsoft.sqlserver:mssql-jdbc:9.2.0.jre8
|
||||||
|
|||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Paul Trowbridge
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@ -1,6 +0,0 @@
|
|||||||
sudo cp app/build/distributions/app.zip /opt/
|
|
||||||
sudo rm -rf /opt/app/
|
|
||||||
sudo unzip /opt/app.zip -d /opt/
|
|
||||||
sudo rm /opt/app.zip
|
|
||||||
sudo chown $USER:$USER -R /opt/app/
|
|
||||||
export JR="/opt/app/bin/app"
|
|
||||||
42
deploy.sh
Executable file
42
deploy.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DEPLOY_DIR="${1:-/opt/jrunner}"
|
||||||
|
|
||||||
|
# Prevent deleting critical system directories
|
||||||
|
case "${DEPLOY_DIR}" in
|
||||||
|
/|/bin|/boot|/dev|/etc|/lib|/lib64|/proc|/root|/run|/sbin|/sys|/usr|/var)
|
||||||
|
echo "Error: Cannot deploy to system directory: ${DEPLOY_DIR}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ ! -d "${DEPLOY_DIR}" ]; then
|
||||||
|
echo "Error: Directory does not exist: ${DEPLOY_DIR}"
|
||||||
|
echo "Create it first: sudo mkdir -p ${DEPLOY_DIR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building jrunner..."
|
||||||
|
./gradlew build
|
||||||
|
|
||||||
|
echo "Extracting to temporary location..."
|
||||||
|
sudo rm -rf /tmp/jrunner
|
||||||
|
sudo unzip -q jrunner/build/distributions/jrunner.zip -d /tmp/
|
||||||
|
|
||||||
|
echo "Deploying to ${DEPLOY_DIR}..."
|
||||||
|
sudo rm -rf "${DEPLOY_DIR}"/*
|
||||||
|
sudo mv /tmp/jrunner/* "${DEPLOY_DIR}"/
|
||||||
|
sudo rm -rf /tmp/jrunner
|
||||||
|
|
||||||
|
echo "Fixing ownership..."
|
||||||
|
sudo chown -R $USER:$USER "${DEPLOY_DIR}"
|
||||||
|
|
||||||
|
# Only create symlink for /opt/jrunner
|
||||||
|
if [ "${DEPLOY_DIR}" = "/opt/jrunner" ]; then
|
||||||
|
echo "Creating symlink..."
|
||||||
|
sudo ln -sf /opt/jrunner/bin/jrunner /usr/local/bin/jrunner
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ Deployed to ${DEPLOY_DIR}"
|
||||||
|
echo "Run '${DEPLOY_DIR}/bin/jrunner --help' to test"
|
||||||
@ -39,7 +39,7 @@ public class jrunner {
|
|||||||
Timestamp tsStart = null;
|
Timestamp tsStart = null;
|
||||||
Timestamp tsEnd = null;
|
Timestamp tsEnd = null;
|
||||||
|
|
||||||
msg = "jrunner version 0.41";
|
msg = "jrunner version 1.0";
|
||||||
msg = msg + nl + "-scu source jdbc url";
|
msg = msg + nl + "-scu source jdbc url";
|
||||||
msg = msg + nl + "-scn source username";
|
msg = msg + nl + "-scn source username";
|
||||||
msg = msg + nl + "-scp source passowrd";
|
msg = msg + nl + "-scp source passowrd";
|
||||||
38
readme.md
38
readme.md
@ -36,20 +36,42 @@ cd jrunner
|
|||||||
./gradlew build
|
./gradlew build
|
||||||
```
|
```
|
||||||
|
|
||||||
## deploy system-wide
|
## deploy
|
||||||
|
|
||||||
|
### using the deploy script (recommended)
|
||||||
|
|
||||||
|
First, create the deployment directory:
|
||||||
```
|
```
|
||||||
sudo unzip app/build/distributions/app.zip -d /opt/
|
sudo mkdir -p /opt/jrunner
|
||||||
sudo ln -sf /opt/app/bin/app /usr/local/bin/jrunner
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can run from anywhere:
|
Then deploy:
|
||||||
|
```
|
||||||
|
# Deploy to /opt/jrunner (default, creates system-wide symlink)
|
||||||
|
./deploy.sh
|
||||||
|
|
||||||
|
# Deploy to custom location (for testing, no symlink)
|
||||||
|
sudo mkdir -p /opt/jrunner-test
|
||||||
|
./deploy.sh /opt/jrunner-test
|
||||||
|
```
|
||||||
|
|
||||||
|
The script builds, extracts to a temporary location, and only updates the target directory after the build succeeds. This ensures your existing deployment stays intact if the build fails. When deploying to `/opt/jrunner`, it creates a symlink at `/usr/local/bin/jrunner`.
|
||||||
|
|
||||||
|
### manual deployment
|
||||||
|
```
|
||||||
|
./gradlew build
|
||||||
|
sudo unzip jrunner/build/distributions/jrunner.zip -d /opt/
|
||||||
|
sudo ln -sf /opt/jrunner/bin/jrunner /usr/local/bin/jrunner
|
||||||
|
```
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
After deployment to default location:
|
||||||
```
|
```
|
||||||
jrunner -scu jdbc:postgresql://... -scn user -scp pass ...
|
jrunner -scu jdbc:postgresql://... -scn user -scp pass ...
|
||||||
```
|
```
|
||||||
|
|
||||||
To update after rebuilding:
|
After deployment to custom location:
|
||||||
```
|
```
|
||||||
./gradlew build
|
/opt/jrunner-test/bin/jrunner -scu jdbc:postgresql://... -scn user -scp pass ...
|
||||||
sudo rm -rf /opt/app
|
|
||||||
sudo unzip app/build/distributions/app.zip -d /opt/
|
|
||||||
```
|
```
|
||||||
|
|||||||
@ -8,4 +8,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rootProject.name = 'jrunner'
|
rootProject.name = 'jrunner'
|
||||||
include('app')
|
include('jrunner')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user