Sha256: c0ef54dbf5ac506e87868b6310f3e66abef05458c5304dc54f9048e6ed268b3a
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
require 'forwardable' require_relative 'helpers' module Slackistrano module Messaging class Base include Helpers extend Forwardable def_delegators :env, :fetch attr_reader :team, :token, :webhook, :options def initialize(options = {}) @options = options.dup @env = options.delete(:env) @team = options.delete(:team) @channel = options.delete(:channel) @token = options.delete(:token) @webhook = options.delete(:webhook) end def payload_for_starting { text: "#{deployer} has started deploying branch #{branch} of #{application} to #{stage}" } end def payload_for_updating { text: "#{deployer} is deploying branch #{branch} of #{application} to #{stage}" } end def payload_for_reverting { text: "#{deployer} has started rolling back branch #{branch} of #{application} to #{stage}" } end def payload_for_updated { text: "#{deployer} has finished deploying branch #{branch} of #{application} to #{stage}" } end def payload_for_reverted { text: "#{deployer} has finished rolling back branch of #{application} to #{stage}" } end def payload_for_failed { text: "#{deployer} has failed to #{deploying? ? 'deploy' : 'rollback'} branch #{branch} of #{application} to #{stage}" } end def channels_for(action) @channel end ################################################################################ def payload_for(action) method = "payload_for_#{action}" respond_to?(method) && send(method) end def via_slackbot? @webhook.nil? end end end end require_relative 'default' require_relative 'null'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slackistrano-4.0.2 | lib/slackistrano/messaging/base.rb |
slackistrano-4.0.1 | lib/slackistrano/messaging/base.rb |