Sha256: 5f96a7e9c048824d40bdd19fcb0f24621549337f5c6b22d8c4a33a64b64c8e86
Contents?: true
Size: 688 Bytes
Versions: 7
Compression:
Stored size: 688 Bytes
Contents
# frozen_string_literal: true 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
7 entries across 7 versions & 1 rubygems