Class: Gempilot::Origin

Inherits:
Object
  • Object
show all
Includes:
StrictShell
Defined in:
lib/gempilot/origin.rb

Overview

Pushes the current branch and a release tag to the branch's git remote. Backs the release:source_control_push task. Idempotent: pushing an already-pushed branch or tag is a no-op, so re-running a release never fails on an existing tag (unlike bundler's already_tagged? guard, which skips the push entirely once the tag exists locally).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ Origin

Returns a new instance of Origin.



14
15
16
# File 'lib/gempilot/origin.rb', line 14

def initialize(tag)
  @tag = tag
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



12
13
14
# File 'lib/gempilot/origin.rb', line 12

def tag
  @tag
end

Instance Method Details

#pushObject



18
19
20
21
# File 'lib/gempilot/origin.rb', line 18

def push
  sh "git", "push", remote, "refs/heads/#{branch}"
  sh "git", "push", remote, "refs/tags/#{tag}"
end