Module: Slackistrano::Messaging::Helpers

Included in:
Base
Defined in:
lib/slackistrano/messaging/helpers.rb

Instance Method Summary collapse

Instance Method Details

#applicationObject



26
27
28
# File 'lib/slackistrano/messaging/helpers.rb', line 26

def application
  fetch(:application)
end

#branchObject



22
23
24
# File 'lib/slackistrano/messaging/helpers.rb', line 22

def branch
  fetch(:branch)
end

#deployerObject



17
18
19
20
# File 'lib/slackistrano/messaging/helpers.rb', line 17

def deployer
  default = ENV['USER'] || ENV['USERNAME']
  fetch(:local_user, default)
end

#elapsed_timeObject

Return the elapsed running time as a string.

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



39
40
41
# File 'lib/slackistrano/messaging/helpers.rb', line 39

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

#icon_emojiObject



9
10
11
# File 'lib/slackistrano/messaging/helpers.rb', line 9

def icon_emoji
  options.fetch(:icon_emoji, nil)
end

#icon_urlObject



5
6
7
# File 'lib/slackistrano/messaging/helpers.rb', line 5

def icon_url
  options.fetch(:icon_url, 'https://raw.githubusercontent.com/phallstrom/slackistrano/master/images/slackistrano.png')
end

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



30
31
32
# File 'lib/slackistrano/messaging/helpers.rb', line 30

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

#usernameObject



13
14
15
# File 'lib/slackistrano/messaging/helpers.rb', line 13

def username
  options.fetch(:username, 'Slackistrano')
end