compare_logs 0.4.0 → 0.5.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +63 -0
- data/README.md +13 -8
- data/compare_logs.gemspec +3 -6
- data/lib/compare_logs/version.rb +1 -1
- data/lib/compare_logs.rb +30 -15
- metadata +4 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed6ef09abaee145c706d044fcb4b44db42557c42306d3a9ba485a095c7408bc3
|
|
4
|
+
data.tar.gz: f45467b0e724460447a6c81e234ec13ed6491532bd1c2026064e063ae9ed75ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b84a4add4b5d65d2337186cf46efcd4964024e11b401c185b7cf2907845b4f8f8ef5a7f6df5b19e4fc20e082d89b033d58ca588e8ab90732cccfac42df0c2944
|
|
7
|
+
data.tar.gz: 6e9f928c26e71b04bc9d2244b71b8e01099b2ce292478060a186e411937ee858efd4479e406d8aebee262f43cd90ac957b6aca9b82f86f54409ae1eaa6435c93
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.1] - 2025-11-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- ISO 8601 timestamp format support (e.g., "2025-10-22T23:57:34Z")
|
|
7
|
+
- HTTP date format support (e.g., "Wed, 22 Oct 2025 23:57:37 GMT")
|
|
8
|
+
|
|
9
|
+
## [0.5.0] - 2025-11-18
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **Breaking Change**: Config file moved from `.env` to `~/.compare_logs` for simpler, centralized configuration
|
|
13
|
+
- Removed dotenv dependency (no longer needed)
|
|
14
|
+
- Config file now uses simple line-based format with comments support
|
|
15
|
+
- Renamed `.env.example` to `compare_logs.example`
|
|
16
|
+
|
|
17
|
+
### Improved
|
|
18
|
+
- Simplified custom substitution configuration
|
|
19
|
+
- Better documentation for configuration options
|
|
20
|
+
|
|
21
|
+
## [0.4.0] - 2025-11-18
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Added `--ignore-timings` flag to normalize timing strings (e.g., "1.234 seconds", "5 minutes") to TIMING placeholder
|
|
25
|
+
|
|
26
|
+
## [0.3.0] - 2025-11-18
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Added `--ignore-versions` flag to normalize semantic version strings (x.y.z) to VERSION placeholder
|
|
30
|
+
|
|
31
|
+
## [0.2.0] - 2025-11-18
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- Added `--aggressive` flag to remove all identical lines after normalization, showing only differences
|
|
35
|
+
- Support for combining multiple flags
|
|
36
|
+
|
|
37
|
+
## [0.1.3] - 2025-11-18
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- Improved encoding handling with explicit UTF-8 validation after reading files
|
|
41
|
+
- Better error handling for invalid byte sequences
|
|
42
|
+
|
|
43
|
+
## [0.1.2] - 2025-11-18
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Fixed encoding errors when reading UTF-16LE encoded log files
|
|
47
|
+
- Added fallback encoding support (UTF-8 → UTF-16LE → binary with scrubbing)
|
|
48
|
+
|
|
49
|
+
## [0.1.1] - 2025-11-17
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- Custom substitution patterns via `.env` file with `COMPARE_LOGS_SUBSTITUTIONS` environment variable
|
|
53
|
+
- Dotenv gem dependency for environment variable support
|
|
54
|
+
- Rake tasks for version bumping (`version:bump_patch`, `version:bump_minor`, `version:bump_major`)
|
|
55
|
+
- Rake task for changelog generation from git commits (`changelog:generate`)
|
|
56
|
+
- GitHub Actions CI workflow for testing on multiple Ruby versions (2.7, 3.0, 3.1, 3.2)
|
|
57
|
+
- GitHub Actions release workflow with automatic version bumping, changelog generation, and RubyGems publishing
|
|
58
|
+
- `.env.example` file with documentation for custom substitutions
|
|
59
|
+
- Comprehensive documentation in README for all new features
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Refactored substitution logic to use constant `DEFAULT_SUBSTITUTIONS` array
|
|
63
|
+
- Moved hardcoded buildkite path substitution to default substitutions
|
|
64
|
+
- Fixed gemspec to use file globbing instead of `git ls-files` for non-git repositories
|
|
65
|
+
|
|
3
66
|
## [0.1.0] - 2025-11-14
|
|
4
67
|
|
|
5
68
|
### Added
|
data/README.md
CHANGED
|
@@ -71,22 +71,27 @@ CompareLogs normalizes variable data in log files to make meaningful comparisons
|
|
|
71
71
|
|
|
72
72
|
After normalization, it opens the files in `gvimdiff` for visual comparison.
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## Options
|
|
75
|
+
|
|
76
|
+
- `--aggressive` - Remove all lines that are identical in both files after normalization
|
|
77
|
+
- `--ignore-versions` - Normalize x.y.z version strings to VERSION
|
|
78
|
+
- `--ignore-timings` - Normalize timing strings (e.g., '1.234 seconds') to TIMING
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
Options can be combined for maximum noise reduction.
|
|
81
|
+
|
|
82
|
+
## Custom Substitutions
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
2. Add custom patterns using the `COMPARE_LOGS_SUBSTITUTIONS` variable
|
|
84
|
+
You can add your own custom substitutions using a config file at `~/.compare_logs`:
|
|
80
85
|
|
|
81
86
|
```bash
|
|
82
87
|
# Format: pattern|||replacement (use ||| as separator)
|
|
83
|
-
|
|
88
|
+
# One pattern per line, lines starting with # are comments
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
/my/custom/path/\d+|||CUSTOM_PATH
|
|
91
|
+
\b[A-Z]{3,}_\d+\b|||IDENTIFIER
|
|
87
92
|
```
|
|
88
93
|
|
|
89
|
-
Custom substitutions are applied in addition to the default patterns.
|
|
94
|
+
See `compare_logs.example` for more examples. Custom substitutions are applied in addition to the default patterns.
|
|
90
95
|
|
|
91
96
|
## Development
|
|
92
97
|
|
data/compare_logs.gemspec
CHANGED
|
@@ -13,19 +13,16 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
spec.required_ruby_version = ">= 2.6.0"
|
|
14
14
|
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
16
|
-
spec.metadata["source_code_uri"] = "https://github.com/
|
|
17
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/stringsn88keys/compare_logs"
|
|
17
|
+
spec.metadata["changelog_uri"] = "https://github.com/stringsn88keys/compare_logs/blob/main/CHANGELOG.md"
|
|
18
18
|
|
|
19
19
|
# Specify which files should be added to the gem when it is released.
|
|
20
20
|
spec.files = Dir["{lib,exe}/**/*", "*.md", "*.txt", "*.gemspec", "Gemfile", "Rakefile"]
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
spec.bindir = "exe"
|
|
23
23
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
24
24
|
spec.require_paths = ["lib"]
|
|
25
25
|
|
|
26
|
-
# Runtime dependencies
|
|
27
|
-
spec.add_dependency "dotenv", "~> 2.8"
|
|
28
|
-
|
|
29
26
|
# Development dependencies
|
|
30
27
|
spec.add_development_dependency "bundler", "~> 2.0"
|
|
31
28
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/lib/compare_logs/version.rb
CHANGED
data/lib/compare_logs.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require_relative "compare_logs/version"
|
|
2
|
-
require "dotenv"
|
|
3
2
|
|
|
4
3
|
module CompareLogs
|
|
5
4
|
class Error < StandardError; end
|
|
@@ -10,9 +9,11 @@ module CompareLogs
|
|
|
10
9
|
# Default substitutions that are always applied
|
|
11
10
|
DEFAULT_SUBSTITUTIONS = [
|
|
12
11
|
[/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{7}/, 'BUILD_TIMESTAMP'],
|
|
12
|
+
[/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, 'ISO8601_TIMESTAMP'],
|
|
13
13
|
[/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{9} [-+]\d{4}/, 'INTERNAL_TIMESTAMP'],
|
|
14
14
|
[/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[-+]\d{2}:\d{2}/, 'INTERNAL_TIMESTAMP2'],
|
|
15
15
|
[/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, 'INTERNAL_TIMESTAMP3'],
|
|
16
|
+
[/\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT/, 'HTTP_DATE'],
|
|
16
17
|
[/\d{14}/, 'INTEGER_TIMESTAMP'],
|
|
17
18
|
[/\d{2}\/\d{2}\/\d{4} \d{1,2}:\d{2}:\d{2} [AP]M/, 'WINDOWS_TIMESTAMP'],
|
|
18
19
|
[/\d{14}\.\d{4}/, 'BUILDLOG_TIMESTAMP'],
|
|
@@ -147,19 +148,17 @@ module CompareLogs
|
|
|
147
148
|
def load_custom_substitutions
|
|
148
149
|
@custom_substitutions = []
|
|
149
150
|
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
ENV['COMPARE_LOGS_SUBSTITUTIONS'].split(',').each do |sub|
|
|
162
|
-
pattern_str, replacement = sub.split('|||', 2)
|
|
151
|
+
# Load config from ~/.compare_logs
|
|
152
|
+
config_file = File.expand_path('~/.compare_logs')
|
|
153
|
+
|
|
154
|
+
if File.exist?(config_file)
|
|
155
|
+
File.readlines(config_file).each do |line|
|
|
156
|
+
# Skip comments and empty lines
|
|
157
|
+
line = line.strip
|
|
158
|
+
next if line.empty? || line.start_with?('#')
|
|
159
|
+
|
|
160
|
+
# Parse pattern|||replacement format
|
|
161
|
+
pattern_str, replacement = line.split('|||', 2)
|
|
163
162
|
next unless pattern_str && replacement
|
|
164
163
|
|
|
165
164
|
begin
|
|
@@ -203,7 +202,23 @@ module CompareLogs
|
|
|
203
202
|
|
|
204
203
|
def launch_diff_viewer
|
|
205
204
|
modified_files = @files.map { |f| "\"#{f}.modified\"" }.join(' ')
|
|
206
|
-
|
|
205
|
+
|
|
206
|
+
# Try diff viewers in order of preference
|
|
207
|
+
viewers = ['gvimdiff', 'windiff', 'diff']
|
|
208
|
+
|
|
209
|
+
viewer_found = viewers.find do |viewer|
|
|
210
|
+
# Check if the command exists
|
|
211
|
+
system("which #{viewer} > /dev/null 2>&1")
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
if viewer_found
|
|
215
|
+
system("#{viewer_found} #{modified_files}")
|
|
216
|
+
else
|
|
217
|
+
puts "No diff viewer found. Tried: #{viewers.join(', ')}"
|
|
218
|
+
puts "Modified files created:"
|
|
219
|
+
@files.each { |f| puts " #{f}.modified" }
|
|
220
|
+
exit 1
|
|
221
|
+
end
|
|
207
222
|
end
|
|
208
223
|
|
|
209
224
|
def print_usage
|
metadata
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: compare_logs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Powell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: dotenv
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.8'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '2.8'
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: bundler
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,8 +77,8 @@ licenses:
|
|
|
91
77
|
- MIT
|
|
92
78
|
metadata:
|
|
93
79
|
homepage_uri: https://github.com/stringsn88keys/compare_logs
|
|
94
|
-
source_code_uri: https://github.com/
|
|
95
|
-
changelog_uri: https://github.com/
|
|
80
|
+
source_code_uri: https://github.com/stringsn88keys/compare_logs
|
|
81
|
+
changelog_uri: https://github.com/stringsn88keys/compare_logs/blob/main/CHANGELOG.md
|
|
96
82
|
post_install_message:
|
|
97
83
|
rdoc_options: []
|
|
98
84
|
require_paths:
|