Sha256: d7ffb5c7845c06a615c3499e5ea447d7d130cf32c2fee1ae9029ed1a8a8c165a

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 Bytes

Contents

module Slackistrano
  module Messaging
    module Helpers

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

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

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

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

      def branch
        fetch(:branch)
      end

      def application
        fetch(:application)
      end

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

      #
      # Return the elapsed running time as a string.
      #
      # Examples: 21-18:26:30, 15:28:37, 01:14
      #
      def elapsed_time
        `ps -p #{$$} -o etime=`.strip
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slackistrano-4.0.2 lib/slackistrano/messaging/helpers.rb
slackistrano-4.0.1 lib/slackistrano/messaging/helpers.rb
slackistrano-4.0.0 lib/slackistrano/messaging/helpers.rb
slackistrano-3.8.4 lib/slackistrano/messaging/helpers.rb
slackistrano-3.8.3 lib/slackistrano/messaging/helpers.rb