From f279d17065966d1eb8d764454974ef89b58ce869 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 27 Nov 2024 08:55:37 -0500 Subject: [PATCH] feat: Reorganizes files --- justfile | 9 +++++++ project_directories/Airflow/.gitkeep | 0 project_directories/ManJ/.gitkeep | 0 project_directories/img/.gitkeep | 0 .../Definitions.md | 0 Report.md => project_files/Report.md | 0 footer.tex => project_files/footer.tex | 0 head.tex => project_files/head.tex | 0 project_files/project.gitignore | 1 + .../project.justfile | 12 +++++++-- vars.yml => project_files/vars.yml | 0 vault.yml => project_files/vault.yml | 0 repo_vars/vars.yml | 26 ++++++++++++++++--- 13 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 project_directories/Airflow/.gitkeep create mode 100644 project_directories/ManJ/.gitkeep create mode 100644 project_directories/img/.gitkeep rename Definitions.md => project_files/Definitions.md (100%) rename Report.md => project_files/Report.md (100%) rename footer.tex => project_files/footer.tex (100%) rename head.tex => project_files/head.tex (100%) create mode 100644 project_files/project.gitignore rename project.justfile => project_files/project.justfile (81%) rename vars.yml => project_files/vars.yml (100%) rename vault.yml => project_files/vault.yml (100%) diff --git a/justfile b/justfile index 59e8e19..c2d8248 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,4 @@ +playbook_dir := "${ANSIBLE_LOCAL}/ansible-hpa-playbook" edit-repo-vault: @ansible-vault edit ./repo_vars/vault.yml @@ -7,3 +8,11 @@ create-repo-vault: edit-project-vault: @ansible-vault edit ./vault.yml + +create-project dir *ARGS: + @ansible-playbook {{playbook_dir}}/main.yml \ + --inventory {{playbook_dir}}/inventory.ini \ + --tags setup-project \ + --extra-vars "output_dir={{dir}}" \ + --extra-vars "@{{justfile_directory()}}/repo_vars/vars.yml" \ + {{ARGS}} diff --git a/project_directories/Airflow/.gitkeep b/project_directories/Airflow/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/project_directories/ManJ/.gitkeep b/project_directories/ManJ/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/project_directories/img/.gitkeep b/project_directories/img/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Definitions.md b/project_files/Definitions.md similarity index 100% rename from Definitions.md rename to project_files/Definitions.md diff --git a/Report.md b/project_files/Report.md similarity index 100% rename from Report.md rename to project_files/Report.md diff --git a/footer.tex b/project_files/footer.tex similarity index 100% rename from footer.tex rename to project_files/footer.tex diff --git a/head.tex b/project_files/head.tex similarity index 100% rename from head.tex rename to project_files/head.tex diff --git a/project_files/project.gitignore b/project_files/project.gitignore new file mode 100644 index 0000000..bb56973 --- /dev/null +++ b/project_files/project.gitignore @@ -0,0 +1 @@ +.build/* diff --git a/project.justfile b/project_files/project.justfile similarity index 81% rename from project.justfile rename to project_files/project.justfile index ad01bbe..c636d71 100644 --- a/project.justfile +++ b/project_files/project.justfile @@ -1,3 +1,4 @@ + playbook_dir := "${ANSIBLE_LOCAL}/ansible-hpa-playbook" build_dir_name := ".build" @@ -14,10 +15,17 @@ run_pandoc dir output_file: build {{build_dir_name}}/"Report.md" \ {{build_dir_name}}/"Definitions.md" +[private] +run-playbook *ARGS: + @ansible-playbook {{playbook_dir}}/main.yml \ + --inventory {{playbook_dir}}/inventory.ini \ + --extra-vars "output_dir={{justfile_directory()}}" \ + --extra-vars "project_dir={{justfile_directory()}}" \ + {{ARGS}} + # Builds and fills the templates into the .build directory. [group('build')] -build: - @just --justfile {{playbook_dir}}/justfile build {{justfile_directory()}} +build: (run-playbook "--tags build-project") # Build & generate an HTML report. [group("generate")] diff --git a/vars.yml b/project_files/vars.yml similarity index 100% rename from vars.yml rename to project_files/vars.yml diff --git a/vault.yml b/project_files/vault.yml similarity index 100% rename from vault.yml rename to project_files/vault.yml diff --git a/repo_vars/vars.yml b/repo_vars/vars.yml index c64dc1f..6123944 100644 --- a/repo_vars/vars.yml +++ b/repo_vars/vars.yml @@ -2,6 +2,10 @@ document_title: "Home Performance Report" +template: + path: "{{ lookup('env', 'HOME') }}/projects/consult-template/" + vars: repo_vars + # Files to copy to the project directory when setting up a new consult project. # # These can be specified as a single item which is a path to the file @@ -11,10 +15,21 @@ document_title: "Home Performance Report" # dest: "FileName" # mode: '0600' # optional mode, defaults to 0600 copy_on_setup: - - "Report.md" - - "vars.yml" - - "vault.yml" - - src: project.justfile + - src: "project_files/Report.md" + dest: "Report.md" + - src: "project_files/vars.yml" + dest: "vars.yml" + - src: "project_files/vault.yml" + dest: "vault.yml" + - src: "project_directories/img/" + dest: img + - src: "project_directories/Airflow/" + dest: Airflow + - src: "project_directories/ManJ/" + dest: ManJ + - src: project_files/project.gitignore + dest: .gitignore + - src: project_files/project.justfile dest: justfile # Files to copy to the build directory when building a consult document. @@ -28,6 +43,9 @@ copy_on_setup: copy_on_build: - "{{ template.path }}/Definitions.md" - "{{ template.path }}/head.tex" + - "{{ template.path }}/img" + - "{{ template.path }}/Airflow" + - "{{ template.path }}/ManJ" # Files to fill with their template values and copy to the build directory. #