diff --git a/lib/capistrano/send.rb b/lib/capistrano/send.rb index 4442207..4008c92 100644 --- a/lib/capistrano/send.rb +++ b/lib/capistrano/send.rb @@ -1,3 +1 @@ -require 'capistrano/send/mail' -require 'capistrano/send/libnotify' -require 'capistrano/send/notify-send' +load File.expand_path('../tasks/send.cap', __FILE__) diff --git a/lib/capistrano/send/all.rb b/lib/capistrano/send/all.rb new file mode 100644 index 0000000..4442207 --- /dev/null +++ b/lib/capistrano/send/all.rb @@ -0,0 +1,3 @@ +require 'capistrano/send/mail' +require 'capistrano/send/libnotify' +require 'capistrano/send/notify-send' diff --git a/lib/capistrano/send/git.rb b/lib/capistrano/send/git.rb new file mode 100644 index 0000000..d47b82d --- /dev/null +++ b/lib/capistrano/send/git.rb @@ -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 diff --git a/lib/capistrano/send/hg.rb b/lib/capistrano/send/hg.rb new file mode 100644 index 0000000..d0de4ca --- /dev/null +++ b/lib/capistrano/send/hg.rb @@ -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 diff --git a/lib/capistrano/tasks/git.cap b/lib/capistrano/tasks/git.cap new file mode 100644 index 0000000..f0d451f --- /dev/null +++ b/lib/capistrano/tasks/git.cap @@ -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 diff --git a/lib/capistrano/tasks/hg.cap b/lib/capistrano/tasks/hg.cap new file mode 100644 index 0000000..a6d9cbf --- /dev/null +++ b/lib/capistrano/tasks/hg.cap @@ -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 diff --git a/lib/capistrano/tasks/send.cap b/lib/capistrano/tasks/send.cap new file mode 100644 index 0000000..a10617d --- /dev/null +++ b/lib/capistrano/tasks/send.cap @@ -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