Sha256: c02f74ac19a83ad530334760c7015123c0c3837cc6a48a297f90756b2193f3e4
Contents?: true
Size: 631 Bytes
Versions: 5
Compression:
Stored size: 631 Bytes
Contents
module KeepUp # Filter to update dependency information in a Gemspec. module GemspecFilter def self.apply(contents, dependency) matcher = dependency_matcher(dependency) contents.each_line.map do |line| if line =~ matcher match = Regexp.last_match "#{match[1]}#{dependency.version}#{match[2]}" else line end end.join end def self.dependency_matcher(dependency) / ^(.*_dependency \s*(?:\(\s*)? (?:['"]|%q.)#{dependency.name}.(?:\.freeze)?, \s+\[?['"](?:~>|=)?\ *)[^'"]*(['"].*) /mx end end end
Version data entries
5 entries across 5 versions & 1 rubygems