-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Move dope.sh to top level
#531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| TOOLS_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `tools/`. | ||
| cd "${TOOLS_DIR}" && cd ../.. | ||
| SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`. | ||
|
||
| ROOT_DIR="${SCRIPT_DIR}/../.." | ||
|
|
||
| cd "${ROOT_DIR}" | ||
|
|
||
| rm -rf opensaas-sh/app_diff | ||
| "${TOOLS_DIR}/dope.sh" template/app opensaas-sh/app diff | ||
| "${ROOT_DIR}/tools/dope.sh" template/app opensaas-sh/app diff | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| TOOLS_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `tools/`. | ||
| cd "${TOOLS_DIR}" && cd ../.. | ||
| SCRIPT_DIR=$(dirname "$(realpath "$0")") # Assumes this script is in `opensaas-sh/tools/`. | ||
|
||
| ROOT_DIR="${SCRIPT_DIR}/../.." | ||
|
|
||
| cd "${ROOT_DIR}" | ||
|
|
||
| # Removes all files except for some gitignored files that we don't want to bother regenerating each time, | ||
| # like node_modules and certain .env files. | ||
| find opensaas-sh/app -mindepth 1 \( -path node_modules -o -name .env.server -o -name .env.me \) -prune -o -exec rm -rf {} + | ||
| "${TOOLS_DIR}/dope.sh" template/app opensaas-sh/app patch | ||
| "${ROOT_DIR}/tools/dope.sh" template/app opensaas-sh/app patch | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||
| # Open SaaS Tools | ||||||||
|
|
||||||||
| This directory contains utilities for managing derived projects that are built on top of the Open SaaS template. | ||||||||
|
||||||||
|
|
||||||||
| ## dope.sh - Diff Or Patch Executor | ||||||||
|
|
||||||||
| 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. | ||||||||
|
||||||||
|
|
||||||||
| ### Usage | ||||||||
|
|
||||||||
| ```bash | ||||||||
| ./dope.sh <BASE_DIR> <DERIVED_DIR> <ACTION> | ||||||||
| ``` | ||||||||
|
|
||||||||
| - `<BASE_DIR>`: The base project directory (e.g., `../template/`) | ||||||||
| - `<DERIVED_DIR>`: The derived project directory (e.g., `app/`) | ||||||||
cprecioso marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| - `<ACTION>`: Either `diff` or `patch` | ||||||||
| - `diff`: Creates a diff between the base and derived directories | ||||||||
| - `patch`: Applies existing diffs onto the base directory to recreate the derived directory | ||||||||
|
|
||||||||
cprecioso marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| ### Workflow | ||||||||
|
|
||||||||
| 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. | ||||||||
|
||||||||
|
|
||||||||
| The typical workflow is: | ||||||||
|
|
||||||||
| 1. Run `dope.sh` with `patch` action to generate `app/` from `../template/` and `app_diff/`: | ||||||||
| ```bash | ||||||||
| ./dope.sh ../template app patch | ||||||||
| ``` | ||||||||
|
|
||||||||
| 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. | ||||||||
|
|
||||||||
| 3. Generate new `app_diff/` based on the current updated `app/` by running: | ||||||||
| ```bash | ||||||||
| ./dope.sh ../template app diff | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### Running on MacOS | ||||||||
|
||||||||
| ### Running on MacOS | |
| ### Requirements | |
| #### macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
brand name is macOS 🤪