Module: Capistrano::Dingtalk::Messaging::Helpers

Included in:
Base
Defined in:
lib/capistrano/dingtalk/messaging/helpers.rb

Instance Method Summary collapse

Instance Method Details

#applicationObject



15
16
17
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 15

def application
  fetch(:application)
end

#branchObject



11
12
13
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 11

def branch
  fetch(:branch)
end

#deployerObject



7
8
9
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 7

def deployer
  ENV['USER'] || ENV['USERNAME']
end

#elapsed_timeObject

Return the elapsed running time as a string.

Examples: 21-18:26:30, 15:28:37, 01:14



28
29
30
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 28

def elapsed_time
  `ps -p #{$PROCESS_ID} -o etime=`.strip
end

#stage(default = 'an unknown stage') ⇒ Object



19
20
21
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 19

def stage(default = 'an unknown stage')
  fetch(:stage, default)
end

#usernameObject



3
4
5
# File 'lib/capistrano/dingtalk/messaging/helpers.rb', line 3

def username
  'cap-dingtalk-bot'
end