Sha256: a3c0e9becc3ffc7bb5cea16ea2ebc865e021d4758471718fbcdcbb5241099294

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

namespace :deploy do
  desc "checks whether the currently checkout out revision matches the
        remote one we're trying to deploy from"
  task :check_revision do
    branch = fetch(:branch)
    unless `git rev-parse HEAD` == `git rev-parse origin/#{branch}`
      puts "WARNING: HEAD is not the same as origin/#{branch}"
      puts "Run `git push` to sync changes or make sure you've"
      puts "checked out the branch: #{branch} as you can only deploy"
      puts "if you've got the target branch checked out"
      exit
    end
  end
end

before 'deploy', 'deploy:check_revision'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cookbook-0.2.1 lib/capistrano/cookbook/tasks/check_revision.cap