Add SCM specific capabilities to get release log

This commit is contained in:
Guillaume Dott 2015-05-26 14:37:13 +02:00
parent 11d7ce7a10
commit bb578c17d2
7 changed files with 67 additions and 3 deletions

View File

@ -1,3 +1 @@
require 'capistrano/send/mail'
require 'capistrano/send/libnotify'
require 'capistrano/send/notify-send'
load File.expand_path('../tasks/send.cap', __FILE__)

View File

@ -0,0 +1,3 @@
require 'capistrano/send/mail'
require 'capistrano/send/libnotify'
require 'capistrano/send/notify-send'

View File

@ -0,0 +1,13 @@
load File.expand_path('../../tasks/git.cap', __FILE__)
module Capistrano
module Send
module Git
def log
context.capture(:git, "--no-pager log --pretty=format:'* %s (%cn)' #{fetch(:previous_revision)}..#{fetch(:current_revision)}")
end
end
end
end
Capistrano::Git.include Capistrano::Send::Git

13
lib/capistrano/send/hg.rb Normal file
View File

@ -0,0 +1,13 @@
load File.expand_path('../../tasks/hg.cap', __FILE__)
module Capistrano
module Send
module Hg
def log
context.capture(:hg, "log --template '{desc} ({author})\n' --rev #{fetch(:previous_revision)}..#{fetch(:current_revision)}")
end
end
end
end
Capistrano::Hg.include Capistrano::Send::Hg

View File

@ -0,0 +1,13 @@
namespace :send do
namespace :git do
task :set_release_log do
on release_roles :all do
within repo_path do
with fetch(:git_environmental_variables) do
set :release_log, strategy.log
end
end
end
end
end
end

View File

@ -0,0 +1,11 @@
namespace :send do
namespace :hg do
task :set_release_log do
on release_roles :all do
within repo_path do
set :release_log, strategy.log
end
end
end
end
end

View File

@ -0,0 +1,13 @@
namespace :send do
task :set_release_log do
invoke "send:#{scm}:set_release_log"
end
task :load_scm do
load "capistrano/send/#{fetch(:scm)}.rb"
end
end
Capistrano::DSL.stages.each do |stage|
after stage, 'send:load_scm'
end