Class: GemKit::Release::Commands::Release
- Defined in:
- lib/gem_kit/release/commands/release.rb
Overview
Gate, build, push, tag. The gates run before anything is built, because a half-done release is worse than a refused one.
Constant Summary
Constants inherited from Command
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#fail_with, #gate, #initialize, #lines, #project, #refuse, #relative, #render, #say, #version_file
Constructor Details
This class inherits a constructor from GemKit::Release::Commands::Command
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gem_kit/release/commands/release.rb', line 14 def call version = project.version.to_s problems = gate.release_problems(version, allow_dirty: [:allow_dirty]) refuse("Refusing to release #{project.name} #{version}:", problems) unless problems.empty? if [:dry_run] say("#{project.name} #{version} is ready to release.") return end gemspec = File.basename(project.gemspec_path) package = "#{project.name}-#{version}.gem" Dir.chdir(project.root) do say("Building #{gemspec}…") fail_with("gem build failed") unless system("gem", "build", gemspec) say("Pushing #{package}…") fail_with("gem push failed") unless system("gem", "push", package) end say("Released #{project.name} #{version}") # Tagging is part of releasing, not a flag someone remembers. It runs # after the push rather than before, so a tag never points at a # version that failed to publish — and it pushes, because the gem is # public by now and a tag only this machine has is half a release. Tag.new(.merge(push: true)).call unless [:tag] == false end |