check-config 0.9.0a2__tar.gz → 0.9.2__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 (175) hide show
  1. {check_config-0.9.0a2 → check_config-0.9.2}/CHANGES.md +9 -1
  2. {check_config-0.9.0a2 → check_config-0.9.2}/Cargo.lock +3 -3
  3. {check_config-0.9.0a2 → check_config-0.9.2}/Cargo.toml +6 -7
  4. {check_config-0.9.0a2 → check_config-0.9.2}/PKG-INFO +1 -1
  5. {check_config-0.9.0a2 → check_config-0.9.2}/docs/checkers.md +131 -18
  6. {check_config-0.9.0a2 → check_config-0.9.2}/docs/usage.md +9 -1
  7. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/check-config.toml +24 -0
  8. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/copy.toml +6 -2
  9. check_config-0.9.2/example/checkers/template.txt +2 -0
  10. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/unpack.toml +2 -2
  11. check_config-0.9.2/example/checkers/vars.toml +2 -0
  12. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/.bashrc +3 -0
  13. check_config-0.9.2/example/expected_output/filled_template.txt +2 -0
  14. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/test.json +1 -0
  15. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/test.toml +2 -1
  16. check_config-0.9.2/example/expected_output/test.yaml +10 -0
  17. check_config-0.9.2/example/input/to_be_removed +0 -0
  18. {check_config-0.9.0a2 → check_config-0.9.2}/mkdocs.yml +2 -1
  19. {check_config-0.9.0a2 → check_config-0.9.2}/pyproject.toml +1 -1
  20. check_config-0.9.2/src/checkers/file/dir_copied.rs +199 -0
  21. check_config-0.9.2/src/checkers/file/dir_present.rs +196 -0
  22. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/entry_absent.rs +3 -3
  23. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/entry_present.rs +83 -2
  24. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/file_absent.rs +1 -1
  25. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/file_copied.rs +29 -6
  26. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/file_present.rs +0 -1
  27. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/key_absent.rs +2 -2
  28. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/key_value_present.rs +8 -11
  29. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/key_value_regex_match.rs +64 -23
  30. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/lines_absent.rs +24 -12
  31. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/lines_present.rs +22 -10
  32. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/mod.rs +27 -10
  33. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/git/mod.rs +1 -0
  34. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/mod.rs +40 -8
  35. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/package/package_present.rs +3 -1
  36. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/test_helpers.rs +4 -2
  37. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/utils.rs +42 -2
  38. {check_config-0.9.0a2 → check_config-0.9.2}/src/cli.rs +19 -5
  39. {check_config-0.9.0a2 → check_config-0.9.2}/src/integration_test.rs +19 -12
  40. {check_config-0.9.0a2 → check_config-0.9.2}/src/mapping/generic.rs +1 -1
  41. {check_config-0.9.0a2 → check_config-0.9.2}/src/mapping/json.rs +14 -3
  42. {check_config-0.9.0a2 → check_config-0.9.2}/src/mapping/toml.rs +4 -4
  43. {check_config-0.9.0a2 → check_config-0.9.2}/src/mapping/yaml.rs +5 -5
  44. {check_config-0.9.0a2 → check_config-0.9.2}/src/uri.rs +21 -1
  45. check_config-0.9.0a2/example/expected_output/test.yaml +0 -9
  46. {check_config-0.9.0a2 → check_config-0.9.2}/.gitignore +0 -0
  47. {check_config-0.9.0a2 → check_config-0.9.2}/.pre-commit-hook.yaml +0 -0
  48. {check_config-0.9.0a2 → check_config-0.9.2}/.readthedocs.yaml +0 -0
  49. {check_config-0.9.0a2 → check_config-0.9.2}/.zellij/env +0 -0
  50. {check_config-0.9.0a2 → check_config-0.9.2}/.zellij/layout.kdl +0 -0
  51. {check_config-0.9.0a2 → check_config-0.9.2}/LICENSE +0 -0
  52. {check_config-0.9.0a2 → check_config-0.9.2}/README.md +0 -0
  53. {check_config-0.9.0a2 → check_config-0.9.2}/docs/examples.md +0 -0
  54. {check_config-0.9.0a2 → check_config-0.9.2}/docs/features.md +0 -0
  55. {check_config-0.9.0a2 → check_config-0.9.2}/docs/glossary.md +0 -0
  56. {check_config-0.9.0a2 → check_config-0.9.2}/docs/index.md +0 -0
  57. {check_config-0.9.0a2 → check_config-0.9.2}/docs/installation.md +0 -0
  58. {check_config-0.9.0a2 → check_config-0.9.2}/docs/requirements.txt +0 -0
  59. {check_config-0.9.0a2 → check_config-0.9.2}/docs/support.md +0 -0
  60. {check_config-0.9.0a2 → check_config-0.9.2}/example/.gitignore +0 -0
  61. {check_config-0.9.0a2 → check_config-0.9.2}/example/check-config-for-usage-doc.toml +0 -0
  62. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/folder/local_file.toml +0 -0
  63. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/folder/relative_local_file.toml +0 -0
  64. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/http_check_config.toml +0 -0
  65. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/http_check_config_relative.toml +0 -0
  66. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/python-logo.svg +0 -0
  67. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/test.tar.gz +0 -0
  68. {check_config-0.9.0a2 → check_config-0.9.2}/example/checkers/test.zip +0 -0
  69. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/.gitconfig +0 -0
  70. /check_config-0.9.0a2/example/input/to_be_removed → /check_config-0.9.2/example/expected_output/created_dir/.gitkeep +0 -0
  71. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/python-logo.svg +0 -0
  72. {check_config-0.9.0a2 → check_config-0.9.2}/example/expected_output/rust-logo.svg +0 -0
  73. {check_config-0.9.0a2 → check_config-0.9.2}/example/input/.bashrc +0 -0
  74. {check_config-0.9.0a2 → check_config-0.9.2}/example/input/test.json +0 -0
  75. {check_config-0.9.0a2 → check_config-0.9.2}/example/input/test.toml +0 -0
  76. {check_config-0.9.0a2 → check_config-0.9.2}/example/input/test.yaml +0 -0
  77. {check_config-0.9.0a2 → check_config-0.9.2}/example/pyproject.toml +0 -0
  78. {check_config-0.9.0a2 → check_config-0.9.2}/example/test.sh +0 -0
  79. {check_config-0.9.0a2 → check_config-0.9.2}/example/test_via_pyproject.sh +0 -0
  80. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/bash.toml +0 -0
  81. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/black.toml +0 -0
  82. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/mypy.toml +0 -0
  83. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/python.toml +0 -0
  84. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/ruff.toml +0 -0
  85. {check_config-0.9.0a2 → check_config-0.9.2}/example_checkers/ruff_.toml +0 -0
  86. {check_config-0.9.0a2 → check_config-0.9.2}/installed.toml +0 -0
  87. {check_config-0.9.0a2 → check_config-0.9.2}/src/bin/check-config.rs +0 -0
  88. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/base.rs +0 -0
  89. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/file/file_unpacked.rs +0 -0
  90. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/package/mod.rs +0 -0
  91. {check_config-0.9.0a2 → check_config-0.9.2}/src/checkers/package/package_absent.rs +0 -0
  92. {check_config-0.9.0a2 → check_config-0.9.2}/src/file_types/ini.rs +0 -0
  93. {check_config-0.9.0a2 → check_config-0.9.2}/src/file_types/json.rs +0 -0
  94. {check_config-0.9.0a2 → check_config-0.9.2}/src/file_types/mod.rs +0 -0
  95. {check_config-0.9.0a2 → check_config-0.9.2}/src/file_types/toml.rs +0 -0
  96. {check_config-0.9.0a2 → check_config-0.9.2}/src/file_types/yaml.rs +0 -0
  97. {check_config-0.9.0a2 → check_config-0.9.2}/src/lib.rs +0 -0
  98. {check_config-0.9.0a2 → check_config-0.9.2}/src/mapping/mod.rs +0 -0
  99. /check_config-0.9.0a2/tests/resources/checkers/entry_absent/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/entry_absent/1/check-config.toml +0 -0
  100. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/expected_output.json +0 -0
  101. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/expected_output.toml +0 -0
  102. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/expected_output.yaml +0 -0
  103. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/input.json +0 -0
  104. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/input.toml +0 -0
  105. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/1/input.yaml +0 -0
  106. /check_config-0.9.0a2/tests/resources/checkers/entry_absent/2/checker.toml → /check_config-0.9.2/tests/resources/checkers/entry_absent/2/check-config.toml +0 -0
  107. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/expected_output.json +0 -0
  108. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/expected_output.toml +0 -0
  109. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/expected_output.yaml +0 -0
  110. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/input.json +0 -0
  111. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/input.toml +0 -0
  112. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_absent/2/input.yaml +0 -0
  113. /check_config-0.9.0a2/tests/resources/checkers/entry_present/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/entry_present/1/check-config.toml +0 -0
  114. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/expected_output.json +0 -0
  115. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/expected_output.toml +0 -0
  116. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/expected_output.yaml +0 -0
  117. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/input.json +0 -0
  118. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/input.toml +0 -0
  119. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/1/input.yaml +0 -0
  120. /check_config-0.9.0a2/tests/resources/checkers/entry_present/2/checker.toml → /check_config-0.9.2/tests/resources/checkers/entry_present/2/check-config.toml +0 -0
  121. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/expected_output.json +0 -0
  122. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/expected_output.toml +0 -0
  123. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/expected_output.yaml +0 -0
  124. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/input.json +0 -0
  125. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/input.toml +0 -0
  126. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/entry_present/2/input.yaml +0 -0
  127. /check_config-0.9.0a2/tests/resources/checkers/key_absent/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_absent/1/check-config.toml +0 -0
  128. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/expected_output.json +0 -0
  129. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/expected_output.toml +0 -0
  130. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/expected_output.yaml +0 -0
  131. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/input.json +0 -0
  132. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/input.toml +0 -0
  133. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_absent/1/input.yaml +0 -0
  134. /check_config-0.9.0a2/tests/resources/checkers/key_value_present/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_present/1/check-config.toml +0 -0
  135. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/expected_output.json +0 -0
  136. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/expected_output.toml +0 -0
  137. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/expected_output.yaml +0 -0
  138. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/input.json +0 -0
  139. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/input.toml +0 -0
  140. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/1/input.yaml +0 -0
  141. /check_config-0.9.0a2/tests/resources/checkers/key_value_present/2/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_present/2/check-config.toml +0 -0
  142. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/expected_output.json +0 -0
  143. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/expected_output.toml +0 -0
  144. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/expected_output.yaml +0 -0
  145. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/input.json +0 -0
  146. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/input.toml +0 -0
  147. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_present/2/input.yaml +0 -0
  148. /check_config-0.9.0a2/tests/resources/checkers/key_value_regex_match/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_regex_match/1/check-config.toml +0 -0
  149. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/expected_output.json +0 -0
  150. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/expected_output.toml +0 -0
  151. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/expected_output.yaml +0 -0
  152. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/input.json +0 -0
  153. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/input.toml +0 -0
  154. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/1/input.yaml +0 -0
  155. /check_config-0.9.0a2/tests/resources/checkers/key_value_regex_match/2/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_regex_match/2/check-config.toml +0 -0
  156. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/expected_output.json +0 -0
  157. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/expected_output.toml +0 -0
  158. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/expected_output.yaml +0 -0
  159. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/input.json +0 -0
  160. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/input.toml +0 -0
  161. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_match/2/input.yaml +0 -0
  162. /check_config-0.9.0a2/tests/resources/checkers/key_value_regex_matched/1/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_regex_matched/1/check-config.toml +0 -0
  163. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/expected_output.json +0 -0
  164. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/expected_output.toml +0 -0
  165. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/expected_output.yaml +0 -0
  166. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/input.json +0 -0
  167. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/input.toml +0 -0
  168. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/1/input.yaml +0 -0
  169. /check_config-0.9.0a2/tests/resources/checkers/key_value_regex_matched/2/checker.toml → /check_config-0.9.2/tests/resources/checkers/key_value_regex_matched/2/check-config.toml +0 -0
  170. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/expected_output.json +0 -0
  171. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/expected_output.toml +0 -0
  172. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/expected_output.yaml +0 -0
  173. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/input.json +0 -0
  174. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/input.toml +0 -0
  175. {check_config-0.9.0a2 → check_config-0.9.2}/tests/resources/checkers/key_value_regex_matched/2/input.yaml +0 -0
