Skip to content
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

Add a way to programmatically retrieve repo root and content directory paths #22

Open
inoxx03 opened this issue Sep 3, 2021 · 0 comments

Comments

@inoxx03
Copy link
Collaborator

inoxx03 commented Sep 3, 2021

We should consider implementing a way for pcmd to retrieve the patsh to content directories form the shell.
Having this feature would allow users to run pcmd from anywhere anywhere without having to run it from the root of the repository.

It could also improve the pantheon2.yml file generation feature, allowing the generation script to locate the content directory and add its path relative to the repository root under the modules and assemblies section of the YAML template.

We can use built in shell commands and git tools to avoid introducing too many package dependencies.

For example, we can retrieve the absolute path to the repository root using:

REPOSITORY_ROOT=$(git rev-parse --show-toplevel)

we can then get the root directory name using basename and use it to build relative paths to other content directories
(If we only need the name of the root directory, we can do this in one step.)

ROOT_DIR=$(basename ${REPOSITORY_ROOT})

Alternatively, we can have the script locate the content directories automatically.
This should be fairly easy to do, because we have standardized the content directory names to assemblies and modules across all repos so we can search for them by name
We could use something like:

ASSEMBLIES_DIR=$(find ${REPOSITORY_ROOT} -type d -name "modules")

Please not that these are just initial suggestions, we can tweak and changes them based on usability and tooling considerations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant