lib/slackistrano/capistrano.rb in slackistrano-3.1.0 vs lib/slackistrano/capistrano.rb in slackistrano-3.1.1
- old
+ new
@@ -14,21 +14,25 @@
extend Forwardable
def_delegators :env, :fetch, :run_locally
def initialize(env)
@env = env
- opts = fetch(:slackistrano, {}).dup
- @messaging = if opts.empty?
+ config = fetch(:slackistrano, {})
+ @messaging = case config
+ when false
+ Messaging::Null.new
+ when -> (o) { o.empty? }
klass = Messaging::Deprecated.new(
env: @env,
team: fetch(:slack_team),
channel: fetch(:slack_channel),
token: fetch(:slack_token),
webhook: fetch(:slack_webhook)
)
else
+ opts = config.dup.merge(env: @env)
klass = opts.delete(:klass) || Messaging::Default
- klass.new(opts.merge(env: @env))
+ klass.new(opts)
end
end
def run(action)
_self = self