rolfedh-doc-utils 0.1.14__tar.gz → 0.1.16__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.
- {rolfedh_doc_utils-0.1.14/rolfedh_doc_utils.egg-info → rolfedh_doc_utils-0.1.16}/PKG-INFO +19 -3
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/README.md +18 -2
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/archive_unused_files.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/archive_unused_images.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/check_scannability.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/extract_link_attributes.py +23 -3
- rolfedh_doc_utils-0.1.16/doc_utils/version_check.py +204 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/extract_link_attributes.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/find_unused_attributes.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/format_asciidoc_spacing.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/pyproject.toml +1 -1
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/replace_link_attributes.py +15 -2
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16/rolfedh_doc_utils.egg-info}/PKG-INFO +19 -3
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/SOURCES.txt +1 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/validate_links.py +3 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/LICENSE +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/__init__.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/file_utils.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/format_asciidoc_spacing.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/replace_link_attributes.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/scannability.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/spinner.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/topic_map_parser.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/unused_adoc.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/unused_attributes.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/unused_images.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/doc_utils/validate_links.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/dependency_links.txt +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/entry_points.txt +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/requires.txt +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/top_level.txt +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/setup.cfg +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/setup.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_archive_unused_files.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_archive_unused_images.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_auto_discovery.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_check_scannability.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_cli_entry_points.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_extract_link_attributes.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_file_utils.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_archive_unused_files.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_archive_unused_images.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_check_scannability.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_parse_exclude_list.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_replace_link_attributes.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_symlink_handling.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_topic_map_parser.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_unused_attributes.py +0 -0
- {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_validate_links.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rolfedh-doc-utils
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.16
|
|
4
4
|
Summary: CLI tools for AsciiDoc documentation projects
|
|
5
5
|
Author: Rolfe Dlugy-Hegwer
|
|
6
6
|
License: MIT License
|
|
@@ -190,11 +190,27 @@ Before submitting PRs:
|
|
|
190
190
|
|
|
191
191
|
## 📊 Project Status
|
|
192
192
|
|
|
193
|
-
- **Latest Version**: 0.1.
|
|
193
|
+
- **Latest Version**: 0.1.16 (with automatic update notifications)
|
|
194
194
|
- **Python Support**: 3.8+
|
|
195
|
-
- **Test Coverage**:
|
|
195
|
+
- **Test Coverage**: 112+ tests (100% passing)
|
|
196
196
|
- **Dependencies**: Minimal (PyYAML for OpenShift-docs support)
|
|
197
197
|
|
|
198
|
+
### 🔔 Update Notifications
|
|
199
|
+
|
|
200
|
+
All tools now check for updates automatically and notify you when a new version is available:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
📦 Update available: 0.1.15 → 0.1.16
|
|
204
|
+
Run: pip install --upgrade rolfedh-doc-utils
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
To disable update checks, set the environment variable:
|
|
208
|
+
```bash
|
|
209
|
+
export DOC_UTILS_NO_VERSION_CHECK=1
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Update checks are cached for 24 hours to minimize network requests.
|
|
213
|
+
|
|
198
214
|
## 🔗 Resources
|
|
199
215
|
|
|
200
216
|
- [Documentation](https://rolfedh.github.io/doc-utils/)
|
|
@@ -157,11 +157,27 @@ Before submitting PRs:
|
|
|
157
157
|
|
|
158
158
|
## 📊 Project Status
|
|
159
159
|
|
|
160
|
-
- **Latest Version**: 0.1.
|
|
160
|
+
- **Latest Version**: 0.1.16 (with automatic update notifications)
|
|
161
161
|
- **Python Support**: 3.8+
|
|
162
|
-
- **Test Coverage**:
|
|
162
|
+
- **Test Coverage**: 112+ tests (100% passing)
|
|
163
163
|
- **Dependencies**: Minimal (PyYAML for OpenShift-docs support)
|
|
164
164
|
|
|
165
|
+
### 🔔 Update Notifications
|
|
166
|
+
|
|
167
|
+
All tools now check for updates automatically and notify you when a new version is available:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
📦 Update available: 0.1.15 → 0.1.16
|
|
171
|
+
Run: pip install --upgrade rolfedh-doc-utils
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
To disable update checks, set the environment variable:
|
|
175
|
+
```bash
|
|
176
|
+
export DOC_UTILS_NO_VERSION_CHECK=1
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Update checks are cached for 24 hours to minimize network requests.
|
|
180
|
+
|
|
165
181
|
## 🔗 Resources
|
|
166
182
|
|
|
167
183
|
- [Documentation](https://rolfedh.github.io/doc-utils/)
|
|
@@ -9,10 +9,13 @@ For full documentation and usage examples, see archive_unused_files.md in this d
|
|
|
9
9
|
|
|
10
10
|
import argparse
|
|
11
11
|
from doc_utils.unused_adoc import find_unused_adoc
|
|
12
|
+
from doc_utils.version_check import check_version_on_startup
|
|
12
13
|
from doc_utils.file_utils import parse_exclude_list_file
|
|
13
14
|
|
|
14
15
|
from doc_utils.spinner import Spinner
|
|
15
16
|
def main():
|
|
17
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
18
|
+
check_version_on_startup()
|
|
16
19
|
parser = argparse.ArgumentParser(
|
|
17
20
|
description='Archive unused AsciiDoc files.',
|
|
18
21
|
epilog='By default, automatically discovers all modules and assemblies directories in the repository.'
|
|
@@ -8,10 +8,13 @@ For full documentation and usage examples, see archive_unused_files.md in this d
|
|
|
8
8
|
|
|
9
9
|
import argparse
|
|
10
10
|
from doc_utils.unused_images import find_unused_images
|
|
11
|
+
from doc_utils.version_check import check_version_on_startup
|
|
11
12
|
from doc_utils.file_utils import parse_exclude_list_file
|
|
12
13
|
|
|
13
14
|
from doc_utils.spinner import Spinner
|
|
14
15
|
def main():
|
|
16
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
17
|
+
check_version_on_startup()
|
|
15
18
|
parser = argparse.ArgumentParser(description='Archive unused image files.')
|
|
16
19
|
parser.add_argument('--archive', action='store_true', help='Move the files to a dated zip in the archive directory.')
|
|
17
20
|
parser.add_argument('--exclude-dir', action='append', default=[], help='Directory to exclude (can be used multiple times).')
|
|
@@ -17,6 +17,7 @@ import sys
|
|
|
17
17
|
import argparse
|
|
18
18
|
from datetime import datetime
|
|
19
19
|
from doc_utils.scannability import check_scannability
|
|
20
|
+
from doc_utils.version_check import check_version_on_startup
|
|
20
21
|
from doc_utils.file_utils import collect_files, parse_exclude_list_file
|
|
21
22
|
|
|
22
23
|
from doc_utils.spinner import Spinner
|
|
@@ -27,6 +28,8 @@ def print_help():
|
|
|
27
28
|
print(__doc__)
|
|
28
29
|
|
|
29
30
|
def main():
|
|
31
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
32
|
+
check_version_on_startup()
|
|
30
33
|
# Manual check for -h or --help to display the full docstring
|
|
31
34
|
if '-h' in sys.argv or '--help' in sys.argv:
|
|
32
35
|
print_help()
|
|
@@ -235,13 +235,14 @@ def select_link_text(url: str, variations: List[Tuple[str, str, str, int]], inte
|
|
|
235
235
|
return most_common[0]
|
|
236
236
|
|
|
237
237
|
|
|
238
|
-
def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') -> List[Tuple[str, str, str, str, int]]:
|
|
238
|
+
def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both', exclude_files: List[str] = None) -> List[Tuple[str, str, str, str, int]]:
|
|
239
239
|
"""
|
|
240
240
|
Collect all link/xref macros with attributes from all .adoc files.
|
|
241
241
|
|
|
242
242
|
Args:
|
|
243
243
|
scan_dirs: Directories to scan (default: current directory)
|
|
244
244
|
macro_type: Type of macros to find - 'link', 'xref', or 'both' (default: 'both')
|
|
245
|
+
exclude_files: List of file paths to exclude from scanning (typically all attributes files)
|
|
245
246
|
|
|
246
247
|
Returns: List[(file_path, full_macro, url, link_text, line_number)]
|
|
247
248
|
"""
|
|
@@ -250,6 +251,13 @@ def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') ->
|
|
|
250
251
|
|
|
251
252
|
all_macros = []
|
|
252
253
|
|
|
254
|
+
# Normalize all exclude file paths
|
|
255
|
+
exclude_paths = set()
|
|
256
|
+
if exclude_files:
|
|
257
|
+
for file in exclude_files:
|
|
258
|
+
if file: # Check for None or empty string
|
|
259
|
+
exclude_paths.add(os.path.abspath(file))
|
|
260
|
+
|
|
253
261
|
for scan_dir in scan_dirs:
|
|
254
262
|
for root, _, files in os.walk(scan_dir):
|
|
255
263
|
# Skip hidden directories and .archive
|
|
@@ -259,6 +267,9 @@ def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') ->
|
|
|
259
267
|
for file in files:
|
|
260
268
|
if file.endswith('.adoc'):
|
|
261
269
|
file_path = os.path.join(root, file)
|
|
270
|
+
# Skip any attributes files to prevent self-referencing
|
|
271
|
+
if exclude_paths and os.path.abspath(file_path) in exclude_paths:
|
|
272
|
+
continue
|
|
262
273
|
macros = find_link_macros(file_path, macro_type)
|
|
263
274
|
for full_macro, url, link_text, line_num in macros:
|
|
264
275
|
all_macros.append((file_path, full_macro, url, link_text, line_num))
|
|
@@ -510,11 +521,20 @@ def extract_link_attributes(attributes_file: str = None,
|
|
|
510
521
|
existing_attrs = load_existing_attributes(attributes_file)
|
|
511
522
|
spinner.stop(f"Loaded {len(existing_attrs)} existing attributes")
|
|
512
523
|
|
|
513
|
-
#
|
|
524
|
+
# Find all attributes files to exclude from processing
|
|
525
|
+
all_attribute_files = find_attribute_files()
|
|
526
|
+
|
|
527
|
+
# Notify user about excluded files if there are multiple
|
|
528
|
+
if len(all_attribute_files) > 1:
|
|
529
|
+
print(f"Excluding {len(all_attribute_files)} attributes files from processing:")
|
|
530
|
+
for f in all_attribute_files:
|
|
531
|
+
print(f" - {f}")
|
|
532
|
+
|
|
533
|
+
# Collect all macros, excluding ALL attributes files
|
|
514
534
|
macro_desc = {'link': 'link', 'xref': 'xref', 'both': 'link and xref'}[macro_type]
|
|
515
535
|
spinner = Spinner(f"Scanning for {macro_desc} macros with attributes")
|
|
516
536
|
spinner.start()
|
|
517
|
-
all_macros = collect_all_macros(scan_dirs, macro_type)
|
|
537
|
+
all_macros = collect_all_macros(scan_dirs, macro_type, exclude_files=all_attribute_files)
|
|
518
538
|
spinner.stop()
|
|
519
539
|
|
|
520
540
|
if not all_macros:
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Version checking utility for doc-utils.
|
|
4
|
+
|
|
5
|
+
Checks PyPI for the latest version and notifies users if an update is available.
|
|
6
|
+
Includes caching to avoid excessive PyPI requests.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
import time
|
|
13
|
+
import urllib.request
|
|
14
|
+
import urllib.error
|
|
15
|
+
from datetime import datetime, timedelta
|
|
16
|
+
from importlib.metadata import version as get_installed_version
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Optional, Tuple
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_cache_dir() -> Path:
|
|
22
|
+
"""Get the cache directory for version check data."""
|
|
23
|
+
# Use XDG_CACHE_HOME if set, otherwise ~/.cache
|
|
24
|
+
cache_home = os.environ.get('XDG_CACHE_HOME')
|
|
25
|
+
if cache_home:
|
|
26
|
+
cache_dir = Path(cache_home) / 'doc-utils'
|
|
27
|
+
else:
|
|
28
|
+
cache_dir = Path.home() / '.cache' / 'doc-utils'
|
|
29
|
+
|
|
30
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
return cache_dir
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def get_cache_file() -> Path:
|
|
35
|
+
"""Get the cache file path."""
|
|
36
|
+
return get_cache_dir() / 'version_check.json'
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read_cache() -> Optional[dict]:
|
|
40
|
+
"""Read version check cache."""
|
|
41
|
+
cache_file = get_cache_file()
|
|
42
|
+
if not cache_file.exists():
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
with open(cache_file, 'r') as f:
|
|
47
|
+
data = json.load(f)
|
|
48
|
+
# Check if cache is still valid (24 hours)
|
|
49
|
+
last_check = datetime.fromisoformat(data['last_check'])
|
|
50
|
+
if datetime.now() - last_check < timedelta(hours=24):
|
|
51
|
+
return data
|
|
52
|
+
except (json.JSONDecodeError, KeyError, ValueError):
|
|
53
|
+
pass
|
|
54
|
+
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write_cache(latest_version: str, current_version: str):
|
|
59
|
+
"""Write version check cache."""
|
|
60
|
+
cache_file = get_cache_file()
|
|
61
|
+
data = {
|
|
62
|
+
'last_check': datetime.now().isoformat(),
|
|
63
|
+
'latest_version': latest_version,
|
|
64
|
+
'current_version': current_version,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
with open(cache_file, 'w') as f:
|
|
69
|
+
json.dump(data, f)
|
|
70
|
+
except Exception:
|
|
71
|
+
# Silently fail if we can't write cache
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def fetch_latest_version() -> Optional[str]:
|
|
76
|
+
"""Fetch the latest version from PyPI."""
|
|
77
|
+
try:
|
|
78
|
+
# Use PyPI JSON API
|
|
79
|
+
url = 'https://pypi.org/pypi/rolfedh-doc-utils/json'
|
|
80
|
+
with urllib.request.urlopen(url, timeout=2) as response:
|
|
81
|
+
data = json.loads(response.read())
|
|
82
|
+
return data['info']['version']
|
|
83
|
+
except (urllib.error.URLError, json.JSONDecodeError, KeyError, TimeoutError):
|
|
84
|
+
# Silently fail if we can't reach PyPI
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def parse_version(version_str: str) -> Tuple[int, ...]:
|
|
89
|
+
"""Parse version string into tuple of integers for comparison."""
|
|
90
|
+
try:
|
|
91
|
+
# Remove any pre-release or dev suffixes
|
|
92
|
+
version_str = version_str.split('+')[0].split('-')[0]
|
|
93
|
+
return tuple(int(x) for x in version_str.split('.'))
|
|
94
|
+
except (ValueError, AttributeError):
|
|
95
|
+
return (0,)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def check_for_update(force_check: bool = False) -> Optional[str]:
|
|
99
|
+
"""
|
|
100
|
+
Check if a newer version is available.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
force_check: If True, bypass cache and always check PyPI
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
The latest version string if an update is available, None otherwise
|
|
107
|
+
"""
|
|
108
|
+
try:
|
|
109
|
+
current_version = get_installed_version('rolfedh-doc-utils')
|
|
110
|
+
except Exception:
|
|
111
|
+
# Can't determine installed version
|
|
112
|
+
return None
|
|
113
|
+
|
|
114
|
+
# Check cache first (unless forced)
|
|
115
|
+
if not force_check:
|
|
116
|
+
cache_data = read_cache()
|
|
117
|
+
if cache_data:
|
|
118
|
+
latest_version = cache_data['latest_version']
|
|
119
|
+
# Only notify if there's a newer version
|
|
120
|
+
if parse_version(latest_version) > parse_version(current_version):
|
|
121
|
+
return latest_version
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
# Fetch from PyPI
|
|
125
|
+
latest_version = fetch_latest_version()
|
|
126
|
+
if not latest_version:
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
# Cache the result
|
|
130
|
+
write_cache(latest_version, current_version)
|
|
131
|
+
|
|
132
|
+
# Check if update is available
|
|
133
|
+
if parse_version(latest_version) > parse_version(current_version):
|
|
134
|
+
return latest_version
|
|
135
|
+
|
|
136
|
+
return None
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def show_update_notification(latest_version: str, current_version: str = None):
|
|
140
|
+
"""Show update notification to user."""
|
|
141
|
+
if not current_version:
|
|
142
|
+
try:
|
|
143
|
+
current_version = get_installed_version('rolfedh-doc-utils')
|
|
144
|
+
except Exception:
|
|
145
|
+
current_version = 'unknown'
|
|
146
|
+
|
|
147
|
+
# Use stderr to avoid interfering with tool output
|
|
148
|
+
print(f"\n📦 Update available: {current_version} → {latest_version}", file=sys.stderr)
|
|
149
|
+
print(f" Run: pip install --upgrade rolfedh-doc-utils", file=sys.stderr)
|
|
150
|
+
print("", file=sys.stderr)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def check_version_on_startup():
|
|
154
|
+
"""
|
|
155
|
+
Check for updates on tool startup.
|
|
156
|
+
|
|
157
|
+
This should be called early in the main() function of each CLI tool.
|
|
158
|
+
It runs asynchronously and won't block the tool execution.
|
|
159
|
+
"""
|
|
160
|
+
# Skip version check in certain conditions
|
|
161
|
+
if any([
|
|
162
|
+
os.environ.get('DOC_UTILS_NO_VERSION_CHECK'), # User opt-out
|
|
163
|
+
os.environ.get('CI'), # Running in CI
|
|
164
|
+
not sys.stderr.isatty(), # Not running in terminal
|
|
165
|
+
]):
|
|
166
|
+
return
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
latest_version = check_for_update()
|
|
170
|
+
if latest_version:
|
|
171
|
+
show_update_notification(latest_version)
|
|
172
|
+
except Exception:
|
|
173
|
+
# Never let version checking break the tool
|
|
174
|
+
pass
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def disable_version_check():
|
|
178
|
+
"""
|
|
179
|
+
Instructions for disabling version check.
|
|
180
|
+
|
|
181
|
+
Users can disable by setting DOC_UTILS_NO_VERSION_CHECK environment variable.
|
|
182
|
+
"""
|
|
183
|
+
print("To disable version checking, set the environment variable:")
|
|
184
|
+
print(" export DOC_UTILS_NO_VERSION_CHECK=1")
|
|
185
|
+
print("\nOr add it to your shell configuration file.")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
if __name__ == "__main__":
|
|
189
|
+
# For testing/debugging
|
|
190
|
+
import argparse
|
|
191
|
+
parser = argparse.ArgumentParser(description="Check for doc-utils updates")
|
|
192
|
+
parser.add_argument('--force', action='store_true', help='Force check (bypass cache)')
|
|
193
|
+
parser.add_argument('--disable-instructions', action='store_true',
|
|
194
|
+
help='Show instructions for disabling version check')
|
|
195
|
+
args = parser.parse_args()
|
|
196
|
+
|
|
197
|
+
if args.disable_instructions:
|
|
198
|
+
disable_version_check()
|
|
199
|
+
else:
|
|
200
|
+
latest = check_for_update(force_check=args.force)
|
|
201
|
+
if latest:
|
|
202
|
+
show_update_notification(latest)
|
|
203
|
+
else:
|
|
204
|
+
print("You are running the latest version!")
|
|
@@ -10,9 +10,12 @@ attribute references.
|
|
|
10
10
|
import argparse
|
|
11
11
|
import sys
|
|
12
12
|
from doc_utils.extract_link_attributes import extract_link_attributes
|
|
13
|
+
from doc_utils.version_check import check_version_on_startup
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def main():
|
|
17
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
18
|
+
check_version_on_startup()
|
|
16
19
|
"""Main entry point for the extract-link-attributes CLI tool."""
|
|
17
20
|
parser = argparse.ArgumentParser(
|
|
18
21
|
description='Extract link and xref macros containing attributes into attribute definitions',
|
|
@@ -14,8 +14,11 @@ import sys
|
|
|
14
14
|
from datetime import datetime
|
|
15
15
|
from doc_utils.unused_attributes import find_unused_attributes, find_attributes_files, select_attributes_file
|
|
16
16
|
from doc_utils.spinner import Spinner
|
|
17
|
+
from doc_utils.version_check import check_version_on_startup
|
|
17
18
|
|
|
18
19
|
def main():
|
|
20
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
21
|
+
check_version_on_startup()
|
|
19
22
|
parser = argparse.ArgumentParser(description='Find unused AsciiDoc attributes.')
|
|
20
23
|
parser.add_argument(
|
|
21
24
|
'attributes_file',
|
|
@@ -10,6 +10,7 @@ import sys
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
from doc_utils.format_asciidoc_spacing import process_file, find_adoc_files
|
|
13
|
+
from doc_utils.version_check import check_version_on_startup
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
from doc_utils.spinner import Spinner
|
|
@@ -27,6 +28,8 @@ def print_colored(message: str, color: str = Colors.NC) -> None:
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def main():
|
|
31
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
32
|
+
check_version_on_startup()
|
|
30
33
|
"""Main entry point"""
|
|
31
34
|
parser = argparse.ArgumentParser(
|
|
32
35
|
description="Format AsciiDoc files to ensure proper spacing",
|
|
@@ -19,6 +19,7 @@ from doc_utils.replace_link_attributes import (
|
|
|
19
19
|
replace_link_attributes_in_file,
|
|
20
20
|
find_adoc_files
|
|
21
21
|
)
|
|
22
|
+
from doc_utils.version_check import check_version_on_startup
|
|
22
23
|
from doc_utils.spinner import Spinner
|
|
23
24
|
|
|
24
25
|
|
|
@@ -83,6 +84,8 @@ def prompt_for_attributes_file(attributes_files: list[Path]) -> Optional[Path]:
|
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
def main():
|
|
87
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
88
|
+
check_version_on_startup()
|
|
86
89
|
parser = argparse.ArgumentParser(
|
|
87
90
|
description='Replace AsciiDoc attributes within link macros with their actual values.'
|
|
88
91
|
)
|
|
@@ -155,8 +158,18 @@ def main():
|
|
|
155
158
|
adoc_files = find_adoc_files(repo_root)
|
|
156
159
|
spinner.stop()
|
|
157
160
|
|
|
158
|
-
#
|
|
159
|
-
|
|
161
|
+
# Find ALL attributes files to exclude from processing
|
|
162
|
+
all_attribute_files = find_attributes_files(repo_root)
|
|
163
|
+
exclude_paths = {f.resolve() for f in all_attribute_files}
|
|
164
|
+
|
|
165
|
+
# Notify user about excluded files if there are multiple
|
|
166
|
+
if len(all_attribute_files) > 1:
|
|
167
|
+
print(f"Excluding {len(all_attribute_files)} attributes files from processing:")
|
|
168
|
+
for f in all_attribute_files:
|
|
169
|
+
print(f" - {f.relative_to(repo_root)}")
|
|
170
|
+
|
|
171
|
+
# Exclude ALL attributes files, not just the selected one
|
|
172
|
+
adoc_files = [f for f in adoc_files if f.resolve() not in exclude_paths]
|
|
160
173
|
|
|
161
174
|
print(f"Found {len(adoc_files)} AsciiDoc files to process")
|
|
162
175
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rolfedh-doc-utils
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.16
|
|
4
4
|
Summary: CLI tools for AsciiDoc documentation projects
|
|
5
5
|
Author: Rolfe Dlugy-Hegwer
|
|
6
6
|
License: MIT License
|
|
@@ -190,11 +190,27 @@ Before submitting PRs:
|
|
|
190
190
|
|
|
191
191
|
## 📊 Project Status
|
|
192
192
|
|
|
193
|
-
- **Latest Version**: 0.1.
|
|
193
|
+
- **Latest Version**: 0.1.16 (with automatic update notifications)
|
|
194
194
|
- **Python Support**: 3.8+
|
|
195
|
-
- **Test Coverage**:
|
|
195
|
+
- **Test Coverage**: 112+ tests (100% passing)
|
|
196
196
|
- **Dependencies**: Minimal (PyYAML for OpenShift-docs support)
|
|
197
197
|
|
|
198
|
+
### 🔔 Update Notifications
|
|
199
|
+
|
|
200
|
+
All tools now check for updates automatically and notify you when a new version is available:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
📦 Update available: 0.1.15 → 0.1.16
|
|
204
|
+
Run: pip install --upgrade rolfedh-doc-utils
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
To disable update checks, set the environment variable:
|
|
208
|
+
```bash
|
|
209
|
+
export DOC_UTILS_NO_VERSION_CHECK=1
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Update checks are cached for 24 hours to minimize network requests.
|
|
213
|
+
|
|
198
214
|
## 🔗 Resources
|
|
199
215
|
|
|
200
216
|
- [Documentation](https://rolfedh.github.io/doc-utils/)
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/SOURCES.txt
RENAMED
|
@@ -22,6 +22,7 @@ doc_utils/unused_adoc.py
|
|
|
22
22
|
doc_utils/unused_attributes.py
|
|
23
23
|
doc_utils/unused_images.py
|
|
24
24
|
doc_utils/validate_links.py
|
|
25
|
+
doc_utils/version_check.py
|
|
25
26
|
rolfedh_doc_utils.egg-info/PKG-INFO
|
|
26
27
|
rolfedh_doc_utils.egg-info/SOURCES.txt
|
|
27
28
|
rolfedh_doc_utils.egg-info/dependency_links.txt
|
|
@@ -12,10 +12,13 @@ import argparse
|
|
|
12
12
|
import sys
|
|
13
13
|
import json
|
|
14
14
|
from doc_utils.validate_links import LinkValidator, parse_transpositions, format_results
|
|
15
|
+
from doc_utils.version_check import check_version_on_startup
|
|
15
16
|
from doc_utils.spinner import Spinner
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
def main():
|
|
20
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
21
|
+
check_version_on_startup()
|
|
19
22
|
"""Main entry point for the validate-links CLI tool."""
|
|
20
23
|
parser = argparse.ArgumentParser(
|
|
21
24
|
description='Validate links in AsciiDoc documentation',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/rolfedh_doc_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_archive_unused_files.py
RENAMED
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_archive_unused_images.py
RENAMED
|
File without changes
|
{rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.16}/tests/test_fixture_check_scannability.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|