gem_changelog_diff 0.5.0 → 0.6.0
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 +14 -1
- data/README.md +30 -0
- data/ROADMAP.md +1 -15
- data/lib/gem_changelog_diff/cli.rb +42 -7
- data/lib/gem_changelog_diff/formatter.rb +1 -64
- data/lib/gem_changelog_diff/formatters/base.rb +34 -0
- data/lib/gem_changelog_diff/formatters/json.rb +40 -0
- data/lib/gem_changelog_diff/formatters/markdown.rb +43 -0
- data/lib/gem_changelog_diff/formatters/text.rb +68 -0
- data/lib/gem_changelog_diff/interactive.rb +20 -0
- data/lib/gem_changelog_diff/version.rb +1 -1
- data/lib/gem_changelog_diff.rb +5 -0
- data/sig/gem_changelog_diff.rbs +58 -15
- metadata +20 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c58884878cc207c11af411418fb33ec4390458388c078e83197c0cad35f1b50d
|
|
4
|
+
data.tar.gz: 73f6403bc48d9a991d67d7f3da53e327acd08c004fefc3813729794dd2438112
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 231a6934a5924d3b192261bb22e9dfbf419b439e3332cb0d05623bcba85e7a712a49155351c216e36c4fd5e43d3055780fa2ef16d2e644892dc8bfcff8d6eae3
|
|
7
|
+
data.tar.gz: 740990db45157a3661635beb030fa8e57885e9da9e0373ffe1d0c3a847ace03ef7b7219ce1baac7da85d568d24091eccd67859f3079ded0e49812780cebde030
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-06-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Formatter class hierarchy: `Formatters::Text`, `Formatters::Json`, `Formatters::Markdown`
|
|
15
|
+
- `--format` flag: `text` (default), `json`, or `markdown`
|
|
16
|
+
- JSON output (`--format json`) for piping to `jq` or CI tools
|
|
17
|
+
- Markdown output (`--format markdown`) for PR descriptions
|
|
18
|
+
- `--output` flag to write formatted output to a file
|
|
19
|
+
- Interactive gem selection via `tty-prompt` (`--interactive` / `-i` flag)
|
|
20
|
+
- `show` subcommand: `gem_changelog_diff show rails 7.0.0 7.1.0`
|
|
21
|
+
|
|
10
22
|
## [0.5.0] - 2026-06-18
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -64,7 +76,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
64
76
|
- Plain text formatter for changelog output
|
|
65
77
|
- Full end-to-end pipeline: detect → lookup → fetch → format
|
|
66
78
|
|
|
67
|
-
[Unreleased]: https://github.com/eclectic-coding/gem_changelog_diff/compare/v0.
|
|
79
|
+
[Unreleased]: https://github.com/eclectic-coding/gem_changelog_diff/compare/v0.6.0...HEAD
|
|
80
|
+
[0.6.0]: https://github.com/eclectic-coding/gem_changelog_diff/releases/tag/v0.6.0
|
|
68
81
|
[0.5.0]: https://github.com/eclectic-coding/gem_changelog_diff/releases/tag/v0.5.0
|
|
69
82
|
[0.4.0]: https://github.com/eclectic-coding/gem_changelog_diff/releases/tag/v0.4.0
|
|
70
83
|
[0.3.0]: https://github.com/eclectic-coding/gem_changelog_diff/releases/tag/v0.3.0
|
data/README.md
CHANGED
|
@@ -13,9 +13,12 @@ CLI that shows you the changelog diff for each gem before you `bundle update`, p
|
|
|
13
13
|
- [Installation](#installation)
|
|
14
14
|
- [Usage](#usage)
|
|
15
15
|
- [GitHub Authentication](#github-authentication)
|
|
16
|
+
- [Output Formats](#output-formats)
|
|
16
17
|
- [Output Control](#output-control)
|
|
17
18
|
- [Detection Strategy](#detection-strategy)
|
|
18
19
|
- [Filtering](#filtering)
|
|
20
|
+
- [Interactive Mode](#interactive-mode)
|
|
21
|
+
- [Show Subcommand](#show-subcommand)
|
|
19
22
|
- [Caching](#caching)
|
|
20
23
|
- [Development](#development)
|
|
21
24
|
- [Contributing](#contributing)
|
|
@@ -61,6 +64,15 @@ export GITHUB_TOKEN=ghp_your_token
|
|
|
61
64
|
gem_changelog_diff
|
|
62
65
|
```
|
|
63
66
|
|
|
67
|
+
### Output Formats
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
gem_changelog_diff --format text # Plain text with ANSI colors (default)
|
|
71
|
+
gem_changelog_diff --format json # JSON for piping to jq or CI tools
|
|
72
|
+
gem_changelog_diff --format markdown # Markdown for PR descriptions
|
|
73
|
+
gem_changelog_diff --output report.md --format markdown # Write to a file
|
|
74
|
+
```
|
|
75
|
+
|
|
64
76
|
### Output Control
|
|
65
77
|
|
|
66
78
|
```bash
|
|
@@ -88,6 +100,24 @@ gem_changelog_diff --group development # Filter by Bundler group
|
|
|
88
100
|
gem_changelog_diff --ignore rails rake # Exclude specific gems
|
|
89
101
|
```
|
|
90
102
|
|
|
103
|
+
### Interactive Mode
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
gem_changelog_diff --interactive # Multi-select which gems to check
|
|
107
|
+
gem_changelog_diff -i # Short alias
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
After detecting outdated gems, presents a multi-select prompt where you can choose which gems to fetch changelogs for.
|
|
111
|
+
|
|
112
|
+
### Show Subcommand
|
|
113
|
+
|
|
114
|
+
Look up changelogs for a specific gem between two versions, without needing a Gemfile.lock:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
gem_changelog_diff show rails 7.0.8 7.1.3
|
|
118
|
+
gem_changelog_diff show rails 7.0.8 7.1.3 --format json
|
|
119
|
+
```
|
|
120
|
+
|
|
91
121
|
### Caching
|
|
92
122
|
|
|
93
123
|
API responses are cached to `~/.cache/gem_changelog_diff/` with a 24-hour TTL. Subsequent runs reuse cached data and use ETag conditional requests to avoid consuming rate limit.
|
data/ROADMAP.md
CHANGED
|
@@ -2,21 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Feature roadmap for gem_changelog_diff. Each section is auto-pruned by `bin/release` when that version ships.
|
|
4
4
|
|
|
5
|
-
## 0.6.0 -- Interactive Mode & Output Formats
|
|
6
|
-
|
|
7
|
-
Let users selectively browse changelogs. Support machine-readable output for CI and scripting.
|
|
8
|
-
|
|
9
|
-
- Interactive gem selection via `tty-prompt` (`--interactive` / `-i` flag)
|
|
10
|
-
- JSON output (`--format=json`) for piping to `jq` or CI tools
|
|
11
|
-
- Markdown output (`--format=markdown`) for PR descriptions
|
|
12
|
-
- `show` subcommand: `gem_changelog_diff show rails 7.0.0 7.1.0`
|
|
13
|
-
- `--output` flag to write to a file
|
|
14
|
-
|
|
15
|
-
**New files:** `interactive.rb`, `formatters/base.rb`, `formatters/text.rb`, `formatters/json.rb`, `formatters/markdown.rb`
|
|
16
|
-
**Dependencies:** `tty-prompt` (runtime)
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
5
|
## 0.7.0 -- Configuration File & Polish
|
|
21
6
|
|
|
22
7
|
Persistent preferences so users don't repeat flags every run.
|
|
@@ -26,6 +11,7 @@ Persistent preferences so users don't repeat flags every run.
|
|
|
26
11
|
- `init` subcommand: generate a commented config template
|
|
27
12
|
- `version` subcommand
|
|
28
13
|
- `--dry-run` flag: show which gems would be checked without fetching
|
|
14
|
+
- Rails credentials support: read token from `Rails.application.credentials.dig(:gem_changelog_diff, :github_token)` when running inside a Rails app
|
|
29
15
|
|
|
30
16
|
**New files:** `config_loader.rb`
|
|
31
17
|
|
|
@@ -21,21 +21,31 @@ module GemChangelogDiff
|
|
|
21
21
|
class_option :no_cache, type: :boolean, default: false, desc: "Disable caching"
|
|
22
22
|
class_option :cache_ttl, type: :numeric, desc: "Cache TTL in seconds"
|
|
23
23
|
class_option :concurrency, type: :numeric, default: 4, desc: "Number of concurrent fetches"
|
|
24
|
+
class_option :format, type: :string, default: "text", desc: "Output format (text, json, markdown)"
|
|
25
|
+
class_option :output, type: :string, desc: "Write output to file instead of stdout"
|
|
26
|
+
class_option :interactive, type: :boolean, default: false, aliases: "-i",
|
|
27
|
+
desc: "Interactively select gems to check"
|
|
24
28
|
|
|
25
29
|
desc "check [GEM...]", "Show changelog diffs for outdated gems"
|
|
26
30
|
def check(*gem_names)
|
|
27
31
|
configure_token
|
|
28
32
|
gems = detect_gems
|
|
29
33
|
gems = filter_gems(gems, gem_names)
|
|
34
|
+
return say("All gems are up to date!") if gems.empty?
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
end
|
|
36
|
+
gems = Interactive.new(gems: gems).select if options[:interactive]
|
|
37
|
+
return say("No gems selected.") if gems.empty?
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
output_results(gems)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
desc "show GEM FROM_VERSION TO_VERSION", "Show changelog between two versions of a gem"
|
|
43
|
+
def show(gem_name, from_version, to_version)
|
|
44
|
+
configure_token
|
|
45
|
+
gem = OutdatedGem.new(name: gem_name, current_version: from_version, newest_version: to_version)
|
|
46
|
+
report = build_single_report(gem)
|
|
47
|
+
formatter = Formatters.build(format: options[:format], color: color_enabled?)
|
|
48
|
+
write_output(formatter.format([report]))
|
|
39
49
|
end
|
|
40
50
|
|
|
41
51
|
desc "cache SUBCOMMAND", "Manage the cache"
|
|
@@ -139,6 +149,31 @@ module GemChangelogDiff
|
|
|
139
149
|
result
|
|
140
150
|
end
|
|
141
151
|
|
|
152
|
+
def output_results(gems)
|
|
153
|
+
reports = with_spinner { build_reports(gems) }
|
|
154
|
+
formatter = Formatters.build(format: options[:format], color: color_enabled?)
|
|
155
|
+
write_output(formatter.format(reports))
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def build_single_report(gem)
|
|
159
|
+
cache = build_cache
|
|
160
|
+
rubygems_client = RubygemsClient.new(cache: cache)
|
|
161
|
+
source_resolver = SourceResolver.new(
|
|
162
|
+
github_client: GithubClient.new(cache: cache),
|
|
163
|
+
changelog_parser: ChangelogParser.new(cache: cache)
|
|
164
|
+
)
|
|
165
|
+
build_gem_report(gem, rubygems_client, source_resolver)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def write_output(text)
|
|
169
|
+
if options[:output]
|
|
170
|
+
File.write(options[:output], "#{text}\n")
|
|
171
|
+
say "Output written to #{options[:output]}" unless options[:quiet]
|
|
172
|
+
else
|
|
173
|
+
say text
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
142
177
|
def color_enabled?
|
|
143
178
|
!options[:no_color]
|
|
144
179
|
end
|
|
@@ -1,68 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "tty-color"
|
|
4
|
-
|
|
5
3
|
module GemChangelogDiff
|
|
6
|
-
|
|
7
|
-
BOLD = "\e[1m"
|
|
8
|
-
CYAN = "\e[36m"
|
|
9
|
-
GREEN = "\e[32m"
|
|
10
|
-
YELLOW = "\e[33m"
|
|
11
|
-
RED = "\e[31m"
|
|
12
|
-
RESET = "\e[0m"
|
|
13
|
-
|
|
14
|
-
def initialize(color: default_color?)
|
|
15
|
-
@color = color
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def format(gem_reports)
|
|
19
|
-
output = gem_reports.map { |report| format_gem(report) }.join("\n")
|
|
20
|
-
output + summary(gem_reports)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def default_color?
|
|
26
|
-
TTY::Color.color? && ENV.fetch("NO_COLOR", nil).nil?
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def format_gem(report)
|
|
30
|
-
gem = report[:gem]
|
|
31
|
-
header = colorize("== #{gem.name} (#{gem.current_version} → #{gem.newest_version}) ==", BOLD, CYAN)
|
|
32
|
-
|
|
33
|
-
body = if report[:releases].empty?
|
|
34
|
-
colorize(report[:error] || " No changelog entries found.", RED)
|
|
35
|
-
else
|
|
36
|
-
report[:releases].map { |r| format_release(r) }.join("\n")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
"#{header}\n#{body}\n"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def format_release(release)
|
|
43
|
-
title = "--- #{release[:tag_name]}"
|
|
44
|
-
title += " (#{release[:published_at][0..9]})" if release[:published_at]
|
|
45
|
-
title += " ---"
|
|
46
|
-
title = colorize(title, YELLOW)
|
|
47
|
-
|
|
48
|
-
body = release[:body]&.strip.to_s
|
|
49
|
-
body = "(no release notes)" if body.empty?
|
|
50
|
-
"#{title}\n#{body}\n"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def summary(gem_reports)
|
|
54
|
-
total = gem_reports.size
|
|
55
|
-
with_changelogs = gem_reports.count { |r| !r[:releases].empty? }
|
|
56
|
-
skipped = gem_reports.count { |r| r[:error] }
|
|
57
|
-
|
|
58
|
-
line = "\n#{total} gems outdated, #{with_changelogs} with changelogs found, #{skipped} skipped"
|
|
59
|
-
colorize(line, BOLD, GREEN)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def colorize(text, *codes)
|
|
63
|
-
return text unless @color
|
|
64
|
-
|
|
65
|
-
"#{codes.join}#{text}#{RESET}"
|
|
66
|
-
end
|
|
67
|
-
end
|
|
4
|
+
Formatter = Formatters::Text
|
|
68
5
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GemChangelogDiff
|
|
4
|
+
module Formatters
|
|
5
|
+
def self.build(format:, color: false)
|
|
6
|
+
case format
|
|
7
|
+
when "text" then Text.new(color: color)
|
|
8
|
+
when "json" then Json.new
|
|
9
|
+
when "markdown" then Markdown.new
|
|
10
|
+
else raise ArgumentError, "Unknown format: #{format}. Valid formats: text, json, markdown"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Base
|
|
15
|
+
def initialize(color: false)
|
|
16
|
+
@color = color
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def format(_gem_reports)
|
|
20
|
+
raise NotImplementedError, "#{self.class}#format must be implemented"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def summary_counts(gem_reports)
|
|
26
|
+
{
|
|
27
|
+
total: gem_reports.size,
|
|
28
|
+
with_changelogs: gem_reports.count { |r| !r[:releases].empty? },
|
|
29
|
+
skipped: gem_reports.count { |r| r[:error] }
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module GemChangelogDiff
|
|
6
|
+
module Formatters
|
|
7
|
+
class Json < Base
|
|
8
|
+
def format(gem_reports)
|
|
9
|
+
counts = summary_counts(gem_reports)
|
|
10
|
+
|
|
11
|
+
data = {
|
|
12
|
+
gems: gem_reports.map { |report| format_gem(report) },
|
|
13
|
+
summary: counts
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
JSON.pretty_generate(data)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def format_gem(report)
|
|
22
|
+
result = {
|
|
23
|
+
gem: report[:gem].to_h,
|
|
24
|
+
releases: report[:releases].map { |r| stringify_release(r) }
|
|
25
|
+
}
|
|
26
|
+
result[:error] = report[:error] if report[:error]
|
|
27
|
+
result
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def stringify_release(release)
|
|
31
|
+
{
|
|
32
|
+
tag_name: release[:tag_name],
|
|
33
|
+
name: release[:name],
|
|
34
|
+
published_at: release[:published_at],
|
|
35
|
+
body: release[:body]
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GemChangelogDiff
|
|
4
|
+
module Formatters
|
|
5
|
+
class Markdown < Base
|
|
6
|
+
def format(gem_reports)
|
|
7
|
+
sections = gem_reports.map { |report| format_gem(report) }
|
|
8
|
+
sections.push(summary(gem_reports))
|
|
9
|
+
sections.join("\n")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def format_gem(report)
|
|
15
|
+
gem = report[:gem]
|
|
16
|
+
header = "## #{gem.name} (#{gem.current_version} → #{gem.newest_version})"
|
|
17
|
+
|
|
18
|
+
body = if report[:releases].empty?
|
|
19
|
+
report[:error] || "No changelog entries found."
|
|
20
|
+
else
|
|
21
|
+
report[:releases].map { |r| format_release(r) }.join("\n")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
"#{header}\n\n#{body}\n"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def format_release(release)
|
|
28
|
+
title = "### #{release[:tag_name]}"
|
|
29
|
+
title += " (#{release[:published_at][0..9]})" if release[:published_at]
|
|
30
|
+
|
|
31
|
+
body = release[:body]&.strip.to_s
|
|
32
|
+
body = "*(no release notes)*" if body.empty?
|
|
33
|
+
"#{title}\n\n#{body}\n"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def summary(gem_reports)
|
|
37
|
+
counts = summary_counts(gem_reports)
|
|
38
|
+
"_#{counts[:total]} gems outdated, #{counts[:with_changelogs]} with changelogs found, " \
|
|
39
|
+
"#{counts[:skipped]} skipped_\n"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "tty-color"
|
|
4
|
+
|
|
5
|
+
module GemChangelogDiff
|
|
6
|
+
module Formatters
|
|
7
|
+
class Text < Base
|
|
8
|
+
BOLD = "\e[1m"
|
|
9
|
+
CYAN = "\e[36m"
|
|
10
|
+
GREEN = "\e[32m"
|
|
11
|
+
YELLOW = "\e[33m"
|
|
12
|
+
RED = "\e[31m"
|
|
13
|
+
RESET = "\e[0m"
|
|
14
|
+
|
|
15
|
+
def initialize(color: default_color?)
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def format(gem_reports)
|
|
20
|
+
output = gem_reports.map { |report| format_gem(report) }.join("\n")
|
|
21
|
+
output + summary(gem_reports)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def default_color?
|
|
27
|
+
TTY::Color.color? && ENV.fetch("NO_COLOR", nil).nil?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def format_gem(report)
|
|
31
|
+
gem = report[:gem]
|
|
32
|
+
header = colorize("== #{gem.name} (#{gem.current_version} → #{gem.newest_version}) ==", BOLD, CYAN)
|
|
33
|
+
|
|
34
|
+
body = if report[:releases].empty?
|
|
35
|
+
colorize(report[:error] || " No changelog entries found.", RED)
|
|
36
|
+
else
|
|
37
|
+
report[:releases].map { |r| format_release(r) }.join("\n")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
"#{header}\n#{body}\n"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def format_release(release)
|
|
44
|
+
title = "--- #{release[:tag_name]}"
|
|
45
|
+
title += " (#{release[:published_at][0..9]})" if release[:published_at]
|
|
46
|
+
title += " ---"
|
|
47
|
+
title = colorize(title, YELLOW)
|
|
48
|
+
|
|
49
|
+
body = release[:body]&.strip.to_s
|
|
50
|
+
body = "(no release notes)" if body.empty?
|
|
51
|
+
"#{title}\n#{body}\n"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def summary(gem_reports)
|
|
55
|
+
counts = summary_counts(gem_reports)
|
|
56
|
+
line = "\n#{counts[:total]} gems outdated, #{counts[:with_changelogs]} with changelogs found, " \
|
|
57
|
+
"#{counts[:skipped]} skipped"
|
|
58
|
+
colorize(line, BOLD, GREEN)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def colorize(text, *codes)
|
|
62
|
+
return text unless @color
|
|
63
|
+
|
|
64
|
+
"#{codes.join}#{text}#{RESET}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "tty-prompt"
|
|
4
|
+
|
|
5
|
+
module GemChangelogDiff
|
|
6
|
+
class Interactive
|
|
7
|
+
def initialize(gems:)
|
|
8
|
+
@gems = gems
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def select
|
|
12
|
+
prompt = TTY::Prompt.new
|
|
13
|
+
prompt.multi_select("Select gems to check:", per_page: 15) do |menu|
|
|
14
|
+
@gems.each do |gem|
|
|
15
|
+
menu.choice "#{gem.name} (#{gem.current_version} → #{gem.newest_version})", gem
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/gem_changelog_diff.rb
CHANGED
|
@@ -17,5 +17,10 @@ require_relative "gem_changelog_diff/github_client"
|
|
|
17
17
|
require_relative "gem_changelog_diff/changelog_parser"
|
|
18
18
|
require_relative "gem_changelog_diff/source_resolver"
|
|
19
19
|
require_relative "gem_changelog_diff/concurrent_fetcher"
|
|
20
|
+
require_relative "gem_changelog_diff/formatters/base"
|
|
21
|
+
require_relative "gem_changelog_diff/formatters/text"
|
|
22
|
+
require_relative "gem_changelog_diff/formatters/json"
|
|
23
|
+
require_relative "gem_changelog_diff/formatters/markdown"
|
|
20
24
|
require_relative "gem_changelog_diff/formatter"
|
|
25
|
+
require_relative "gem_changelog_diff/interactive"
|
|
21
26
|
require_relative "gem_changelog_diff/cli"
|
data/sig/gem_changelog_diff.rbs
CHANGED
|
@@ -176,35 +176,77 @@ module GemChangelogDiff
|
|
|
176
176
|
?error: String
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
CYAN: String
|
|
182
|
-
GREEN: String
|
|
183
|
-
YELLOW: String
|
|
184
|
-
RED: String
|
|
185
|
-
RESET: String
|
|
179
|
+
module Formatters
|
|
180
|
+
def self.build: (format: String, ?color: bool) -> Base
|
|
186
181
|
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
class Base
|
|
183
|
+
def initialize: (?color: bool) -> void
|
|
184
|
+
def format: (Array[gem_report] gem_reports) -> String
|
|
189
185
|
|
|
190
|
-
|
|
186
|
+
private
|
|
187
|
+
|
|
188
|
+
def summary_counts: (Array[gem_report] gem_reports) -> { total: Integer, with_changelogs: Integer, skipped: Integer }
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
class Text < Base
|
|
192
|
+
BOLD: String
|
|
193
|
+
CYAN: String
|
|
194
|
+
GREEN: String
|
|
195
|
+
YELLOW: String
|
|
196
|
+
RED: String
|
|
197
|
+
RESET: String
|
|
198
|
+
|
|
199
|
+
def initialize: (?color: bool) -> void
|
|
200
|
+
def format: (Array[gem_report] gem_reports) -> String
|
|
201
|
+
|
|
202
|
+
private
|
|
203
|
+
|
|
204
|
+
def default_color?: () -> bool
|
|
205
|
+
def format_gem: (gem_report report) -> String
|
|
206
|
+
def format_release: (release_hash release) -> String
|
|
207
|
+
def summary: (Array[gem_report] gem_reports) -> String
|
|
208
|
+
def colorize: (String text, *String codes) -> String
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
class Json < Base
|
|
212
|
+
def format: (Array[gem_report] gem_reports) -> String
|
|
213
|
+
|
|
214
|
+
private
|
|
215
|
+
|
|
216
|
+
def format_gem: (gem_report report) -> Hash[Symbol, untyped]
|
|
217
|
+
def stringify_release: (release_hash release) -> Hash[Symbol, untyped]
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
class Markdown < Base
|
|
221
|
+
def format: (Array[gem_report] gem_reports) -> String
|
|
222
|
+
|
|
223
|
+
private
|
|
224
|
+
|
|
225
|
+
def format_gem: (gem_report report) -> String
|
|
226
|
+
def format_release: (release_hash release) -> String
|
|
227
|
+
def summary: (Array[gem_report] gem_reports) -> String
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
Formatter: singleton(Formatters::Text)
|
|
191
232
|
|
|
192
|
-
|
|
193
|
-
def
|
|
194
|
-
def
|
|
195
|
-
def summary: (Array[gem_report] gem_reports) -> String
|
|
196
|
-
def colorize: (String text, *String codes) -> String
|
|
233
|
+
class Interactive
|
|
234
|
+
def initialize: (gems: Array[OutdatedGem]) -> void
|
|
235
|
+
def select: () -> Array[OutdatedGem]
|
|
197
236
|
end
|
|
198
237
|
|
|
199
238
|
class CLI < Thor
|
|
200
239
|
def self.exit_on_failure?: () -> bool
|
|
201
240
|
|
|
202
241
|
def check: (*String gem_names) -> void
|
|
242
|
+
def show: (String gem_name, String from_version, String to_version) -> void
|
|
203
243
|
def cache: (?String? subcommand) -> void
|
|
204
244
|
def version: () -> void
|
|
205
245
|
|
|
206
246
|
private
|
|
207
247
|
|
|
248
|
+
def output_results: (Array[OutdatedGem] gems) -> void
|
|
249
|
+
def build_single_report: (OutdatedGem gem) -> gem_report
|
|
208
250
|
def with_spinner: [T] () { () -> T } -> T
|
|
209
251
|
def color_enabled?: () -> bool
|
|
210
252
|
def configure_token: () -> void
|
|
@@ -216,6 +258,7 @@ module GemChangelogDiff
|
|
|
216
258
|
def ignore_list: () -> Array[String]
|
|
217
259
|
def build_reports: (Array[OutdatedGem] gems) -> Array[gem_report]
|
|
218
260
|
def build_gem_report: (OutdatedGem gem, RubygemsClient rubygems_client, SourceResolver source_resolver) -> gem_report
|
|
261
|
+
def write_output: (String text) -> void
|
|
219
262
|
def log: (String message) -> void
|
|
220
263
|
def log_warning: (String message) -> void
|
|
221
264
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gem_changelog_diff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chuck Smith
|
|
@@ -37,6 +37,20 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '0.6'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: tty-prompt
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0.23'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0.23'
|
|
40
54
|
- !ruby/object:Gem::Dependency
|
|
41
55
|
name: tty-spinner
|
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,7 +93,12 @@ files:
|
|
|
79
93
|
- lib/gem_changelog_diff/detector.rb
|
|
80
94
|
- lib/gem_changelog_diff/errors.rb
|
|
81
95
|
- lib/gem_changelog_diff/formatter.rb
|
|
96
|
+
- lib/gem_changelog_diff/formatters/base.rb
|
|
97
|
+
- lib/gem_changelog_diff/formatters/json.rb
|
|
98
|
+
- lib/gem_changelog_diff/formatters/markdown.rb
|
|
99
|
+
- lib/gem_changelog_diff/formatters/text.rb
|
|
82
100
|
- lib/gem_changelog_diff/github_client.rb
|
|
101
|
+
- lib/gem_changelog_diff/interactive.rb
|
|
83
102
|
- lib/gem_changelog_diff/lockfile_parser.rb
|
|
84
103
|
- lib/gem_changelog_diff/outdated_gem.rb
|
|
85
104
|
- lib/gem_changelog_diff/rubygems_client.rb
|