Skip to content

Commit

Permalink
New Feat: Core_Check_Path_Is_Root
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalandy committed May 26, 2023
1 parent 17bd15b commit 825750b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .bl_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CFG_DEFAULT_DEV_BRANCH="edge"
CFG_USER_IS="${USER}"

### Needed when projects are under sub directories
CFG_SUB_DIR="none"
CFG_SUB_DIR="false"

### manage your custom scripts under this directory /private/**.sh
CFG_USE_PRIVATE_DIRECTORY="false"
Expand Down
55 changes: 40 additions & 15 deletions bashlava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
: '
// COMMENT BLOCK START //
## New Feat: 0o0o
// requirement template //
TODO
## New Feat: 0o0o
- 0o0o
- 0o0o
- 0o0o
- PR https://github.com/firepress-org/ghostfire/pull/9999
- Impacts: #8 UX 🎛️
- Impacts: #10 Logic & Condition 🧠
- Impacts: #11 docs 🧵
Expand All @@ -18,30 +23,35 @@ FEATURES P1 ____________________________________________________________________
TODO
## Update version(): Fixing regex
## New Feat: Core_Check_Path_Is_Root
- The Dockerfile and ".bl_override.sh" should be correctly updated by the system.
- Only the variable ARG VERSION in the Dockerfile needs to be updated, while other variables such as ARG GHOST_CLI_VERSION and ARG NODE_VERSION should remain unchanged.
- Impacts: #8 UX 🎛️
- Core_Check_Path_Is_Root verifies if the user is at the same level as the ".git" directory, which is located at the root of every git repository.
- Impacts: #10 Logic & Condition 🧠
TODO
## New Feat: Core_Check_Path_Is_Root
## Problem
- Core_Check_Path_Is_Root checks if the user is at the same level as the directory ".git" which is at the root of every git repo.
- While working on the previous version() issue, I realized that I made a process mistake as a user.
- I, the user, was attempting to update the project versions under a sub-directory (v5) where things looked broken.
- bashlava operates at the root of a git repository.
- For the Dockerfile, add logic to manage if a sub-directory is present or not
## Problem
TODO
- I discovered while working on the previous version() issue, that the user (me) a user made process mistake.
- The user under sub_directory (v5). Here was trying to update the versions projet on thing were broken.
- basalava works at the root of a git repo.
## New Feat: remove requirements section from bashlava.sh
- Thhis will make the PR easier to read.
- 0o0o
- 0o0o
- PR https://github.com/firepress-org/ghostfire/pull/9999
- Impacts: #8 UX 🎛️
- Impacts: #10 Logic & Condition 🧠
- Impacts: #11 docs 🧵
- Impacts: #9 Bugfix 🧨
- Impacts: #4 TO-DO & backlog 💪
TODO
rename .bl_override.sh to .env which is the standard across open source projects
TODO
Faire une liste rapide de toutes les Fct dans `utilities`
le but est de listé toutes mes scripts tel que qobuz, youtube, nas_sync, etc
Expand Down Expand Up @@ -319,6 +329,7 @@ function mrg { # User_

function version { # User_
Condition_No_Commits_Pending
Core_Check_Path_Is_Root
_from_fct="v"

Show_Version
Expand All @@ -342,9 +353,9 @@ function version { # User_
Condition_Version_Must_Be_Valid

### SUB_DIR
if [[ "${CFG_SUB_DIR}" != "none" ]]; then
if [[ "${CFG_SUB_DIR}" != "false" ]]; then
_file_is="Dockerfile" _file_path_is="$(pwd)/${CFG_SUB_DIR}/${_file_is}" && Condition_File_Optionnally_Present
elif [[ "${CFG_SUB_DIR}" == "none" ]]; then
elif [[ "${CFG_SUB_DIR}" == "false" ]]; then
_file_is="Dockerfile" _file_path_is="$(pwd)/${_file_is}" && Condition_File_Optionnally_Present
else
my_message="FATAL: (CFG_SUB_DIR)" && Print_Fatal
Expand Down Expand Up @@ -1379,6 +1390,20 @@ function Core_Load_Private_Entrypoint {
fi
}

function Core_Check_Path_Is_Root {

# check if the user is at the same level as the ".git" directory,
# which is located at the root of every git repository.
# PR https://github.com/firepress-org/ghostfire/pull/9999

current_dir=$(pwd)
if [[ ! -d "$current_dir/.git" ]]; then
my_message="FATAL: The terminal prompt must be at the root of the git repo and not into a sub-directory." && Print_Fatal
else
echo "Good, we are at the root of the git repo" > /dev/null 2>&1
fi
}

### Entrypoint
function main() {
trap script_trap_err ERR
Expand Down

0 comments on commit 825750b

Please sign in to comment.