Sha256: d7b7b807e898b6ee384765eb530ea6418cc3a17209afc858ea6a02046eb6263d

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

require 'capistrano/git'

namespace :git_local do

  def strategy
    @strategy ||= Capistrano::Git.new(self, fetch(:git_strategy, Capistrano::Git::DefaultStrategy))
  end

  desc 'Check that the repository is reachable'
  task :check do |task|
    run_locally do debug "Task #{task}" end

    fetch(:branch)
    run_locally do
      exit 1 unless strategy.check
    end
  end

  desc 'Clone the repo to the cache'
  task :clone do |task|
    run_locally do debug "Task #{task}" end

    run_locally do
      if strategy.test
        info t(:mirror_exists, at: repo_path)
      else
        within deploy_path do
          strategy.clone
        end
      end
    end
  end

  desc 'Update the repo mirror to reflect the origin state'
  task :update => :clone do |task|
    run_locally do debug "Task #{task}" end
    run_locally do
      within repo_path do
        strategy.update
      end
    end
  end

  desc 'Copy repo to releases'
  task :create_release => :update do |task|
    run_locally do debug "Task #{task}" end

    run_locally do
      within repo_path do
        execute :mkdir, '-p', release_path
        strategy.release
      end
    end
  end

  desc 'Determine the revision that will be deployed'
  task :set_current_revision do |task|
    run_locally do debug "Task #{task}" end

    run_locally do
      within repo_path do
        set :current_revision, strategy.fetch_revision
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-git-local-0.1.0 lib/capistrano/git-local.cap