lib/scan/slack_poster.rb in scan-0.5.2 vs lib/scan/slack_poster.rb in scan-0.6.0

- old
+ new

@@ -14,10 +14,17 @@ notifier.channel = ('#' + notifier.channel) unless ['#', '@'].include?(notifier.channel[0]) # send message to channel by default end attachments = [] + if Scan.config[:slack_message] + attachments << { + text: Scan.config[:slack_message].to_s, + color: "good" + } + end + attachments << { text: "Build Errors: #{results[:build_errors] || 0}", color: results[:build_errors].to_i > 0 ? "danger" : "good", short: true } @@ -41,12 +48,12 @@ result = notifier.ping "#{Scan.project.app_name} Tests:", icon_url: 'https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png', attachments: attachments if result.code.to_i == 200 - Helper.log.info 'Successfully sent Slack notification'.green + UI.success('Successfully sent Slack notification') else - Helper.log.error result.to_s.red + UI.error(result.to_s) end end end end