Sha256: b3d00a71e6c08abcd1b3a60fff3198d2d51df779f82ca343fb79663a8f9b14f6

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

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

namespace :check do
  task :local_branch do
    next if fetch(:skip_local_branch_check)

    expected_local_branch = fetch(:local_branch) || fetch(:branch) || raise("Please set `local_branch` or `branch`")
    actual_local_branch = `git symbolic-ref --short HEAD`.strip

    unless actual_local_branch == expected_local_branch
      warn("=" * 80)
      warn("!!! Local branch `#{actual_local_branch}` maybe wrong. Please `git checkout #{expected_local_branch}`. !!!")
      warn("=" * 80)
      exit 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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