haraka 0.2.37__tar.gz → 0.2.38__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {haraka-0.2.37 → haraka-0.2.38}/PKG-INFO +1 -1
  2. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/config/config.py +7 -4
  3. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/fileOps/purge.py +11 -7
  4. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/manifests/java-springboot.yml +4 -0
  5. {haraka-0.2.37 → haraka-0.2.38}/haraka.egg-info/PKG-INFO +1 -1
  6. {haraka-0.2.37 → haraka-0.2.38}/pyproject.toml +1 -1
  7. {haraka-0.2.37 → haraka-0.2.38}/MANIFEST.in +0 -0
  8. {haraka-0.2.37 → haraka-0.2.38}/haraka/__init__.py +0 -0
  9. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/__init__.py +0 -0
  10. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/__init__.py +0 -0
  11. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/assets.py +0 -0
  12. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/frame/__init__.py +0 -0
  13. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/frame/border.py +0 -0
  14. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/frame/framer.py +0 -0
  15. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/ascii/frame/width_utils.py +0 -0
  16. {haraka-0.2.37 → haraka-0.2.38}/haraka/art/create.py +0 -0
  17. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/__init__.py +0 -0
  18. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/config/__init__.py +0 -0
  19. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/resources/__init__.py +0 -0
  20. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/resources/assets.py +0 -0
  21. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/runner.py +0 -0
  22. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/__init__.py +0 -0
  23. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/command.py +0 -0
  24. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/fileOps/__init__.py +0 -0
  25. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/fileOps/files.py +0 -0
  26. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/gitOps/__init__.py +0 -0
  27. {haraka-0.2.37 → haraka-0.2.38}/haraka/post_gen/service/gitOps/gitops.py +0 -0
  28. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/__init__.py +0 -0
  29. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/common/__init__.py +0 -0
  30. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/common/utils.py +0 -0
  31. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/logging/__init__.py +0 -0
  32. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/logging/log_util.py +0 -0
  33. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/manifests/go-grpc-gateway-buf.yml +0 -0
  34. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/manifests/go-grpc-protoc.yml +0 -0
  35. {haraka-0.2.37 → haraka-0.2.38}/haraka/utils/manifests/python-fastapi.yml +0 -0
  36. {haraka-0.2.37 → haraka-0.2.38}/haraka.egg-info/SOURCES.txt +0 -0
  37. {haraka-0.2.37 → haraka-0.2.38}/haraka.egg-info/dependency_links.txt +0 -0
  38. {haraka-0.2.37 → haraka-0.2.38}/haraka.egg-info/top_level.txt +0 -0
  39. {haraka-0.2.37 → haraka-0.2.38}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.37
3
+ Version: 0.2.38
4
4
  Summary: Reusable post-generation helper for Cookiecutter micro-service templates
5
5
  Author-email: Will Burks <will@example.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  from dataclasses import dataclass
2
2
  from pathlib import Path
3
- from typing import Iterable
3
+ from typing import Iterable, List, Tuple
4
4
  import yaml
5
5
  from pathspec import PathSpec
6
6
 
@@ -18,7 +18,7 @@ class PostGenConfig:
18
18
  evm: bool = False # Extreme Verbosity Mode - For in depth debugging
19
19
 
20
20
 
21
- def load_manifest(variant: str) -> list[str]:
21
+ def load_manifest(variant: str) -> Tuple[List[str], List[str]]:
22
22
  """Return the `keep:` pattern list from `<variant>.yml`."""
23
23
  manifest_path = _MANIFEST_DIR / f"{variant}.yml"
24
24
  if not manifest_path.exists():
@@ -27,12 +27,15 @@ def load_manifest(variant: str) -> list[str]:
27
27
  f"(expected {manifest_path})"
28
28
  )
29
29
  doc = yaml.safe_load(manifest_path.read_text())
30
- if not isinstance(doc, dict) or "keep" not in doc:
30
+ if not isinstance(doc, dict) or "keep" not in doc or "protected_dirs" not in doc:
31
31
  raise ValueError(f"Manifest {manifest_path} missing a `keep:` section")
32
32
  keep_patterns = doc["keep"]
33
+ protected_dirs = doc.get("protected_dirs", [])
33
34
  if not isinstance(keep_patterns, Iterable):
34
35
  raise TypeError(f"`keep` section in {manifest_path} must be a list")
