Sha256: da320b1b5bfc4cbd4721f569e097d370ebdc831928ea1da86162e852079a3885

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

#!/usr/bin/env ruby

require 'logger'
require 'fileutils'
require "uri"

RAILS_ENV = "production"
RAILS_ROOT = FileUtils.pwd
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)

$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'crashlog'
require File.expand_path('../../rails/init', __FILE__)

fail "Please supply an API Key as the first argument" if ARGV.empty?

host = ARGV[3]
host ||= "stdin.crashlog.io"

secure = (ARGV[2] == "secure")

class SimulatedExceptionRaiser
  attr_reader :secure

  def initialize(secure)
    @secure = secure
    break_things
  rescue => e
    CrashLog.notify(e)
  end

  def break_things
    raise "Testing crashlog notifier with secure = #{secure}. If you can see this, it works."
  end
end

CrashLog.configure(true) do |config|
  config.api_key = ARGV[0]
  config.secret  = ARGV[1]
  config.scheme  = secure ? 'https' : 'http'
  config.host    = URI.parse(host).host
  config.port    = URI.parse(host).port
  # config.service_name = 'Staging'
end

puts "Configuration:"
CrashLog.configuration.each do |key, value|
  puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
end
puts "Sending #{secure ? "" : "in"}secure notification to project with key #{ARGV.first}"

SimulatedExceptionRaiser.new(secure)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
crashlog-1.0.3 script/integration_test
crashlog-1.0.2.1 script/integration_test
crashlog-1.0.2 script/integration_test
crashlog-1.0.1 script/integration_test