Sha256: 1863cd5754992e0181d106fd29d11533d1a0ca3ad1833d1e03db41f664384601

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

Capistrano::DSL.stages.each do |stage|
  after stage, "check:push"
end

namespace :check do
  task :push do
    next if fetch(:skip_push_check)

    local_branch = `git symbolic-ref --short HEAD`.strip
    track = ` git branch --list --format '%(upstream:track)' #{local_branch}`.strip

    unless track == ""
      track =~ /\[ahead (\d+)\]/
      n = $~.captures.first.to_i
      warn("=" * 80)
      warn("!!! Local branch `#{local_branch}` is ahead of upstream by #{n} commit(s). !!!")
      warn("=" * 80)
      exit 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-push_check-0.1.0 lib/capistrano/tasks/push_check.rake