Class: Bundler::Patch::RubyVersion

Inherits:
UpdateSpec show all
Defined in:
lib/bundler/patch/ruby_version.rb

Instance Attribute Summary

Attributes inherited from UpdateSpec

#patched_versions, #regexes, #target_dir, #target_file

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UpdateSpec

#calc_new_version, #file_replace, #target_path_fn, #update_to_new_version, #verbose_puts

Constructor Details

#initialize(target_dir: Dir.pwd, patched_versions: []) ⇒ RubyVersion

Returns a new instance of RubyVersion.



10
11
12
13
14
15
# File 'lib/bundler/patch/ruby_version.rb', line 10

def initialize(target_dir: Dir.pwd, patched_versions: [])
  super(target_file: target_file,
        target_dir: target_dir,
        regexes: regexes,
        patched_versions: patched_versions)
end

Class Method Details

.filesObject



3
4
5
6
7
8
# File 'lib/bundler/patch/ruby_version.rb', line 3

def self.files
  {
    '.ruby-version' => [/.*/],
    '.jenkins.xml' => [/\<string\>(.*)\<\/string\>/, /rvm.*\>ruby-(.*)@/, /version.*rbenv.*\>(.*)\</]
  }
end

Instance Method Details

#updateObject



17
18
19
20
21
22
23
# File 'lib/bundler/patch/ruby_version.rb', line 17

def update
  self.class.files.each_pair do |file, regexes|
    @target_file = file
    @regexes = regexes
    file_replace
  end
end