lib/capistrano/datadog.rb in dogapi-1.30 vs lib/capistrano/datadog.rb in dogapi-1.31.0
- old
+ new
@@ -11,11 +11,13 @@
@reporter || @reporter = Reporter.new
end
def self.cap_version()
if @cap_version.nil? then
- if Configuration.respond_to? :instance then
+ if !defined? Configuration
+ @cap_version = ''
+ elsif Configuration.respond_to? :instance
@cap_version = :v2
else
@cap_version = :v3
end
end
@@ -106,11 +108,12 @@
end
application = ''
if !task[:application].nil? and !task[:application].empty? then
application = ' for ' + task[:application]
end
+ timing = Float(task[:timing]).round(2) rescue 'n/a'
title = "#{user}@#{hostname} ran #{name}#{application} on #{roles.join(', ')} "\
- "with capistrano in #{task[:timing].round(2)} secs"
+ "with capistrano in #{timing} secs"
type = 'deploy'
alert_type = 'success'
source_type = 'capistrano'
message_content = task[:logs].join('')
message = if !message_content.empty? then