35
- return list(keep_patterns)
36
+ if not isinstance(protected_dirs, Iterable):
37
+ raise TypeError(f"`protected` section in {manifest_path} must be a list")
38
+ return list(keep_patterns), list(protected_dirs)
36
39
 
37
40
 
38
41
  def build_spec(patterns: Iterable[str]) -> PathSpec:
@@ -65,12 +65,14 @@ class ResourcePurger:
65
65
  self._log.info(f"Starting purge for variant: {variant}")
66
66
  self._log.debug(f"Loaded variant for purge: {variant}")
67
67
 
68
- raw_patterns = config.load_manifest(variant)
68
+ raw_patterns, raw_protected_dirs = config.load_manifest(variant)
69
69
  keep_patterns = [p.rstrip("/") for p in raw_patterns]
70
+ protected_dirs = [p.rstrip("/") for p in raw_protected_dirs]
70
71
 
71
72
  self._log.debug(f"Loaded manifest for variant '{variant}': {keep_patterns}")
72
73
 
73
74
  spec = config.build_spec(keep_patterns)
75
+ protected_spec = config.build_spec(protected_dirs)
74
76
  self._log.debug(f"Built PathSpec for keep patterns. Total patterns: {len(keep_patterns)}")
75
77
 
76
78
  self._log.info(f"Keeping {len(keep_patterns)} pattern(s)")
@@ -81,7 +83,7 @@ class ResourcePurger:
81
83
 
82
84
  matched, non_dirs, non_files, _ = self.classify_paths(all_paths, project_dir, spec)
83
85
 
84
- self._purge_unrelated(project_dir, matched, non_dirs, non_files)
86
+ self._purge_unrelated(project_dir, matched, non_dirs, non_files, protected_spec)
85
87
 
86
88
  self._log.debug(f"Finished purging unrelated paths in project directory: {project_dir}")
87
89
 
@@ -146,13 +148,14 @@ class ResourcePurger:
146
148
  self._log.info(" (none)")
147
149
  self._log.info("-" * 70)
148
150
 
149
- def _dir_batch_delete(self, title: str, items: List[str], root: Path) -> None:
151
+ def _dir_batch_delete(self, title: str, items: List[str], root: Path, protected_spec: PathSpec) -> None:
150
152
  self._log.info(f"{title} — {len(items)}")
151
153
  if items:
152
154
  for p in sorted(items):
153
- full_path = root / Path(p)
154
- self._f.remove_dir(full_path)
155
- self._log.debug(f" 🗑️ DELETED DIR {p}")
155
+ if not protected_spec.match_file(p):
156
+ full_path = root / Path(p)
157
+ self._f.remove_dir(full_path)
158
+ self._log.debug(f" 🗑️ DELETED DIR {p}")
156
159
  else:
157
160
  self._log.info(" (none)")
158
161
  self._log.info("-" * 70)
@@ -174,11 +177,12 @@ class ResourcePurger:
174
177
  matched: List[str],
175
178
  non_matched_dirs: List[str],
176
179
  non_matched_files: List[str],
180
+ protected_spec: PathSpec,
177
181
  ) -> None:
178
182
  """Human-friendly digest of keep/delete results."""
179
183
  self._log.info("\n" + "=" * 70)
180
184
  self._print_matches("✅ MATCHED (keep)", matched)
181
- self._dir_batch_delete("🗂️ NON-MATCHED DIRECTORIES (delete)", non_matched_dirs, root)
185
+ self._dir_batch_delete("🗂️ NON-MATCHED DIRECTORIES (delete)", non_matched_dirs, root, protected_spec)
182
186
  self._file_batch_delete("📄 NON-MATCHED FILES (delete)", non_matched_files, root)
183
187
  self._log.info("=" * 70)
184
188
 
@@ -27,3 +27,7 @@ keep:
27
27
  - chart/**
28
28
  - infra/
29
29
  - infra/**
30
+
31
+ protected:
32
+ - src
33
+ - src/main
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.37
3
+ Version: 0.2.38
4
4
  Summary: Reusable post-generation helper for Cookiecutter micro-service templates
5
5
  Author-email: Will Burks <will@example.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "haraka"
7
- version = "0.2.37"
7
+ version = "0.2.38"
8
8
  description = "Reusable post-generation helper for Cookiecutter micro-service templates"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes
File without changes
File without changes