Sha256: 0d9f8fb321396b7babe24785282a2d00858c61761ae0ad3248e47bda83f26601

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

unless defined?(Capistrano::BundleRsync::TASK_LOADED) # protect multiple loads
Capistrano::BundleRsync::TASK_LOADED = true
require 'fileutils'
require 'parallel'
require 'capistrano/bundle_rsync/bundler'

namespace :bundle_rsync do
  def bundler
    @bundler ||= Capistrano::BundleRsync::Bundler.new(self)
  end

  def scm
    @scm ||=
      if fetch(:bundle_rsync_scm).to_s == 'local_git'
        require 'capistrano/bundle_rsync/local_git'
        set :bundle_rsync_local_release_path, repo_url
        Capistrano::BundleRsync::LocalGit.new(self)
      else
        require 'capistrano/bundle_rsync/git'
        Capistrano::BundleRsync::Git.new(self)
      end
  end

  namespace :bundler do
    task :install do
      run_locally do
        bundler.install
      end
    end

    task :rsync do
      run_locally do
        bundler.rsync
      end
    end
  end

  desc 'Check that the repository is reachable'
  task :check do
    run_locally do
      scm.check
    end
  end

  desc 'Clone the repo to the cache'
  task :clone do
    run_locally do
      scm.clone
    end
  end

  desc 'Update the repo mirror to reflect the origin state'
  task update: :'bundle_rsync:clone' do
    run_locally do
      scm.update
    end
  end

  desc 'Copy repo to releases'
  task create_release: :'bundle_rsync:update' do
    run_locally do
      scm.create_release
    end
  end

  # additional extra tasks of bundle_rsync scm
  desc 'Rsync releases'
  task :rsync_release do
    run_locally do
      scm.rsync_release
    end
  end

  desc 'Determine the revision that will be deployed'
  task :set_current_revision do
    run_locally do
      scm.set_current_revision
    end
  end

  after 'bundle_rsync:create_release', 'bundle_rsync:bundler:install'
  after 'bundle_rsync:bundler:install', 'bundle_rsync:rsync_release'
  after 'bundle_rsync:rsync_release', 'bundle_rsync:bundler:rsync'
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-bundle_rsync-0.2.2 lib/capistrano/tasks/bundle_rsync.rake