@@ -1,6 +1,14 @@
1
1
  # CHANGES
2
2
 
3
- ## 0.9.0.alpha.1
3
+ ## 0.9.2
4
+
5
+ - Feat: add variables and templating
6
+
7
+ ## 0.9.1
8
+
9
+ - Feat: add dir_present
10
+
11
+ ## 0.9.0
4
12
 
5
13
  - BREAKING: refactor the check-config toml files. See documentation for new format.
6
14
 
@@ -178,7 +178,7 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
178
178
 
179
179
  [[package]]
180
180
  name = "check-config"
181
- version = "0.9.0-alpha.2"
181
+ version = "0.9.2"
182
182
  dependencies = [
183
183
  "clap",
184
184
  "clap-verbosity-flag",
@@ -2311,9 +2311,9 @@ dependencies = [
2311
2311
 
2312
2312
  [[package]]
2313
2313
  name = "zip"
2314
- version = "5.1.1"
2314
+ version = "6.0.0"
2315
2315
  source = "registry+https://github.com/rust-lang/crates.io-index"
2316
- checksum = "2f852905151ac8d4d06fdca66520a661c09730a74c6d4e2b0f27b436b382e532"
2316
+ checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b"
2317
2317
  dependencies = [
2318
2318
  "aes",
2319
2319
  "arbitrary",
@@ -1,15 +1,14 @@
1
1
  [package]
2
2
  name = "check-config"
3
- version = "0.9.0-alpha.2"
3
+ version = "0.9.2"
4
4
  edition = "2024"
5
- license = "MIT"
6
- homepage = "https://pypi.org/project/check-config/"
5
+ description = "Check configuration files."
7
6
  documentation = "https://check-config.readthedocs.io"
7
+ readme = "README.md"
8
+ homepage = "https://pypi.org/project/check-config/"
8
9
  repository = "https://github.com/mrijken/check-config"
10
+ license = "MIT"
9
11
  keywords = ["automation", "configuration"]
10
- authors = ["Marc Rijken <marc@rijken.org>"]
11
- readme = "README.md"
12
- description = "Check configuration files."
13
12
  exclude = [".github/*", "videos/*"]
14
13
 
15
14
  [package.metadata.cargo-machete]
@@ -53,7 +52,7 @@ thiserror = { version = "2.0.15", default-features = false }
53
52
  toml = { version = "0.9.5", default-features = false }
54
53
  toml_edit = "0.23.3"
55
54
  url = { version = "2.5.4", default-features = false }
56
- zip = "5.1.1"
55
+ zip = "6.0.0"
57
56
 
58
57
  [profile.release]
59
58
  lto = "fat"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: check-config
3
- Version: 0.9.0a2
3
+ Version: 0.9.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -3,20 +3,22 @@
3
3
  `check-config` uses `checkers` which define the desired state of the configuration files.
4
4
  There are several checker types (and more to come):
5
5
 
6
- | checker type | description | fixable |
7
- | --------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------- |
8
- | [file_absent](#file-absent) | the file must be absent | yes |
9
- | [file_present](#file-present) | the file must be present, indifferent the content | yes |
10
- | [key_absent](#key-absent) | a specified key must be absent in a toml / yaml / json file | yes |
11
- | [key_value_present](#key-value-present) | a specified key with a specified value must be present in a toml / yaml / json file | yes |
12
- | [key_value_regex_matched](#key-value-regex-matched) | the value of a specified key must be match the specified regex in a toml / yaml / json file | no |
13
- | [entry_absent](#entry-absent) | a specified entry must be absent in the array of a toml / yaml / json file | yes |
14
- | [entry_present](#entry-present) | a specified entry must be present in the of a toml / yaml / json file | yes |
15
- | [lines_absent](#lines-absent) | the specified lines must be absent | yes |
16
- | [lines_present](#lines-present) | the specified lines must be present | yes |
17
- | [file_unpacked](#file-unpacked) | the file must be unpacked | yes |
18
- | [file_copied](file-copied) | the file must be copied | yes |
19
- | [git_fetched](#get-fetched) | the git repo must be present and fetched | yes |
6
+ | checker type | description | fixable | templating |
7
+ | --------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------- |-------------|
8
+ | [file_absent](#file-absent) | the file must be absent | yes | no |
9
+ | [file_present](#file-present) | the file must be present, indifferent the content | yes | no |
10
+ | [key_absent](#key-absent) | a specified key must be absent in a toml / yaml / json file | yes | no |
11
+ | [key_value_present](#key-value-present) | a specified key with a specified value must be present in a toml / yaml / json file | yes | no |
12
+ | [key_value_regex_matched](#key-value-regex-matched) | the value of a specified key must be match the specified regex in a toml / yaml / json file | no (unless placeholder is given) | no |
13
+ | [entry_absent](#entry-absent) | a specified entry must be absent in the array of a toml / yaml / json file | yes | no |
14
+ | [entry_present](#entry-present) | a specified entry must be present in the of a toml / yaml / json file | yes | no |
15
+ | [lines_absent](#lines-absent) | the specified lines must be absent | yes | yes |
16
+ | [lines_present](#lines-present) | the specified lines must be present | yes | yes |
17
+ | [file_unpacked](#file-unpacked) | the file must be unpacked | yes | no |
18
+ | [file_copied](file-copied) | the file must be copied | yes | yes |
19
+ | [dir_copied](dir-copied) | the dir must be copied | yes | no |
20
+ | [dir_present](dir-present) | the dir must be present | yes | no |
21
+ | [git_fetched](#get-fetched) | the git repo must be present and fetched | yes | no |
20
22
 
21
23
  ## check-config.toml
22
24
 
@@ -65,21 +67,58 @@ tags = ["linux"]
65
67
  lines = ".cache"
66
68
  ```
67
69
 
68
- ### Fixable
70
+ ### Check-Only
69
71
 
70
72
  When `--fix` is given on the cli, `check-config` will try to fix the checkers. However,
71
73
  sometimes you do not want a fix a violation, but just check if a previous fix is
72
74
  performed correct. For example: you unzip a file in one checker and want to check
73
75
  whether a file is unpacked from the zip. In that case you do not want to create
74
76
  an empty file by the checker which checks for the unpacked file. To do so, add
75
- `fixable = false` to your checker, like:
77
+ `check_only = true` to your checker, like:
76
78
 
77
79
  ```toml
78
80
  [[file_present]]
79
81
  file = "path/to/unpacked_file"
80
- fixable = false
82
+ check_only = true
81
83
  ```
82
84
 
85
+ ### Templating
86
+
87
+ Some checkers support templating. When a checker supports templating, variables
88
+ are substitued by their values. Variables are defined in the top level variables
89
+ key in the toml files.
90
+
91
+ ```toml
92
+ [variables]
93
+ date = "2025-10-10"
94
+ ```
95
+
96
+ Beside adding the variables to the config, you can add all environment variables via the
97
+ `--env` cli option:
98
+
99
+ ```shell
100
+ check-config --env
101
+ ```
102
+
103
+ In your content, the variables within `${}` are replaced when `is_template` is set to true:
104
+
105
+ ```toml
106
+ [[lines_present]]
107
+ file = "test.txt"
108
+ lines = "date: ${date}"
109
+ is_template = true
110
+ ```
111
+
112
+ You can escape variable substitution by adding a `\` ie `\${date}`. During execution
113
+ the unescaped variant `${date}` will replace the escaped one.
114
+
115
+ Notes:
116
+
117
+ - order is important. If variables are inserted after the de definition of a
118
+ checker, they will not be available.
119
+ - variables names are case sensitive.
120
+ - the values of the variables must be strings.
121
+
83
122
  ## File Absent
84
123
 
85
124
  `file_absent` will check if the file is absent.
@@ -182,6 +221,47 @@ When`destination`is given,`destination_dir` is ignored.
182
221
 
183
222
  When the parent dir of the `destination` does not exists, the dir is created.
184
223
 
224
+ ### Templating
225
+
226
+ This checker supports templating.
227
+
228
+ ```toml
229
+ [[file_copied]]
230
+ source = "url or path to file"
231
+ destination = "path (including filename) on local filesystem"
232
+ is_template = true
233
+ ```
234
+
235
+ ## Dir Copied
236
+
237
+ `dir_copied` will check that the dir including all contents is copied.
238
+
239
+ ```toml
240
+ [[dir_copied]]
241
+ source = "path to dir"
242
+ destination_dir = "dir on local filesystem in which the contents are copied"
243
+ destination = "dir on local filesystem in which the source directory is copied"
244
+
245
+ ```
246
+
247
+ Only on `destination` and `destination_dir`` needs to be specified.
248
+ When`destination_dir`is given, the`destination`is created by appending the filename
249
+ from the source to the`destination`.
250
+ When`destination`is given,`destination_dir` is ignored.
251
+
252
+ When the parent dir of the `destination` does not exists, the dir is created.
253
+
254
+ ## Dir Present
255
+
256
+ `dir_present` will check if the dir including the parent directories is present.
257
+ When `permissions` are given, it will also check the permissions.
258
+
259
+ ```toml
260
+ [[dir_present]]
261
+ dir = "path to dir"
262
+ permissions = "755" # optional
263
+ ```
264
+
185
265
  ## File Unpacked
186
266
 
187
267
  `file_unpacked` will check that the file is unpacked. It can unpack zip, tar.gz and tar files.
@@ -287,13 +367,16 @@ This checker type can handle different kind of [mapping file types](#mapping-fil
287
367
 
288
368
  `key_value_regex_matched` will check that the keys specified are present and the value matches the specified regex.
289
369
  Of course, the regex can only match string values.
290
- Keys may be nested. Intermediate keys has to have mappings as values. When intermediate values
370
+
371
+ This checker can only fix when a placeholder is present, otherwise it's check-only. Keys may be nested.
372
+ Intermediate keys has to have mappings as values. When intermediate values
291
373
  are not present, they will be added.
292
374
 
293
375
  ```toml
294
376
  [[key_value_regex_matched]]
295
377
  file = "test/present.toml"
296
378
  key.key = 'v.*'
379
+ placeholder = "v1.1" # optional
297
380
  ```
298
381
 
299
382
  Note: specify the regex as a raw string (single quotes) to be prevent escaping.
@@ -343,6 +426,17 @@ Bla
343
426
  Bla
344
427
  ```
345
428
 
429
+ ### Templating
430
+
431
+ This checker supports templating.
432
+
433
+ ```toml
434
+ [[lines_absent]]
435
+ file = "test.txt"
436
+ lines = "date: ${date}"
437
+ is_template = true
438
+ ```
439
+
346
440
  ## Lines Present
347
441
 
348
442
  `lines_present` will check that the file does contain the lines as specified.
@@ -402,6 +496,17 @@ When one of the markers is not present, the markers and the lines will be append
402
496
  Note: because the checkers are executed in sequence, one can add markers in one checker, which are replaced by
403
497
  a next checker.
404
498
 
499
+ ### Templating
500
+
501
+ This checker supports templating.
502
+
503
+ ```toml
504
+ [[lines_present]]
505
+ file = "test.txt"
506
+ lines = "date: ${date}"
507
+ is_template = true
508
+ ```
509
+
405
510
  ## Mapping File Types
406
511
 
407
512
  The checker types with a key (key_absent, key_value_present, key_value_regex_matched) can we used on several file types
@@ -421,3 +526,11 @@ file = "test/present.toml"
421
526
  file_type = "json"
422
527
  key.key = 1
423
528
  ```
529
+
530
+ The indentation can be changed by specifying the indentation per checker:
531
+
532
+ ```toml
533
+ [[key_value_present]]
534
+ ...
535
+ indent = 2
536
+ ```
@@ -127,6 +127,14 @@ check-config --any-tags tag1,tag2 --all-tags tag3,tag4 --skip-tags tag5,tag6
127
127
  This invocation call checkers which has one of [tag1, tag2], all of [tag3, tag4] and not one of [tag5, tag6]
128
128
  specified in their `__tags__` key.
129
129
 
130
+ ## Environment variables
131
+
132
+ You can use your environment variables in templates of the checkers via the `--env` option:
133
+
134
+ ```shell
135
+ check-config --env
136
+ ```
137
+
130
138
  ## Pre-commit
131
139
 
132
140
  [pre-commit](https://pre-commit.com/) helps checking your code before committing git, so you can catch errors
@@ -138,7 +146,7 @@ you want to use:
138
146
  ```yaml
139
147
  repos:
140
148
  - repo: https://github.com/mrijken/check-config
141
- rev: v0.9.0-alpha.2
149
+ rev: v0.9.2
142
150
  hooks:
143
151
  # Install via Cargo and execute `check-config --fix`
144
152
  - id: check_config_fix_install_via_rust
@@ -1,11 +1,15 @@
1
1
  include = [
2
2
  # "https://raw.githubusercontent.com/mrijken/check-config/refs/heads/main/example/checkers/http_check_config.toml",
3
+ "vars.toml",
3
4
  "http_check_config.toml",
4
5
  "folder/local_file.toml",
5
6
  "copy.toml",
6
7
  "unpack.toml",
7
8
  ]
8
9
 
10
+ [[dir_present]]
11
+ dir = "output/created_dir"
12
+
9
13
  [[file_absent]]
10
14
  file = "output/to_be_removed"
11
15
 
@@ -28,6 +32,11 @@ regex = "export KEY=.*"
28
32
  file = "output/.bashrc"
29
33
  lines = "alias ll='ls -alF'"
30
34
 
35
+ [[lines_present]]
36
+ file = "output/.bashrc"
37
+ lines = "export DATE=\"${date}\""
38
+ is_template = true
39
+
31
40
  [[lines_absent]]
32
41
  file = "output/.bashrc"
33
42
  lines = "alias to_be_removed='ls'"
@@ -70,6 +79,21 @@ key.added.key = "value"
70
79
  file = "output/test.yaml"
71
80
  key.to_be_kept.key = "value"
72
81
 
82
+ [[key_value_regex_matched]]
83
+ file = "output/test.json"
84
+ key.placeholder_regex = "m[a-z]tches"
85
+ placeholder = "matches"
86
+
87
+ [[key_value_regex_matched]]
88
+ file = "output/test.toml"
89
+ key.placeholder_regex = "m[a-z]tches"
90
+ placeholder = "matches"
91
+
92
+ [[key_value_regex_matched]]
93
+ file = "output/test.yaml"
94
+ key.placeholder_regex = "m[a-z]tches"
95
+ placeholder = "matches"
96
+
73
97
  [[entry_absent]]
74
98
  file = "output/absent.json"
75
99
  entry.list2 = ["already_absent"]
@@ -8,10 +8,14 @@ source = "https://rust-lang.org/static/images/rust-logo-blk.svg"
8
8
  destination = "output/python-logo.svg"
9
9
  source = "config:python-logo.svg"
10
10
 
11
+ [[file_copied]]
12
+ destination = "output/filled_template.txt"
13
+ source = "config:template.txt"
14
+ is_template = true
15
+
11
16
  [[file_present]]
12
17
  file = "output/rust-logo.svg"
13
- fixable = false
18
+ check_only = true
14
19
 
15
20
  [[file_present]]
16
21
  file = "output/python-logo.svg"
17
- fixable = false
@@ -0,0 +1,2 @@
1
+ This file will be copied.
2
+ During copy a date will be substituted for \${date}: ${date}
@@ -16,11 +16,11 @@ destination_dir = "output/unpack/tar.gz"
16
16
 
17
17
  [[file_present]]
18
18
  file = "output/unpack/zip/test/sample"
19
- fixable = false
19
+ check_only = true
20
20
 
21
21
  [[file_present]]
22
22
  file = "output/unpack/tar.gz/test/sample"
23
- fixable = false
23
+ check_only = true
24
24
 
25
25
  [[file_absent]]
26
26
  file = "temp/test.zip"
@@ -0,0 +1,2 @@
1
+ [variables]
2
+ date = "2025-10-10"
@@ -1,2 +1,5 @@
1
1
  export KEY="SAMPLE"
2
+
2
3
  alias ll='ls -alF'
4
+
5
+ export DATE="2025-10-10"
@@ -0,0 +1,2 @@
1
+ This file will be copied.
2
+ During copy a date will be substituted for ${date}: 2025-10-10
@@ -9,6 +9,7 @@
9
9
  "list2": [
10
10
  "already_present"
11
11
  ],
12
+ "placeholder_regex": "matches",
12
13
  "regex": "matches",
13
14
  "to_be_added": "value",
14
15
  "to_be_kept": {
@@ -1,7 +1,8 @@
1
1
  regex = "matches"
2
- list = [ "to_be_kept","to_be_added"]
2
+ list = ["to_be_kept", "to_be_added"]
3
3
  list2 = ["already_present"]
4
4
  to_be_added = "value"
5
+ placeholder_regex = "matches"
5
6
 
6
7
  [to_be_kept]
7
8
  key = "value"
@@ -0,0 +1,10 @@
1
+ regex: matches
2
+ to_be_kept:
3
+ key: value
4
+ list:
5
+ - to_be_kept
6
+ - to_be_added
7
+ list2:
8
+ - already_present
9
+ to_be_added: value
10
+ placeholder_regex: matches
File without changes
@@ -23,7 +23,8 @@ theme:
23
23
  - content.code.copy
24
24
 
25
25
  markdown_extensions:
26
- - include
26
+ - markdown_include.include:
27
+ base_path: docs
27
28
  - admonition
28
29
  - toc:
29
30
  permalink: true
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "check-config"
3
- version = "0.9.0-alpha.2"
3
+ version = "0.9.2"
4
4
  description = "Check configuration files."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,199 @@
1
+ use crate::{
2
+ checkers::{base::CheckResult, file::get_string_value_from_checktable},
3
+ uri::{ReadPath, WritablePath},
4
+ };
5
+
6
+ use super::super::{
7
+ GenericChecker,
8
+ base::{CheckConstructor, CheckDefinitionError, CheckError, Checker},
9
+ };
10
+
11
+ #[derive(Debug)]
12
+ pub(crate) struct DirCopied {
13
+ source: WritablePath,
14
+ destination: WritablePath,
15
+ generic_check: GenericChecker,
16
+ }
17
+
18
+ //[[dir_copied]]
19
+ // source = "path directory to copy"
20
+ // destination = "path in which the directory contents will be copied"
21
+ // desintation_dir = "path in which the directory will be copied"
22
+ //
23
+ // check if file is copied
24
+ // if source is a relative path, it's relative to the check file, so the dir
25
+ // which contain the file which defines this check.
26
+ impl CheckConstructor for DirCopied {
27
+ type Output = Self;
28
+
29
+ fn from_check_table(
30
+ generic_check: GenericChecker,
31
+ check_table: toml_edit::Table,
32
+ ) -> Result<Self::Output, CheckDefinitionError> {
33
+ let source = WritablePath::from_string(
34
+ get_string_value_from_checktable(&check_table, "source")?.as_str(),
35
+ )
36
+ .map_err(|_| CheckDefinitionError::InvalidDefinition("invalid source url".into()))?;
37
+
38
+ let destination = if check_table.contains_key("destination") {
39
+ WritablePath::from_string(
40
+ get_string_value_from_checktable(&check_table, "destination")?.as_str(),
41
+ )
42
+ .map_err(|_| {
43
+ CheckDefinitionError::InvalidDefinition("invalid destination path".into())
44
+ })?
45
+ } else {
46
+ let destination_dir = WritablePath::from_string(
47
+ get_string_value_from_checktable(&check_table, "destination_dir")?.as_str(),
48
+ )
49
+ .map_err(|_| {
50
+ CheckDefinitionError::InvalidDefinition("invalid destination_dir path".into())
51
+ })?;
52
+
53
+ let file_name = match source.as_ref().file_name() {
54
+ Some(filename) => filename,
55
+ None => {
56
+ return Err(CheckDefinitionError::InvalidDefinition(
57
+ "Source has to filename".into(),
58
+ ));
59
+ }
60
+ };
61
+
62
+ WritablePath::new(destination_dir.as_ref().join(file_name))
63
+ };
64
+
65
+ Ok(Self {
66
+ destination,
67
+ source,
68
+ generic_check,
69
+ })
70
+ }
71
+ }
72
+
73
+ /// Recursively copy all contents of `src` into `dst`.
74
+ fn copy_dir_contents(src: &std::path::Path, dst: &std::path::Path) -> std::io::Result<()> {
75
+ // Create destination directory if it doesn’t exist
76
+ if !dst.exists() {
77
+ std::fs::create_dir_all(dst)?;
78
+ }
79
+
80
+ for entry in std::fs::read_dir(src)? {
81
+ let entry = entry?;
82
+ let path = entry.path();
83
+ let dest_path = dst.join(entry.file_name());
84
+
85
+ if path.is_dir() {
86
+ // Recurse into subdirectory
87
+ copy_dir_contents(&path, &dest_path)?;
88
+ } else {
89
+ // Copy file
90
+ std::fs::copy(&path, &dest_path)?;
91
+ }
92
+ }
93
+
94
+ Ok(())
95
+ }
96
+
97
+ impl Checker for DirCopied {
98
+ fn checker_type(&self) -> String {
99
+ "dir_copied".to_string()
100
+ }
101
+
102
+ fn generic_checker(&self) -> &GenericChecker {
103
+ &self.generic_check
104
+ }
105
+ fn checker_object(&self) -> String {
106
+ self.source.as_ref().to_string_lossy().to_string()
107
+ }
108
+ fn check_(&self, fix: bool) -> Result<crate::checkers::base::CheckResult, CheckError> {
109
+ // todo check whether the file is changed
110
+ let mut action_messages: Vec<String> = vec![];
111
+
112
+ match self.source.exists() {
113
+ Ok(false) => return Err(CheckError::String("source dir does not exists".into())),
114
+ Ok(true) => (),
115
+ Err(e) => return Err(CheckError::String(e.to_string())),
116
+ }
117
+
118
+ // todo: check also all subdirs and files
119
+ let copy_dir_needed = !self.destination.as_ref().exists();
120
+
121
+ if copy_dir_needed {
122
+ action_messages.push("copy dir".into());
123
+ }
124
+ let action_message = action_messages.join("\n");
125
+
126
+ let check_result = match (copy_dir_needed, fix) {
127
+ (false, _) => CheckResult::NoFixNeeded,
128
+ (true, false) => CheckResult::FixNeeded(action_message),
129
+ (true, true) => {
130
+ match copy_dir_contents(self.source.as_ref(), self.destination.as_ref()) {
131
+ Ok(_) => CheckResult::FixExecuted(action_message),
132
+ Err(e) => return Err(CheckError::String(e.to_string())),
133
+ }
134
+ }
135
+ };
136
+
137
+ Ok(check_result)
138
+ }
139
+ }
140
+
141
+ #[cfg(test)]
142
+ mod tests {
143
+
144
+ use crate::checkers::{base::CheckResult, test_helpers};
145
+
146
+ use super::*;
147
+
148
+ use tempfile::tempdir;
149
+
150
+ fn get_dir_copied_check_with_result()
151
+ -> (Result<DirCopied, CheckDefinitionError>, tempfile::TempDir) {
152
+ let generic_check = test_helpers::get_generic_check();
153
+
154
+ let mut check_table = toml_edit::Table::new();
155
+ let dir = tempdir().unwrap();
156
+ let source = dir.path().join("source");
157
+ let subdir = source.join("subdir");
158
+ std::fs::create_dir_all(&subdir).unwrap();
159
+ let _ = std::fs::create_dir(&subdir);
160
+ let file = subdir.join("file");
161
+ std::fs::File::create(file).unwrap();
162
+ let destination = dir.path().join("destination");
163
+ check_table.insert(
164
+ "destination",
165
+ destination.to_string_lossy().to_string().into(),
166
+ );
167
+ check_table.insert("source", source.to_string_lossy().to_string().into());
168
+ (DirCopied::from_check_table(generic_check, check_table), dir)
169
+ }
170
+
171
+ #[test]
172
+ fn test_dir_copied_from_fs() {
173
+ let (dir_copied_check, _tempdir) = get_dir_copied_check_with_result();
174
+ let dir_copied_check = dir_copied_check.expect("no errors");
175
+
176
+ assert_eq!(
177
+ dir_copied_check.check_(false).unwrap(),
178
+ CheckResult::FixNeeded("copy dir".into())
179
+ );
180
+
181
+ assert_eq!(
182
+ dir_copied_check.check_(true).unwrap(),
183
+ CheckResult::FixExecuted("copy dir".into())
184
+ );
185
+ assert_eq!(
186
+ dir_copied_check.check_(false).unwrap(),
187
+ CheckResult::NoFixNeeded
188
+ );
189
+
190
+ assert!(dir_copied_check.destination.as_ref().exists());
191
+ assert!(
192
+ dir_copied_check
193
+ .destination
194
+ .as_ref()
195
+ .join("subdir/file")
196
+ .exists()
197
+ );
198
+ }
199
+ }