lib/capistrano/notifier/statsd.rb in capistrano-notifier-0.2.2 vs lib/capistrano/notifier/statsd.rb in capistrano-notifier-0.3.0
- old
+ new
@@ -1,10 +1,10 @@
require 'capistrano/notifier'
require 'socket'
class Capistrano::Notifier::StatsD < Capistrano::Notifier::Base
- DEFAULTS = { :host => "127.0.0.1", :port => "8125", :with => :counter }
+ DEFAULTS = { host: "127.0.0.1", port: "8125", with: :counter }
def self.load_into(configuration)
configuration.load do
namespace :deploy do
namespace :notify do
@@ -36,14 +36,20 @@
DEFAULTS
end
end
def packet
- if stage
- "#{application}.#{stage}.deploy:#{with}"
- else
- "#{application}.deploy:#{with}"
- end
+ "#{pattern}:#{with}"
+ end
+
+ def pattern
+ options.fetch(:pattern){
+ if stage
+ "#{application}.#{stage}.deploy"
+ else
+ "#{application}.deploy"
+ end
+ }
end
def port
options[:port]
end