Sha256: 978780e02a044e9efbd5f28117057ac8a647929d06f0f9bf71a7719b7d27dcaf

Contents?: true

Size: 1.11 KB

Versions: 58

Compression:

Stored size: 1.11 KB

Contents

namespace :ci do
  namespace :slack do
    desc 'Set up Slack'
    task :setup do
      require 'highline/import'
      @attachments = []

      ENV['SLACK_WEBHOOK_URL'] ||= ask('Slack Webhook URL: ')
      ENV['SLACK_WEBHOOK_URL'] = nil if ENV['SLACK_WEBHOOK_URL'] == ''

      ENV['SLACK_CHANNEL'] ||= ask('Slack Channel: ')
      ENV['SLACK_CHANNEL'] = nil if ENV['SLACK_CHANNEL'] == ''
    end

    desc 'publish'
    task publish: :setup do
      next if @attachments.empty? || ENV['SLACK_WEBHOOK_URL'].nil?

      require 'ndr_dev_support/slack_message_publisher'

      # We have attachments so prepend them with basic commit details
      Rake::Task['ci:rugged:commit_details'].invoke

      slack_publisher = NdrDevSupport::SlackMessagePublisher.new(ENV['SLACK_WEBHOOK_URL'],
                                                                 username: 'Rake CI',
                                                                 icon_emoji: ':robot_face:',
                                                                 channel: ENV['SLACK_CHANNEL'])
      slack_publisher.post(attachments: @attachments)
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
ndr_dev_support-7.3.1 lib/tasks/ci/slack.rake
ndr_dev_support-7.3.0 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.6 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.5 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.4 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.3 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.2 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.1 lib/tasks/ci/slack.rake
ndr_dev_support-7.2.0 lib/tasks/ci/slack.rake
ndr_dev_support-7.1.0 lib/tasks/ci/slack.rake
ndr_dev_support-7.0.0 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.9 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.8 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.7 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.6 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.5 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.4 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.3 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.2 lib/tasks/ci/slack.rake
ndr_dev_support-6.1.1 lib/tasks/ci/slack.rake