class YAVM::Stores::GemSpec
Constants
- REGEX
Public Instance Methods
glob()
click to toggle source
# File lib/yavm/stores/gem_spec.rb, line 14 def glob './*.gemspec' end
name()
click to toggle source
# File lib/yavm/stores/gem_spec.rb, line 10 def name "gemspec: #{filename}" end
set!(new_version)
click to toggle source
Munge the existing file to replace the version identifier. This might be a bit brittle, although it's slightly better than it was.
The match groups in use are as follows
1: Everything before the ".version =" line 3: The start of that line, up to the opening quote 4: Backreference to the opening quote 6: The rest of the file
# File lib/yavm/stores/gem_spec.rb, line 37 def set!(new_version) current_spec = IO.read(filename) new_spec = current_spec.gsub(REGEX) do m = Regexp.last_match next [m[1], m[3], new_version, m[4], m[6]].join end File.open(filename, 'w') { |f| f.write new_spec } end
spec()
click to toggle source
# File lib/yavm/stores/gem_spec.rb, line 18 def spec @spec ||= Gem::Specification.load(filename) end
to_version()
click to toggle source
# File lib/yavm/stores/gem_spec.rb, line 22 def to_version Version.new(self, spec.version.to_s.gsub('.pre.', '-')) end