Module: Reissue::Gem

Included in:
Task
Defined in:
lib/reissue/gem.rb

Instance Method Summary collapse

Instance Method Details

#apply_version_bump(updater, bump) ⇒ Object

Keep bundler's gemspec in step with the bump.

Bundler loads the gemspec when bundler/gem_tasks is required, well before reissue:bump rewrites the version file. gem build shells out and re-reads the file, so the gem itself carries the bumped version, but the release tag and bundler's confirmation messages read the copy held in memory. Without this they name the version from before the bump, and the release publishes one version under another version's tag.



19
20
21
22
23
# File 'lib/reissue/gem.rb', line 19

def apply_version_bump(updater, bump)
  new_version = super
  sync_bundler_gemspec_version(new_version)
  new_version
end

#initializeObject



6
7
8
9
# File 'lib/reissue/gem.rb', line 6

def initialize(...)
  super
  @updated_paths << "checksums"
end

#sync_bundler_gemspec_version(new_version) ⇒ Object

Parameters:

  • new_version (String)

    the version the bump landed on



26
27
28
29
30
31
32
33
# File 'lib/reissue/gem.rb', line 26

def sync_bundler_gemspec_version(new_version)
  return unless defined?(Bundler::GemHelper)

  helper = Bundler::GemHelper.instance
  return unless helper&.gemspec

  helper.gemspec.version = ::Gem::Version.new(new_version)
end