Class: Rake::Gem::Maintenance::RubyVersionUpdater
- Inherits:
-
Object
- Object
- Rake::Gem::Maintenance::RubyVersionUpdater
- Defined in:
- lib/rake/gem/maintenance/ruby_version_updater.rb
Overview
Updates Ruby version references in .ruby-version, gemspec, and CI config files.
Instance Method Summary collapse
-
#initialize(ruby_version_file: ".ruby-version", gemspec_files: Dir.glob("*.gemspec"), github_workflow_files: Dir.glob(".github/workflows/*.yml"), woodpecker_config_files: Dir.glob(".woodpecker/*.yml")) ⇒ RubyVersionUpdater
constructor
A new instance of RubyVersionUpdater.
- #update(checker:) ⇒ Object
Constructor Details
#initialize(ruby_version_file: ".ruby-version", gemspec_files: Dir.glob("*.gemspec"), github_workflow_files: Dir.glob(".github/workflows/*.yml"), woodpecker_config_files: Dir.glob(".woodpecker/*.yml")) ⇒ RubyVersionUpdater
Returns a new instance of RubyVersionUpdater.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rake/gem/maintenance/ruby_version_updater.rb', line 8 def initialize( ruby_version_file: ".ruby-version", gemspec_files: Dir.glob("*.gemspec"), github_workflow_files: Dir.glob(".github/workflows/*.yml"), woodpecker_config_files: Dir.glob(".woodpecker/*.yml") ) @ruby_version_file = ruby_version_file @gemspec_files = Array(gemspec_files) @github_workflow_files = Array(github_workflow_files) @woodpecker_config_files = Array(woodpecker_config_files) end |
Instance Method Details
#update(checker:) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rake/gem/maintenance/ruby_version_updater.rb', line 20 def update(checker:) latest = checker.latest_stable minors = checker.maintained_minors return [] if latest.nil? || minors.empty? [ write_ruby_version_file(latest), *@gemspec_files.map { |f| patch_gemspec(f, latest) }, *@github_workflow_files.map { |f| patch_github_workflow(f, minors) }, *@woodpecker_config_files.map { |f| patch_woodpecker_config(f, latest) } ].compact end |