Sha256: 84f29453cbddda6d431bf9cc9b6675bf0f69177686e013f3f1917db9b3203f7a

Contents?: true

Size: 1.5 KB

Versions: 45

Compression:

Stored size: 1.5 KB

Contents

module CapistranoDeployManagement
  module Git
    def self.load_into(configuration)
      configuration.load do

        ssh_options[:forward_agent] = true

        set(:application) { repository.slice(/[^\/:]+?(?=\.git$)/) }
        set(:repository) { abort "Please specify repository, set :repository, 'foo'" }
        set :branch, 'master'
        set :enable_submodules, false

        set(:current_revision) { capture("cd #{current_path} && git rev-parse HEAD").chomp }

        set :local_branch do
          `git symbolic-ref HEAD 2> /dev/null`.strip.sub('refs/heads/', '')
        end

        namespace :deploy do
          desc 'Setup'
          task :setup, :except => {:no_release => true} do
            run "mkdir -p `dirname #{current_path}` && git clone --no-checkout #{repository} #{deploy_to}"
            update
          end

          desc 'Update the deployed code'
          task :update, :except => {:no_release => true} do
            commit = ENV['COMMIT'] || "origin/#{branch}"
            command = ["cd #{current_path}", 'git fetch origin', "git reset --hard #{commit}"]
            command += ['git submodule init', 'git submodule -q sync', 'git submodule -q update'] if enable_submodules
            run command.join(' && ')
          end

          desc 'Show pending commits'
          task :pending do
            commit = ENV['COMMIT'] || "origin/#{branch}"
            system("git log --pretty=medium --stat #{current_revision}..#{commit}")
          end
        end

      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
capistrano-deploy-management-0.1.47 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.46 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.45 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.44 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.43 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.42 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.41 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.40 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.39 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.38 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.37 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.36 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.35 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.34 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.33 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.32 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.31 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.30 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.29 lib/capistrano-deploy-management/git.rb
capistrano-deploy-management-0.1.28 lib/capistrano-deploy-management/git.rb