Class: Inquirex::Tools::Changelogs
- Inherits:
-
Object
- Object
- Inquirex::Tools::Changelogs
- Defined in:
- lib/inquirex/tools/changelogs.rb
Overview
Regenerates CHANGELOG.md across the ecosystem from merged GitHub PRs.
The generated files are disposable. inquirex/INQUIREX_VERSION_LOG.md is
not, and is never touched here — a PR title records what merged, not what
it means or what a consumer must do about it.
Constant Summary collapse
- DEFAULT_RUBY =
The gem is not installed for every Ruby the repos pin (inquirex pins 4.0.5), so the generator runs under one that has it rather than being installed into each.
"4.0.6"- PROTECTED =
Never overwritten by generation, in any repo.
%w[INQUIREX_VERSION_LOG.md].freeze
Instance Method Summary collapse
-
#generate(*names) ⇒ Boolean
Runs the generator in each repository.
-
#initialize(workspace: Workspace.new, out: $stdout) ⇒ Changelogs
constructor
A new instance of Changelogs.
-
#repositories ⇒ Array<String>
Every repo carrying a generator config.
Constructor Details
#initialize(workspace: Workspace.new, out: $stdout) ⇒ Changelogs
Returns a new instance of Changelogs.
23 24 25 26 |
# File 'lib/inquirex/tools/changelogs.rb', line 23 def initialize(workspace: Workspace.new, out: $stdout) @workspace = workspace @out = out end |
Instance Method Details
#generate(*names) ⇒ Boolean
Runs the generator in each repository.
The token comes from gh auth token rather than a stored secret, so
nothing here handles a credential in plain text and there is none to
leak from the source.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/inquirex/tools/changelogs.rb', line 43 def generate(*names) token = `gh auth token 2>/dev/null`.strip if token.empty? @out.puts "ERROR: `gh auth token` returned nothing — run `gh auth login`" return false end targets = names.flatten.compact targets = repositories if targets.empty? failed = targets.reject { |name| generate_one(name, token) } report_failures(failed) failed.empty? end |
#repositories ⇒ Array<String>
Returns every repo carrying a generator config.
29 30 31 32 33 |
# File 'lib/inquirex/tools/changelogs.rb', line 29 def repositories (Workspace::LOCKSTEP.keys + Workspace::CHANGELOG_ONLY).uniq.select do |name| File.exist?(File.join(@workspace.root, name, ".github_changelog_generator")) end end |