Module: Slackistrano::Messaging::Helpers

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

Instance Method Summary collapse

Instance Method Details

#applicationObject



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

def application
  fetch(:application)
end

#branchObject



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

def branch
  fetch(:branch)
end

#deployerObject



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

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



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

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



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

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