Sha256: 8f06bae52c37e6e9300615d8dee0f0e6be3cda866671fea49e3ed7c811743126

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

namespace :slack_500 do
  desc 'configuration slack_500'
  task :config do
    file = File.join(Rails.root,'config','initializers','slack_500.rb')
    if File.exists?(file)
      puts "#{file} esxits. overwrite? (y/n)"
      s = STDIN.getc
      exit unless s[0].downcase == 'y'
    end
    File.open(file,'w') do |file|
      file.puts("require 'Slack500'")
      file.puts("\nSlack500.setup do |config|")

      file.puts("\n    # report pretext of slack message")
      file.puts("    config.pretext = 'Slack Report Title'")

      file.puts("\n    # report title of slack message")
      file.puts("    config.title = 'Rendering 500 with exception.'")

      file.puts("\n    # color of slack message")
      file.puts("    config.color = '#FF0000'")

      file.puts("\n    # footer text of slack message")
      file.puts("    config.footer = 'via Slack 500 Report.'")

      file.puts("\n    # WebHook URL")
      file.puts("    # see https://slack.com/services/new/incoming-webhook")
      file.puts("    config.webhook_url = '(Your Slack WebHook URL)https://hooks.slack.com/services/xxxxxxxxx/xxxx'")

      file.puts("\nend")
    end
    puts "Slack500:: you need edit #{file}."
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack_500-0.1.4 lib/tasks/slack_500.rake
slack_500-0.1.3 lib/tasks/slack_500.rake