Sha256: ba3f2625465d4efb3f9435059414725d7a39c7a637f54f4fd8cb9260dd988439
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
require 'forwardable' require 'json' require_relative 'helpers' module Capistrano::Dingtalk::Messaging class Base include Helpers extend Forwardable def_delegators :env, :fetch def initialize(info) @info = info || {} end def message_for_updating "#{deployer} has started deploying branch #{branch} of #{application} to #{stage}" end def message_for_reverting "#{deployer} has started rolling back branch #{branch} of #{application} to #{stage}" end def message_for_updated "#{deployer} has finished deploying branch #{branch} of #{application} to #{stage}" end def message_for_reverted "#{deployer} has finished rolling back branch of #{application} to #{stage}" end def message_for_failed "#{deployer} has failed to #{deploying? ? 'deploy' : 'rollback'} branch #{branch} of #{application} to #{stage}" end ################################################################################ def message_for(action) method = "message_for_#{action}" respond_to?(method) && send(method) end def build_at_dict at = {} at["at"] = @info[:at_all] at["atMobiles"] = @info[:at_mobiles] at end def build_hash(action) # implements on children end def build_msg_json(action) build_hash(action).merge(build_at_dict).to_json end end end
Version data entries
3 entries across 3 versions & 1 rubygems