Sha256: 9d2fcf751dc6f3daf1f3713a8b4923a21686bbf1aa70b483d56d5f9487785007

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

namespace :git do

  git_environmental_variables = {
    git_askpass: '/bin/echo',
    git_ssh:     '/tmp/git-ssh.sh'
  }

  desc 'Upload the git wrapper script, this script guarantees that we can script git without getting an interactive prompt'
  task :wrapper do
    on roles :all do
      upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), '/tmp/git-ssh.sh'
      execute :chmod, "+x", '/tmp/git-ssh.sh'
    end
  end

  desc 'Check that the repository is reachable'
  task check: :'git:wrapper' do
    fetch(:branch)
    on roles :all do
      with git_environmental_variables do
        execute :git, :'ls-remote', fetch(:repo)
      end
    end
  end

  desc 'Clone the repo to the cache'
  task clone: :'git:wrapper' do
    on roles :all do
      if test " [ -f #{repo_path}/HEAD ] "
        info t(:mirror_exists, at: repo_path)
      else
        within deploy_path do
          with git_environmental_variables do
            execute :git, :clone, '--mirror', fetch(:repo), repo_path
          end
        end
      end
    end
  end

  desc 'Update the repo mirror to reflect the origin state'
  task update: :'git:clone' do
    on roles :all do
      within repo_path do
        execute :git, :remote, :update
      end
    end
  end

  desc 'Copy repo to releases'
  task create_release: :'git:update' do
    on roles :all do
      with git_environmental_variables do
        within repo_path do
          execute :git, :clone, '--branch', fetch(:branch),               \
            '--depth 1',                                                  \
            '--recursive',                                                \
            '--no-hardlinks',                                             \
            repo_path, release_path
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
capistrano-3.0.0.pre5 lib/capistrano/tasks/git.rake
capistrano-3.0.0.pre4 lib/capistrano/tasks/git.rake
capistrano-3.0.0.pre3 lib/capistrano/tasks/git.rake
capistrano-3.0.0.pre2 lib/capistrano/tasks/git.rake
capistrano-3.0.0.pre lib/capistrano/tasks/git.rake