Class: CapistranoDeploytags::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/deploytags.rb

Class Method Summary collapse

Class Method Details

.commit_message(current_sha, stage) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/capistrano/deploytags.rb', line 23

def self.commit_message(current_sha, stage)
  if fetch(:deploytag_commit_message, false)
    fetch(:deploytag_commit_message)
  else
    tag_user = (ENV['USER'] || ENV['USERNAME'] || 'deployer').strip
    "#{tag_user} deployed #{current_sha} to #{stage}"
  end
end

.formatted_timeObject



13
14
15
16
17
18
19
20
21
# File 'lib/capistrano/deploytags.rb', line 13

def self.formatted_time
  now = if fetch(:deploytag_utc, true)
    Time.now.utc
  else
    Time.now
  end

  now.strftime(fetch(:deploytag_time_format, "%Y.%m.%d-%H%M%S-#{now.zone.downcase}"))
end

.git_tag_for(stage) ⇒ Object



9
10
11
# File 'lib/capistrano/deploytags.rb', line 9

def self.git_tag_for(stage)
  "#{stage}-#{formatted_time}"
end