diffstitch 1.0.3
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 +7 -0
- data/CHANGELOG.md +80 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/bin/diffstitch +6 -0
- data/diffstitch.gemspec +35 -0
- data/lib/diffstitch/assets/app.js +104 -0
- data/lib/diffstitch/assets/bootstrap.min.css +6 -0
- data/lib/diffstitch/assets/index.html.erb +43 -0
- data/lib/diffstitch/assets/styles.css +218 -0
- data/lib/diffstitch/cli.rb +98 -0
- data/lib/diffstitch/generator.rb +42 -0
- data/lib/diffstitch/git.rb +26 -0
- data/lib/diffstitch/version.rb +5 -0
- data/lib/diffstitch.rb +9 -0
- metadata +132 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8e3518efc4620730e9fa8677f6cae92de2b51a3b45bd02bc683d4e3286877c89
|
|
4
|
+
data.tar.gz: fece68431738b24b263ac9138414549ee53ee0933afe289f7da8eae3d13590db
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 807313f7773ea6f4613cc6858032e695ae69b14669d6b7d9f672b74b0467aa7e6b001c94367977c35b8874bc48691064af97748d12f55a7fd3f9bbdaf5c0c663
|
|
7
|
+
data.tar.gz: 5ed4e99fe73a8a0676330052fecfa959be5345636eeb822d23af9eb575ad4c58f06ecc5961262fed8c0080b365358d0b69c4968c2270cd22f9d71f5235aa23cf
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.0.3] - 2026-05-22
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Release workflow: add `rake` to bundle and `bundler/gem_tasks` to Rakefile so `rubygems/release-gem` can run `rake release`
|
|
14
|
+
|
|
15
|
+
## [1.0.2] - 2026-05-22
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Release workflow now publishes to RubyGems.org via OIDC trusted publishing before creating the GitHub Release
|
|
19
|
+
|
|
20
|
+
## [1.0.1] - 2026-05-22
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- `--open` now uses the [launchy](https://github.com/copiousfreetime/launchy) gem instead of a raw system command
|
|
24
|
+
|
|
25
|
+
## [1.0.0] - 2026-05-20
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- First stable release
|
|
29
|
+
|
|
30
|
+
## [0.3.1] - 2026-05-20
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- RuboCop and rubocop-rspec as development dependencies
|
|
34
|
+
- `.rubocop.yml` with project-appropriate configuration
|
|
35
|
+
- RuboCop lint step added to CI and default Rake task
|
|
36
|
+
|
|
37
|
+
## [0.3.0] - 2026-05-20
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- Default output directory is now `.diffstitch/output/<base>_vs_<branches>`, derived
|
|
41
|
+
from the branch names being compared (e.g. `main_vs_feature-auth_fix-login`)
|
|
42
|
+
- Slashes in branch names (e.g. `feature/auth`) are replaced with hyphens in the path
|
|
43
|
+
|
|
44
|
+
## [0.2.1] - 2026-05-20
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- Line numbers now stay frozen at the left edge during horizontal scroll
|
|
48
|
+
|
|
49
|
+
## [0.2.0] - 2026-05-20
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- Restyled output HTML to mirror GitHub's diff color palette
|
|
53
|
+
- Switched from Bootstrap dark mode to light mode with a custom dark top nav
|
|
54
|
+
- Added CSS variables for the full color palette
|
|
55
|
+
- Line number gutters, addition/deletion backgrounds, and hunk headers now match GitHub exactly
|
|
56
|
+
|
|
57
|
+
## [0.1.0] - 2026-05-20
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
- `diffstitch` CLI command to generate a split-panel HTML diff report
|
|
61
|
+
- Support for diffing multiple branches against a single base
|
|
62
|
+
- Dark-themed side-by-side diff view powered by [diff2html](https://diff2html.xyz/)
|
|
63
|
+
- Bootstrap 5 for layout and component styling (bundled as a gem asset)
|
|
64
|
+
- Dropdown to switch between comparison branches without reloading
|
|
65
|
+
- Synchronized vertical scrolling between the base and branch panels
|
|
66
|
+
- `--output` flag to set a custom output directory (default: `./diffstitch_output`)
|
|
67
|
+
- `--open` flag to launch the output in the system browser after generating
|
|
68
|
+
- `--title` flag for a custom page title
|
|
69
|
+
- `--version` / `--help` flags
|
|
70
|
+
|
|
71
|
+
[Unreleased]: https://github.com/sroomberg/diffstitch/compare/v1.0.3...HEAD
|
|
72
|
+
[1.0.3]: https://github.com/sroomberg/diffstitch/compare/v1.0.2...v1.0.3
|
|
73
|
+
[1.0.2]: https://github.com/sroomberg/diffstitch/compare/v1.0.1...v1.0.2
|
|
74
|
+
[1.0.1]: https://github.com/sroomberg/diffstitch/compare/v1.0.0...v1.0.1
|
|
75
|
+
[1.0.0]: https://github.com/sroomberg/diffstitch/compare/v0.3.1...v1.0.0
|
|
76
|
+
[0.3.1]: https://github.com/sroomberg/diffstitch/compare/v0.3.0...v0.3.1
|
|
77
|
+
[0.3.0]: https://github.com/sroomberg/diffstitch/compare/v0.2.1...v0.3.0
|
|
78
|
+
[0.2.1]: https://github.com/sroomberg/diffstitch/compare/v0.2.0...v0.2.1
|
|
79
|
+
[0.2.0]: https://github.com/sroomberg/diffstitch/compare/v0.1.0...v0.2.0
|
|
80
|
+
[0.1.0]: https://github.com/sroomberg/diffstitch/releases/tag/v0.1.0
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Steven Roomberg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/bin/diffstitch
ADDED
data/diffstitch.gemspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/diffstitch/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'diffstitch'
|
|
7
|
+
spec.version = Diffstitch::VERSION
|
|
8
|
+
spec.authors = ['Steven Roomberg']
|
|
9
|
+
spec.email = ['stevenroomberg@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'Compare multiple git branches against a base in a split HTML view'
|
|
12
|
+
spec.description = 'A CLI tool that generates a side-by-side HTML report comparing ' \
|
|
13
|
+
'multiple git branches against a common base branch.'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 2.7.0'
|
|
16
|
+
|
|
17
|
+
spec.homepage = 'https://github.com/sroomberg/diffstitch'
|
|
18
|
+
spec.metadata = {
|
|
19
|
+
'homepage_uri' => spec.homepage,
|
|
20
|
+
'source_code_uri' => spec.homepage,
|
|
21
|
+
'changelog_uri' => "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
spec.files = Dir['lib/**/*', 'bin/*', '*.gemspec', 'Gemfile', 'CHANGELOG.md', 'LICENSE']
|
|
25
|
+
spec.bindir = 'bin'
|
|
26
|
+
spec.executables = ['diffstitch']
|
|
27
|
+
spec.require_paths = ['lib']
|
|
28
|
+
|
|
29
|
+
spec.add_dependency 'launchy', '~> 3.1'
|
|
30
|
+
|
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
|
34
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 3.0'
|
|
35
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { base, title, branches } = DIFF_DATA;
|
|
5
|
+
const branchNames = Object.keys(branches);
|
|
6
|
+
const staging = document.getElementById('diff-staging');
|
|
7
|
+
const cache = {};
|
|
8
|
+
|
|
9
|
+
document.title = title;
|
|
10
|
+
document.getElementById('page-title').textContent = title;
|
|
11
|
+
document.getElementById('base-label').textContent = base;
|
|
12
|
+
|
|
13
|
+
const select = document.getElementById('branch-select');
|
|
14
|
+
branchNames.forEach(function (name) {
|
|
15
|
+
const opt = document.createElement('option');
|
|
16
|
+
opt.value = name;
|
|
17
|
+
opt.textContent = name;
|
|
18
|
+
select.appendChild(opt);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
function renderBranchDiff(name) {
|
|
22
|
+
const diff = branches[name];
|
|
23
|
+
|
|
24
|
+
if (!diff || !diff.trim()) {
|
|
25
|
+
return {
|
|
26
|
+
left: mkMessage('No files changed vs ' + base),
|
|
27
|
+
right: mkMessage('Identical to ' + base),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const html = Diff2Html.html(diff, {
|
|
32
|
+
drawFileList: false,
|
|
33
|
+
matching: 'lines',
|
|
34
|
+
outputFormat: 'side-by-side',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
staging.innerHTML = html;
|
|
38
|
+
|
|
39
|
+
const leftEl = document.createElement('div');
|
|
40
|
+
const rightEl = document.createElement('div');
|
|
41
|
+
|
|
42
|
+
staging.querySelectorAll('.d2h-file-wrapper').forEach(function (wrapper) {
|
|
43
|
+
const header = wrapper.querySelector('.d2h-file-header');
|
|
44
|
+
const sides = wrapper.querySelectorAll('.d2h-file-side-diff');
|
|
45
|
+
if (!sides || sides.length < 2) return;
|
|
46
|
+
|
|
47
|
+
[leftEl, rightEl].forEach(function (container, i) {
|
|
48
|
+
const w = document.createElement('div');
|
|
49
|
+
w.className = 'd2h-file-wrapper';
|
|
50
|
+
if (header) w.appendChild(header.cloneNode(true));
|
|
51
|
+
const fd = document.createElement('div');
|
|
52
|
+
fd.className = 'd2h-files-diff';
|
|
53
|
+
fd.appendChild(sides[i].cloneNode(true));
|
|
54
|
+
w.appendChild(fd);
|
|
55
|
+
container.appendChild(w);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
staging.innerHTML = '';
|
|
60
|
+
return { left: leftEl, right: rightEl };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function mkMessage(msg) {
|
|
64
|
+
const div = document.createElement('div');
|
|
65
|
+
div.className = 'empty-state';
|
|
66
|
+
div.textContent = msg;
|
|
67
|
+
return div;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function showBranch(name) {
|
|
71
|
+
if (!cache[name]) cache[name] = renderBranchDiff(name);
|
|
72
|
+
|
|
73
|
+
const { left, right } = cache[name];
|
|
74
|
+
const lc = document.getElementById('left-content');
|
|
75
|
+
const rc = document.getElementById('right-content');
|
|
76
|
+
|
|
77
|
+
lc.innerHTML = '';
|
|
78
|
+
rc.innerHTML = '';
|
|
79
|
+
lc.appendChild(left.cloneNode(true));
|
|
80
|
+
rc.appendChild(right.cloneNode(true));
|
|
81
|
+
|
|
82
|
+
document.getElementById('branch-label').textContent = name;
|
|
83
|
+
lc.scrollTop = 0;
|
|
84
|
+
rc.scrollTop = 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var syncing = false;
|
|
88
|
+
var lc = document.getElementById('left-content');
|
|
89
|
+
var rc = document.getElementById('right-content');
|
|
90
|
+
|
|
91
|
+
function syncScroll(source, target) {
|
|
92
|
+
if (syncing) return;
|
|
93
|
+
syncing = true;
|
|
94
|
+
target.scrollTop = source.scrollTop;
|
|
95
|
+
syncing = false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
lc.addEventListener('scroll', function () { syncScroll(lc, rc); });
|
|
99
|
+
rc.addEventListener('scroll', function () { syncScroll(rc, lc); });
|
|
100
|
+
|
|
101
|
+
select.addEventListener('change', function () { showBranch(select.value); });
|
|
102
|
+
|
|
103
|
+
if (branchNames.length > 0) showBranch(branchNames[0]);
|
|
104
|
+
}());
|