Skip to content

Commit 271b148

Browse files
committed
PR comments
1 parent 01c159c commit 271b148

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Dependencies
22
node_modules/
33

4-
# MacOS-specific files.
4+
# macOS-specific files.
55
.DS_Store
66

77
# We want to keep the template clean from the usual build artifacts.

opensaas-sh/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Since the demo app is just the open saas template with some small tweaks, and we
1717
- Generate `app/` from template and diffs: `./tools/patch.sh`
1818
- Update diffs after modifying `app/`: `./tools/diff.sh`
1919

20-
For detailed information about the diff/patch workflow and MacOS setup requirements, see [../tools/README.md](../tools/README.md).
20+
For detailed information about the diff/patch workflow and macOS setup requirements, see [../tools/README.md](../tools/README.md).
2121

2222
### Blog (blog/)
2323

opensaas-sh/tools/diff.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

3-
SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`.
3+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
4+
# Assumes this script is in `opensaas-sh/tools/`.
45
ROOT_DIR="${SCRIPT_DIR}/../.."
56

67
cd "${ROOT_DIR}"

opensaas-sh/tools/patch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

3-
SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`.
3+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
4+
# Assumes this script is in `opensaas-sh/tools/`.
45
ROOT_DIR="${SCRIPT_DIR}/../.."
56

67
cd "${ROOT_DIR}"

template/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MacOS-specific files.
1+
# macOS-specific files.
22
.DS_Store
33

44
# Ignore all dotenv files by default to prevent accidentally committing any secrets.

tools/README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# Open SaaS Tools
22

3-
This directory contains utilities for managing derived projects that are built on top of the Open SaaS template.
4-
53
## dope.sh - Diff Or Patch Executor
64

7-
The `dope.sh` script allows you to easily create a diff between two projects (base and derived), or to patch those diffs onto the base project to get the derived one. This is useful when a derived project has only small changes on top of the base project and you want to keep it in a directory in the same repo as the main project.
5+
The `dope.sh` script allows you to easily create a diff between two projects (base and derived),
6+
or to patch those diffs onto the base project to get the derived one. This is useful when a derived
7+
project has only small changes on top of the base project and you want to keep it in a directory
8+
in the same repo as the main project.
9+
10+
Since derived apps (like opensaas-sh) are just the Open SaaS template with some small tweaks, and
11+
we want to keep them up to date as the template changes, we don't version the actual app code in git.
12+
Instead, we version the diffs between it and the template in an `app_diff/` directory.
813

914
### Usage
1015

@@ -18,27 +23,35 @@ The `dope.sh` script allows you to easily create a diff between two projects (ba
1823
- `diff`: Creates a diff between the base and derived directories
1924
- `patch`: Applies existing diffs onto the base directory to recreate the derived directory
2025

21-
### Workflow
26+
The diffs are stored in a directory named `<DERIVED_DIR>_diff/` (e.g., `app_diff/`).
27+
28+
### Diff structure
2229

23-
Since derived apps (like opensaas-sh) are just the Open SaaS template with some small tweaks, and we want to keep them up to date as the template changes, we don't version the actual app code in git. Instead, we version the diffs between it and the template in an `app_diff/` directory.
30+
The diff directory can contain `.diff` files to patch files from the base directory,
31+
and `.copy` files to copy files directly from the diff directory to the derived directory
32+
(useful for binary files).
33+
34+
### Workflow
2435

2536
The typical workflow is:
2637

27-
1. Run `dope.sh` with `patch` action to generate `app/` from `../template/` and `app_diff/`:
38+
1. Run `dope.sh` with the `patch` action to generate `app/` from `../template/` and `app_diff/`:
2839
```bash
2940
./dope.sh ../template app patch
3041
```
3142

32-
2. If there are any conflicts (normally due to updates to the template), modify `app/` until you resolve them. Make any additional changes as needed.
43+
2. If there are any conflicts (usually due to updates to the template), modify `app/` until you resolve them. Make any additional changes as needed.
3344

34-
3. Generate new `app_diff/` based on the current updated `app/` by running:
45+
3. Generate a new `app_diff/` based on the updated `app/` by running:
3546
```bash
3647
./dope.sh ../template app diff
3748
```
3849

39-
### Running on MacOS
50+
### Requirements
51+
52+
#### Running on macOS
4053

41-
If you're running the `dope.sh` script on Mac, you need to install:
54+
If you're running the `dope.sh` script on macOS, install:
4255

4356
- `grealpath` (packaged within `coreutils`)
4457
- `gpatch`
@@ -50,4 +63,4 @@ brew install gpatch
5063
brew install diffutils
5164
```
5265

53-
The script will automatically detect macOS and use `gpatch` instead of the default `patch` command.
66+
The script automatically detects macOS and uses `gpatch` instead of the default `patch` command.

tools/dope.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [[ "$(uname)" == "Darwin" ]]; then
1212
if command -v gpatch &> /dev/null; then
1313
PATCH_CMD="gpatch"
1414
else
15-
echo "Error: GNU patch (gpatch) not found. On MacOS, this script requires GNU patch."
15+
echo "Error: GNU patch (gpatch) not found. On macOS, this script requires GNU patch."
1616
echo "Install it with: brew install gpatch"
1717
exit 1
1818
fi

0 commit comments

Comments
 (0)