haraka 0.2.31__tar.gz → 0.2.32__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.31 → haraka-0.2.32}/PKG-INFO +1 -1
  2. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/fileOps/purge.py +53 -36
  3. {haraka-0.2.31 → haraka-0.2.32}/haraka.egg-info/PKG-INFO +1 -1
  4. {haraka-0.2.31 → haraka-0.2.32}/pyproject.toml +1 -1
  5. {haraka-0.2.31 → haraka-0.2.32}/MANIFEST.in +0 -0
  6. {haraka-0.2.31 → haraka-0.2.32}/haraka/__init__.py +0 -0
  7. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/__init__.py +0 -0
  8. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/__init__.py +0 -0
  9. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/assets.py +0 -0
  10. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/frame/__init__.py +0 -0
  11. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/frame/border.py +0 -0
  12. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/frame/framer.py +0 -0
  13. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/ascii/frame/width_utils.py +0 -0
  14. {haraka-0.2.31 → haraka-0.2.32}/haraka/art/create.py +0 -0
  15. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/__init__.py +0 -0
  16. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/config/__init__.py +0 -0
  17. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/config/config.py +0 -0
  18. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/resources/__init__.py +0 -0
  19. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/resources/assets.py +0 -0
  20. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/runner.py +0 -0
  21. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/__init__.py +0 -0
  22. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/command.py +0 -0
  23. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/fileOps/__init__.py +0 -0
  24. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/fileOps/files.py +0 -0
  25. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/gitOps/__init__.py +0 -0
  26. {haraka-0.2.31 → haraka-0.2.32}/haraka/post_gen/service/gitOps/gitops.py +0 -0
  27. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/__init__.py +0 -0
  28. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/common/__init__.py +0 -0
  29. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/common/utils.py +0 -0
  30. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/logging/__init__.py +0 -0
  31. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/logging/log_util.py +0 -0
  32. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/manifests/go-grpc-gateway-buf.yml +0 -0
  33. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/manifests/go-grpc-protoc.yml +0 -0
  34. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/manifests/java-springboot.yml +0 -0
  35. {haraka-0.2.31 → haraka-0.2.32}/haraka/utils/manifests/python-fastapi.yml +0 -0
  36. {haraka-0.2.31 → haraka-0.2.32}/haraka.egg-info/SOURCES.txt +0 -0
  37. {haraka-0.2.31 → haraka-0.2.32}/haraka.egg-info/dependency_links.txt +0 -0
  38. {haraka-0.2.31 → haraka-0.2.32}/haraka.egg-info/top_level.txt +0 -0
  39. {haraka-0.2.31 → haraka-0.2.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.31
3
+ Version: 0.2.32
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
@@ -76,55 +76,72 @@ class ResourcePurger:
76
76
  divider("Project tree after purge…")
77
77
  self._f.print_tree(project_dir)
78
78
 
79
- # --------------------------------------------------------------------------- #
80
- # internals #
81
- # --------------------------------------------------------------------------- #
79
+ # ----------------------------- internals ------------------------------ #
82
80
  def _purge_unrelated(self, root: Path, spec: PathSpec) -> None:
83
81
  """
84
- Walk *root* recursively and delete every path **not** matched by *spec*.
85
- A directory is preserved if **it or any ancestor** is matched.
82
+ Walk the project tree; delete every path NOT matched by *spec*.
83
+
84
+ Updated to align with the `test_java_manifest` logic for cleaner organization.
86
85
  """
87
- all_paths = list(root.rglob("*"))
88
- self._log.debug("📋 Scanning %d paths under %s", len(all_paths), root)
89
86
 
90
- keep: list[str] = []
91
- delete_files: list[str] = []
92
- delete_dirs: list[str] = []
87
+ # Dictionaries to separate matches and non-matches for logging
93
88
 
89
+ # 1) Dump every path under root or state what was found
90
+ all_paths = list(root.rglob("*"))
91
+ if self._log.evm:
92
+ self._log.debug(f"📋 All paths under {root} (total {len(all_paths)}):")
93
+ for p in all_paths:
94
+ print(f"{p.relative_to(root)}")
95
+ else:
96
+ self._log.debug(f"Found {len(all_paths)} paths under {root})")
97
+
98
+ matches, non_matched_files, directories_skipped, non_matched_dirs = [], [], [], []
94
99
  for path in all_paths:
100
+ self._log.debug(f"\nScanning path: {path}")
95
101
  rel = path.relative_to(root).as_posix()
96
-
102
+ self._log.debug(f"Relative path for inspection: {rel}")
103
+ # Match file against the PathSpec
97
104
  if spec.match_file(rel):
98
- keep.append(rel)
99
- continue
100
-
101
- if path.is_dir():
102
- if self._dir_has_kept_ancestor(rel, spec):
103
- self._log.debug("⏭️ SKIP DIR (kept ancestor): %s", rel)
104
- else:
105
- self._log.debug("❌ DELETE DIR: %s", rel)
106
- delete_dirs.append(rel)
105
+ self._log.debug(f"✅ KEEP: Path matches keep patterns: {rel}")
106
+ matches.append(path) # Collect paths to keep
107
107
  else:
108
- self._log.debug("❌ DELETE FILE: %s", rel)
109
- delete_files.append(rel)
108
+ if path.is_dir():
109
+ if self._is_dir_protected(rel, spec):
110
+ self._log.debug(f"{"⏭️ SKIPPING DELETE: Protected ancestor found: %s", path}")
111
+ directories_skipped.append(rel)
112
+ else:
113
+ self._log.debug(f"{"❌ DELETE DIR: %s", rel}")
114
+ self._f.remove_dir(path)
115
+ non_matched_dirs.append(rel)
116
+ else:
117
+ non_matched_files.append(rel)
118
+ self._f.remove_file(path)
119
+ self._log.debug(f"{"❌ DELETE FILE: %s", rel}")
110
120
 
111
- # -- perform deletions -------------------------------------------------- #
112
- for f in delete_files:
113
- self._f.remove_file(root / f)
121
+ # Non-matching paths: collect and delete
122
+ self._log.debug(f"❌ DELETE: Path does not match keep patterns: {rel}")
123
+
124
+ if path.is_dir():
125
+ directories_skipped.append(path)
126
+ self._log.debug(f"⏭️ SKIPPING DELETE: Path is a directory: {path}")
114
127
 
115
- # delete directories bottom-up to avoid “directory not empty” errors
116
- for d in sorted(delete_dirs, key=lambda p: p.count("/"), reverse=True):
117
- (root / d).rmdir()
128
+ # Print results cleanly for debugging/logging purposes
129
+ self._log.info("\nMATCHED PATHS:")
130
+ self._log.info("=" * 80)
131
+ for match in matches:
132
+ self._log.info(f"✅ {match}")
118
133
 
119
- # -- summary ------------------------------------------------------------ #
120
- self._log.info(" kept : %d", len(keep))
121
- self._log.info("🗂️ dirs : %d deleted", len(delete_dirs))
122
- self._log.info("📄 files : %d deleted", len(delete_files))
134
+ self._log.info("\nNOT MATCHED PATHS:")
135
+ self._log.info("=" * 80)
136
+ for non_match in non_matched_files:
137
+ self._log.info(f" {non_match}")
123
138
 
124
139
  @staticmethod
125
- def _dir_has_kept_ancestor(rel: str, spec: PathSpec) -> bool:
140
+ def _is_dir_protected(relative_path: str, spec: PathSpec) -> bool:
126
141
  """
127
- Return True if *rel* **or any of its ancestors** is matched by *spec*.
142
+ Walks from `path` up to `root`, and returns True if any ancestor
143
+ is matched by the spec.
128
144
  """
129
- parts = rel.split("/")
130
- return any(spec.match_file("/".join(parts[: i + 1])) for i in range(len(parts)))
145
+ if spec.match_file(relative_path):
146
+ return True
147
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.31
3
+ Version: 0.2.32
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.31"
7
+ version = "0.2.32"
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