reconfigured the Folder Templates for git so that the engagement specific template file doesnt cause Master branch sync issues
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,3 +6,6 @@ config.ini
|
|||||||
# Python bytecode cache
|
# Python bytecode cache
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
|
# Per-engagement folder list (created from fccs_folders.template.txt on first run)
|
||||||
|
fccs_folders.txt
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ Extracts and organizes documents from FileCabinet CS (Thomson Reuters) using GUI
|
|||||||
|------|---------|
|
|------|---------|
|
||||||
| `config.template.ini` | Tracked template for all paths, timeouts, and FCCS control identifiers |
|
| `config.template.ini` | Tracked template for all paths, timeouts, and FCCS control identifiers |
|
||||||
| `config.ini` | Per-machine working config (git-ignored; auto-created from the template) |
|
| `config.ini` | Per-machine working config (git-ignored; auto-created from the template) |
|
||||||
| `fccs_folders.txt` | FCCS folder templates (manually populated per engagement) |
|
| `fccs_folders.template.txt` | Tracked template for FCCS folder names |
|
||||||
|
| `fccs_folders.txt` | Per-engagement folder list (git-ignored; auto-created from the template) |
|
||||||
| `fccs_config.py` | Shared config loading, logging, folder pattern building |
|
| `fccs_config.py` | Shared config loading, logging, folder pattern building |
|
||||||
| `fccs_scan.py` | Step 1: Scan backup directory for drawer IDs |
|
| `fccs_scan.py` | Step 1: Scan backup directory for drawer IDs |
|
||||||
| `fccs_export.py` | Step 2: Automate FCCS GUI to export all drawers |
|
| `fccs_export.py` | Step 2: Automate FCCS GUI to export all drawers |
|
||||||
@@ -28,7 +29,7 @@ Extracts and organizes documents from FileCabinet CS (Thomson Reuters) using GUI
|
|||||||
## Setup Per Engagement
|
## Setup Per Engagement
|
||||||
|
|
||||||
1. Edit `config.ini` -- point `backup_dir`, `export_dir`, and `output_dir` at the client's directories. This file is created automatically from `config.template.ini` the first time you run any script (it's git-ignored, so your machine-specific paths never drift the repo). To reset a machine, delete `config.ini` and re-run. Keep shared/default changes in `config.template.ini` (the tracked file).
|
1. Edit `config.ini` -- point `backup_dir`, `export_dir`, and `output_dir` at the client's directories. This file is created automatically from `config.template.ini` the first time you run any script (it's git-ignored, so your machine-specific paths never drift the repo). To reset a machine, delete `config.ini` and re-run. Keep shared/default changes in `config.template.ini` (the tracked file).
|
||||||
2. Populate `fccs_folders.txt` -- open FCCS > System Configuration > Document Folders and list each folder template exactly as shown, one per line. Keep the `YYYY` prefix on recurring folders. UltraTax CS folders are detected automatically and do not need to be listed.
|
2. Populate `fccs_folders.txt` -- open FCCS > System Configuration > Document Folders and list each folder template exactly as shown, one per line. Keep the `YYYY` prefix on recurring folders. UltraTax CS folders are detected automatically and do not need to be listed. Like `config.ini`, this file is auto-created from `fccs_folders.template.txt` on first use and is git-ignored — edit it freely per engagement; put only broadly-useful defaults in the tracked template.
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,24 @@ DEFAULT_CONFIG = "config.ini"
|
|||||||
TEMPLATE_CONFIG = "config.template.ini"
|
TEMPLATE_CONFIG = "config.template.ini"
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_from_template(path, template):
|
||||||
|
"""Create a per-machine working file from its git-tracked template.
|
||||||
|
|
||||||
|
If `path` doesn't exist but `template` does, copy template -> path and
|
||||||
|
announce it. Returns True if the file exists (or was just created).
|
||||||
|
Used for config.ini and fccs_folders.txt so local edits never drift the
|
||||||
|
repo — the working copies are git-ignored, only the templates are tracked.
|
||||||
|
"""
|
||||||
|
if os.path.exists(path):
|
||||||
|
return True
|
||||||
|
if os.path.exists(template):
|
||||||
|
shutil.copyfile(template, path)
|
||||||
|
print(f"Created {os.path.basename(path)} from "
|
||||||
|
f"{os.path.basename(template)}. Edit it for this machine: {path}")
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
"""Parse the optional --config argument common to all scripts."""
|
"""Parse the optional --config argument common to all scripts."""
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
@@ -41,12 +59,7 @@ def load_config(path=None):
|
|||||||
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||||
path = os.path.join(script_dir, DEFAULT_CONFIG)
|
path = os.path.join(script_dir, DEFAULT_CONFIG)
|
||||||
# Auto-create the per-machine config from the template on first run.
|
# Auto-create the per-machine config from the template on first run.
|
||||||
if not os.path.exists(path):
|
ensure_from_template(path, os.path.join(script_dir, TEMPLATE_CONFIG))
|
||||||
template = os.path.join(script_dir, TEMPLATE_CONFIG)
|
|
||||||
if os.path.exists(template):
|
|
||||||
shutil.copyfile(template, path)
|
|
||||||
print(f"Created {DEFAULT_CONFIG} from {TEMPLATE_CONFIG}. "
|
|
||||||
f"Edit it for this machine's settings: {path}")
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
print(f"ERROR: config file not found: {path}")
|
print(f"ERROR: config file not found: {path}")
|
||||||
print(f" Expected {DEFAULT_CONFIG} or a --config path "
|
print(f" Expected {DEFAULT_CONFIG} or a --config path "
|
||||||
@@ -71,9 +84,17 @@ def make_logger(log_file):
|
|||||||
|
|
||||||
|
|
||||||
def load_folder_list(path):
|
def load_folder_list(path):
|
||||||
"""Load known FCCS folder names from file, one per line."""
|
"""Load known FCCS folder names from file, one per line.
|
||||||
if not os.path.exists(path):
|
|
||||||
|
Like config.ini, the folder list is split into a tracked template
|
||||||
|
(fccs_folders.template.txt) and a git-ignored per-engagement working copy
|
||||||
|
(fccs_folders.txt) — auto-created from the template on first use.
|
||||||
|
"""
|
||||||
|
root, ext = os.path.splitext(path)
|
||||||
|
template = root + ".template" + ext
|
||||||
|
if not ensure_from_template(path, template):
|
||||||
print(f"ERROR: folder list file not found: {path}")
|
print(f"ERROR: folder list file not found: {path}")
|
||||||
|
print(f" (no template found at {template} to create it from)")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
folders = []
|
folders = []
|
||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# FCCS Folder Templates
|
# FCCS Folder Templates — TEMPLATE (tracked in git; do NOT edit per-engagement)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
# On first run the scripts copy this file to fccs_folders.txt (git-ignored) and
|
||||||
|
# use that. Edit fccs_folders.txt for the current engagement so local changes
|
||||||
|
# never drift the repo. Delete fccs_folders.txt to reset from this template.
|
||||||
|
#
|
||||||
# List folder names exactly as shown in FCCS System Configuration > Document Folders.
|
# List folder names exactly as shown in FCCS System Configuration > Document Folders.
|
||||||
# Keep the YYYY prefix for recurring folders. Non-recurring folders go as-is.
|
# Keep the YYYY prefix for recurring folders. Non-recurring folders go as-is.
|
||||||
# UltraTax CS folders are handled automatically — do not list them here.
|
# UltraTax CS folders are handled automatically — do not list them here.
|
||||||
Reference in New Issue
Block a user