captivus 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +2 -1
  3. data/README.md +9 -0
  4. data/captivus.gemspec +2 -1
  5. data/lib/captivus/backtrace/line.rb +14 -8
  6. data/lib/captivus/backtrace.rb +8 -2
  7. data/lib/captivus/configuration.rb +4 -2
  8. data/lib/captivus/notifier.rb +34 -0
  9. data/lib/captivus/payload.rb +70 -14
  10. data/lib/captivus/rack_capturer.rb +4 -8
  11. data/lib/captivus/rails_capturer.rb +21 -0
  12. data/lib/captivus/railtie.rb +35 -0
  13. data/lib/captivus/tasks/captivus.rake +12 -0
  14. data/lib/captivus/util.rb +24 -0
  15. data/lib/captivus/version.rb +1 -1
  16. data/lib/captivus.rb +30 -14
  17. data/rails-3.0-app/.rspec +1 -0
  18. data/rails-3.0-app/Gemfile +40 -0
  19. data/rails-3.0-app/README +256 -0
  20. data/rails-3.0-app/Rakefile +7 -0
  21. data/rails-3.0-app/app/controllers/application_controller.rb +3 -0
  22. data/rails-3.0-app/app/controllers/errors_controller.rb +5 -0
  23. data/rails-3.0-app/app/helpers/application_helper.rb +2 -0
  24. data/rails-3.0-app/app/views/layouts/application.html.erb +14 -0
  25. data/rails-3.0-app/config/application.rb +42 -0
  26. data/rails-3.0-app/config/boot.rb +6 -0
  27. data/rails-3.0-app/config/database.yml +7 -0
  28. data/rails-3.0-app/config/environment.rb +5 -0
  29. data/rails-3.0-app/config/environments/development.rb +26 -0
  30. data/rails-3.0-app/config/environments/production.rb +49 -0
  31. data/rails-3.0-app/config/environments/test.rb +35 -0
  32. data/rails-3.0-app/config/initializers/backtrace_silencers.rb +7 -0
  33. data/rails-3.0-app/config/initializers/captivus.rb +4 -0
  34. data/rails-3.0-app/config/initializers/inflections.rb +10 -0
  35. data/rails-3.0-app/config/initializers/mime_types.rb +5 -0
  36. data/rails-3.0-app/config/initializers/secret_token.rb +7 -0
  37. data/rails-3.0-app/config/initializers/session_store.rb +8 -0
  38. data/rails-3.0-app/config/locales/en.yml +5 -0
  39. data/rails-3.0-app/config/routes.rb +59 -0
  40. data/rails-3.0-app/config.ru +4 -0
  41. data/rails-3.0-app/db/seeds.rb +7 -0
  42. data/rails-3.0-app/public/404.html +26 -0
  43. data/rails-3.0-app/public/422.html +26 -0
  44. data/rails-3.0-app/public/500.html +26 -0
  45. data/rails-3.0-app/public/favicon.ico +0 -0
  46. data/rails-3.0-app/public/images/rails.png +0 -0
  47. data/rails-3.0-app/public/index.html +239 -0
  48. data/rails-3.0-app/public/javascripts/application.js +2 -0
  49. data/rails-3.0-app/public/javascripts/controls.js +965 -0
  50. data/rails-3.0-app/public/javascripts/dragdrop.js +974 -0
  51. data/rails-3.0-app/public/javascripts/effects.js +1123 -0
  52. data/rails-3.0-app/public/javascripts/prototype.js +6001 -0
  53. data/rails-3.0-app/public/javascripts/rails.js +202 -0
  54. data/rails-3.0-app/public/robots.txt +5 -0
  55. data/rails-3.0-app/script/rails +6 -0
  56. data/rails-3.0-app/spec/requests/events_from_rails_spec.rb +115 -0
  57. data/rails-3.0-app/spec/spec_helper.rb +38 -0
  58. data/rails-3.0-app/spec/support/captivus_api.rb +1 -0
  59. data/rails-3.1-app/.rspec +1 -0
  60. data/rails-3.1-app/Gemfile +44 -0
  61. data/rails-3.1-app/README +261 -0
  62. data/rails-3.1-app/Rakefile +7 -0
  63. data/rails-3.1-app/app/assets/images/rails.png +0 -0
  64. data/rails-3.1-app/app/assets/javascripts/application.js +9 -0
  65. data/rails-3.1-app/app/assets/stylesheets/application.css +7 -0
  66. data/rails-3.1-app/app/controllers/application_controller.rb +3 -0
  67. data/rails-3.1-app/app/controllers/errors_controller.rb +5 -0
  68. data/rails-3.1-app/app/helpers/application_helper.rb +2 -0
  69. data/rails-3.1-app/app/views/layouts/application.html.erb +14 -0
  70. data/rails-3.1-app/config/application.rb +54 -0
  71. data/rails-3.1-app/config/boot.rb +6 -0
  72. data/rails-3.1-app/config/database.yml +7 -0
  73. data/rails-3.1-app/config/environment.rb +5 -0
  74. data/rails-3.1-app/config/environments/development.rb +30 -0
  75. data/rails-3.1-app/config/environments/production.rb +60 -0
  76. data/rails-3.1-app/config/environments/test.rb +39 -0
  77. data/rails-3.1-app/config/initializers/backtrace_silencers.rb +7 -0
  78. data/rails-3.1-app/config/initializers/captivus.rb +4 -0
  79. data/rails-3.1-app/config/initializers/inflections.rb +10 -0
  80. data/rails-3.1-app/config/initializers/mime_types.rb +5 -0
  81. data/rails-3.1-app/config/initializers/secret_token.rb +7 -0
  82. data/rails-3.1-app/config/initializers/session_store.rb +8 -0
  83. data/rails-3.1-app/config/initializers/wrap_parameters.rb +14 -0
  84. data/rails-3.1-app/config/locales/en.yml +5 -0
  85. data/rails-3.1-app/config/routes.rb +59 -0
  86. data/rails-3.1-app/config.ru +4 -0
  87. data/rails-3.1-app/db/seeds.rb +7 -0
  88. data/rails-3.1-app/public/404.html +26 -0
  89. data/rails-3.1-app/public/422.html +26 -0
  90. data/rails-3.1-app/public/500.html +26 -0
  91. data/rails-3.1-app/public/favicon.ico +0 -0
  92. data/rails-3.1-app/public/index.html +241 -0
  93. data/rails-3.1-app/public/robots.txt +5 -0
  94. data/rails-3.1-app/script/rails +6 -0
  95. data/rails-3.1-app/spec/requests/events_from_rails_spec.rb +115 -0
  96. data/rails-3.1-app/spec/spec_helper.rb +38 -0
  97. data/rails-3.1-app/spec/support/captivus_api.rb +1 -0
  98. data/rails-3.2-app/.rspec +1 -0
  99. data/rails-3.2-app/Gemfile +47 -0
  100. data/rails-3.2-app/README.rdoc +261 -0
  101. data/rails-3.2-app/Rakefile +7 -0
  102. data/rails-3.2-app/app/assets/images/rails.png +0 -0
  103. data/rails-3.2-app/app/assets/javascripts/application.js +15 -0
  104. data/rails-3.2-app/app/assets/stylesheets/application.css +13 -0
  105. data/rails-3.2-app/app/controllers/application_controller.rb +3 -0
  106. data/rails-3.2-app/app/controllers/errors_controller.rb +5 -0
  107. data/rails-3.2-app/app/helpers/application_helper.rb +2 -0
  108. data/rails-3.2-app/app/views/layouts/application.html.erb +14 -0
  109. data/rails-3.2-app/config/application.rb +68 -0
  110. data/rails-3.2-app/config/boot.rb +6 -0
  111. data/rails-3.2-app/config/database.yml +7 -0
  112. data/rails-3.2-app/config/environment.rb +5 -0
  113. data/rails-3.2-app/config/environments/development.rb +37 -0
  114. data/rails-3.2-app/config/environments/production.rb +67 -0
  115. data/rails-3.2-app/config/environments/test.rb +37 -0
  116. data/rails-3.2-app/config/initializers/backtrace_silencers.rb +7 -0
  117. data/rails-3.2-app/config/initializers/captivus.rb +4 -0
  118. data/rails-3.2-app/config/initializers/inflections.rb +15 -0
  119. data/rails-3.2-app/config/initializers/mime_types.rb +5 -0
  120. data/rails-3.2-app/config/initializers/secret_token.rb +7 -0
  121. data/rails-3.2-app/config/initializers/session_store.rb +8 -0
  122. data/rails-3.2-app/config/initializers/wrap_parameters.rb +14 -0
  123. data/rails-3.2-app/config/locales/en.yml +5 -0
  124. data/rails-3.2-app/config/routes.rb +59 -0
  125. data/rails-3.2-app/config.ru +4 -0
  126. data/rails-3.2-app/db/schema.rb +16 -0
  127. data/rails-3.2-app/db/seeds.rb +7 -0
  128. data/rails-3.2-app/public/404.html +26 -0
  129. data/rails-3.2-app/public/422.html +26 -0
  130. data/rails-3.2-app/public/500.html +25 -0
  131. data/rails-3.2-app/public/favicon.ico +0 -0
  132. data/rails-3.2-app/public/index.html +241 -0
  133. data/rails-3.2-app/public/robots.txt +5 -0
  134. data/rails-3.2-app/script/rails +6 -0
  135. data/rails-3.2-app/spec/requests/events_from_rails_spec.rb +115 -0
  136. data/rails-3.2-app/spec/spec_helper.rb +38 -0
  137. data/rails-3.2-app/spec/support/captivus_api.rb +1 -0
  138. data/spec/captivus/backtrace/line_spec.rb +20 -10
  139. data/spec/captivus/backtrace_spec.rb +1 -3
  140. data/spec/captivus/configuration_spec.rb +3 -1
  141. data/spec/captivus/notifier_spec.rb +73 -0
  142. data/spec/captivus/payload_spec.rb +293 -28
  143. data/spec/captivus/rack_capturer_spec.rb +32 -15
  144. data/spec/captivus/rails_capturer_spec.rb +59 -0
  145. data/spec/captivus_spec.rb +50 -29
  146. data/spec/integration/events_from_rack_spec.rb +112 -74
  147. data/spec/spec_helper.rb +6 -29
  148. data/spec/support/captivus_api.rb +29 -0
  149. data/spec/support/delorean.rb +5 -0
  150. metadata +154 -4
data/.gitignore CHANGED
@@ -10,6 +10,7 @@ coverage
10
10
  doc/
11
11
  lib/bundler/man
12
12
  pkg
13
+ /rails-3.*-app/**/*.log
13
14
  rdoc
14
15
  spec/reports
15
16
  test/tmp
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ gem "rspec", "~> 2.11"
7
7
  gem "sham_rack", "~> 1.3"
8
8
  gem "rack-test", "~> 0.6"
9
9
  gem "timecop", '~> 0.5'
10
- gem "delorean", "~> 2.0.0"
10
+ gem "delorean", "~> 2.0.0"
11
+ gem "rails", "~> 3.2.8"
data/README.md CHANGED
@@ -27,3 +27,12 @@ TODO: Write usage instructions here
27
27
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
28
  4. Push to the branch (`git push origin my-new-feature`)
29
29
  5. Create new Pull Request
30
+
31
+ # Rails testing setup
32
+ * rails _3.1.8_ new rails-3.1-app -G -d postgresql -T --old-style-hash
33
+ * setup error controller
34
+ * setup database.yml
35
+ * setup captivus config
36
+ * add specs
37
+ * setup Gemfile
38
+ * setup routes
data/captivus.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency "faraday", '~> 0.8.4'
21
- gem.add_dependency "multi_json", "~> 1.3.6"
21
+ gem.add_dependency "multi_json", "~> 1.2.0"
22
22
  gem.add_dependency "captivus-auth_hmac", "0.0.2"
23
+ gem.add_dependency "json-schema", "~> 1.0.10"
23
24
  end
@@ -1,21 +1,27 @@
1
1
  module Captivus
2
2
  class Backtrace
3
3
  class Line
4
- PATTERN = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/
4
+ PATTERN = /^(.+?):(\d+)(?::in `([^']+)')?$/
5
5
 
6
6
  def initialize(raw_line)
7
7
  if match_data = PATTERN.match(raw_line)
8
- @as_json = {
9
- :file => match_data[1],
10
- :number => match_data[2].to_i,
11
- :method => match_data[3]
12
- }
8
+ @file = match_data[1]
9
+ @number = match_data[2].to_i
10
+ @method = match_data[3]
13
11
  else
14
- raise ArgumentError, "Unrecognized format"
12
+ raise ArgumentError, "Unrecognized format: #{raw_line.inspect}"
15
13
  end
16
14
  end
17
15
 
18
- attr_reader :as_json
16
+ def as_json(*)
17
+ hash = {'file' => file, 'number' => number}
18
+ hash['method'] = method if method
19
+ hash
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :file, :number, :method
19
25
  end
20
26
  end
21
27
  end
@@ -6,9 +6,15 @@ module Captivus
6
6
  unless exception.respond_to?(:backtrace)
7
7
  raise ArgumentError, "#{exception} must respond to `backtrace`"
8
8
  end
9
- @as_json = Array(exception.backtrace).map { |line| Line.new(line).as_json }
9
+ @exception = exception
10
10
  end
11
11
 
12
- attr_reader :as_json
12
+ def as_json(*)
13
+ Array(exception.backtrace).map { |line| Line.new(line).as_json }
14
+ end
15
+
16
+ private
17
+
18
+ attr_reader :exception
13
19
  end
14
20
  end
@@ -3,12 +3,14 @@ module Captivus
3
3
  def initialize(attrs = {}, &block)
4
4
  defaults = {
5
5
  :scheme => 'http',
6
- :host => 'api.captiv.us'
6
+ :host => 'api.captiv.us',
7
+ :environment => 'production',
8
+ :development_environments => %w[development test]
7
9
  }
8
10
  configure defaults.merge(attrs), &block
9
11
  end
10
12
 
11
- attr_accessor :host, :scheme, :api_key, :api_secret_key
13
+ attr_accessor :host, :scheme, :api_key, :api_secret_key, :environment, :development_environments
12
14
 
13
15
  def configure(attrs = {})
14
16
  attrs.each { |attr, value| send "#{attr}=", value }
@@ -0,0 +1,34 @@
1
+ require 'captivus/util'
2
+ require 'faraday'
3
+ require 'faraday/request/hmac_authentication'
4
+
5
+ module Captivus
6
+ class Notifier
7
+ def initialize(config)
8
+ @config = config
9
+ end
10
+
11
+ def notify(payload)
12
+ return if config.development_environments.include?(config.environment)
13
+
14
+ connection = Faraday.new(:url => "#{config.scheme}://#{config.host}") do |faraday|
15
+ faraday.request :hmac_authentication, config.api_key, config.api_secret_key, {:service_id => 'Captivus'}
16
+ faraday.adapter :net_http
17
+ end
18
+
19
+ connection.post do |request|
20
+ request.headers['Content-Type'] = 'application/json; charset=UTF-8'
21
+ request.url '/events'
22
+ request.body = Captivus::Util.hash_to_json(payload)
23
+ end
24
+ end
25
+
26
+ def ==(other)
27
+ other.is_a?(Notifier) && config == other.config
28
+ end
29
+
30
+ protected
31
+
32
+ attr_reader :config
33
+ end
34
+ end
@@ -1,22 +1,78 @@
1
- require 'captivus/backtrace'
1
+ require 'captivus/util'
2
+ require 'json-schema'
2
3
 
3
4
  module Captivus
4
5
  class Payload
5
- def initialize(exception)
6
- if exception.respond_to?(:class) && exception.class.respond_to?(:name) && exception.respond_to?(:message)
7
- @as_json = {
8
- 'event' => {
9
- 'type' => exception.class.name,
10
- 'message' => exception.message,
11
- 'timestamp' => Time.now.utc.to_s
12
- },
13
- 'backtrace' => Backtrace.new(exception).as_json
6
+ SCHEMA = {
7
+ 'type' => 'object',
8
+ 'properties' => {
9
+ 'notifier' => {
10
+ 'type' => 'object',
11
+ 'required' => true,
12
+ 'properties' => {
13
+ 'name' => {'type' => 'string', 'required' => true},
14
+ 'version' => {'type' => 'string', 'required' => true},
15
+ 'language' => {'type' => 'string', 'required' => true}
16
+ }
17
+ },
18
+ 'event' => {
19
+ 'type' => 'object',
20
+ 'required' => true,
21
+ 'properties' => {
22
+ 'type' => {'type' => 'string', 'required' => true},
23
+ 'message' => {'type' => 'string', 'required' => true},
24
+ 'timestamp' => {'type' => 'string', 'required' => true, 'format' => 'date-time'}
25
+ }
26
+ },
27
+ 'backtrace' => {
28
+ 'type' => 'array',
29
+ 'required' => true,
30
+ 'items' => {
31
+ 'type' => 'object',
32
+ 'properties' => {
33
+ 'file' => {'type' => 'string', 'required' => true},
34
+ 'number' => { 'type' => 'integer', 'required' => true},
35
+ 'method' => {'type' => 'string'}
36
+ }
37
+ }
38
+ },
39
+ 'context' => {
40
+ 'type' => 'object',
41
+ 'properties' => {
42
+ 'controller' => {'type' => 'string'},
43
+ 'action' => {'type' => 'string'},
44
+ 'params' => {'type' => 'object'}
45
+ }
46
+ },
47
+ 'environment' => {
48
+ 'type' => 'object',
49
+ 'required' => true,
50
+ 'properties' => {
51
+ 'name' => {'type' => 'string', 'required' => true}
52
+ }
14
53
  }
15
- else
16
- raise ArgumentError, "Unexpected exception: #{exception.inspect}"
17
- end
54
+ }
55
+ }
56
+
57
+ def initialize(json)
58
+ JSON::Validator.validate! SCHEMA, json
59
+ @json = json
60
+ end
61
+
62
+ def as_json(*)
63
+ Captivus::Util.json_to_hash json
64
+ end
65
+
66
+ def to_json(*)
67
+ json.dup
68
+ end
69
+
70
+ def ==(other)
71
+ other.is_a?(Payload) && json == other.json
18
72
  end
19
73
 
20
- attr_reader :as_json
74
+ protected
75
+
76
+ attr_reader :json
21
77
  end
22
78
  end
@@ -1,6 +1,4 @@
1
1
  require 'captivus'
2
- require 'faraday'
3
- require 'multi_json'
4
2
 
5
3
  module Captivus
6
4
  class RackCapturer
@@ -9,12 +7,10 @@ module Captivus
9
7
  end
10
8
 
11
9
  def call(env)
12
- begin
13
- @app.call env
14
- rescue => exception
15
- Captivus.notify exception
16
- raise
17
- end
10
+ @app.call env
11
+ rescue Exception => exception
12
+ Captivus.notify exception, :context => {:params => Rack::Request.new(env).params}
13
+ raise
18
14
  end
19
15
 
20
16
  private
@@ -0,0 +1,21 @@
1
+ require 'captivus'
2
+ require 'captivus/rack_capturer'
3
+
4
+ module Captivus
5
+ class RailsCapturer < RackCapturer
6
+ def call(env)
7
+ @app.call env
8
+ rescue Exception => exception
9
+ controller = env['action_controller.instance']
10
+ params = controller.request.filtered_parameters
11
+ params.delete 'controller'
12
+ params.delete 'action'
13
+ Captivus.notify exception, 'context' => {
14
+ 'controller' => controller.controller_name,
15
+ 'action' => controller.action_name,
16
+ 'params' => params
17
+ }
18
+ raise
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,35 @@
1
+ require 'rails'
2
+ require 'captivus/rails_capturer'
3
+
4
+ module Captivus
5
+ class Railtie < Rails::Railtie
6
+ rake_tasks { load "captivus/tasks/captivus.rake" }
7
+
8
+ config.before_initialize do
9
+ Captivus.configure do |config|
10
+ config.environment = Rails.env
11
+ end
12
+ # announce here?
13
+ end
14
+
15
+ initializer "captivus.use_rack_middleware" do |app|
16
+ app.config.middleware.use "Captivus::RailsCapturer"
17
+ end
18
+
19
+ # config.after_initialize do
20
+ # ::ActionController::Base.send :include, RailsControllerMethods
21
+
22
+ # if defined?(::ActionDispatch::DebugExceptions)
23
+ # # We should catch the exceptions in ActionDispatch::DebugExceptions in Rails 3.2.x.
24
+ # require 'crash_log/rails/middleware/debug_exception_catcher'
25
+ # ::ActionDispatch::DebugExceptions.__send__(:include, CrashLog::Rails::Middleware::DebugExceptionCatcher)
26
+ # elsif defined?(::ActionDispatch::ShowExceptions)
27
+
28
+ # # ActionDispatch::DebugExceptions is not defined in Rails 3.0.x and 3.1.x so
29
+ # # catch the exceptions in ShowExceptions.
30
+ # require 'crash_log/rails/middleware/debug_exception_catcher'
31
+ # ::ActionDispatch::ShowExceptions.send(:include, CrashLog::Rails::Middleware::DebugExceptionCatcher)
32
+ # end
33
+ # end
34
+ end
35
+ end
@@ -0,0 +1,12 @@
1
+ namespace :captivus do
2
+ desc "Send a test exception to Captivus"
3
+ task :test => :environment do
4
+ class Captivus::TestException < Exception; end
5
+
6
+ begin
7
+ raise Captivus::TestException, "This is a test exception"
8
+ rescue Captivus::TestException => exception
9
+ Captivus.notify exception
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'multi_json'
2
+
3
+ # TODO: test
4
+ module Captivus
5
+ module Util
6
+ extend self
7
+
8
+ def hash_to_json(hash)
9
+ if MultiJson.respond_to?(:adapter)
10
+ MultiJson.dump hash
11
+ else
12
+ MultiJson.encode hash
13
+ end
14
+ end
15
+
16
+ def json_to_hash(json)
17
+ if MultiJson.respond_to?(:adapter)
18
+ MultiJson.load json
19
+ else
20
+ MultiJson.decode json
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Captivus
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/captivus.rb CHANGED
@@ -1,6 +1,9 @@
1
+ require 'captivus/util'
1
2
  require "captivus/version"
2
3
  require 'captivus/configuration'
3
- require 'faraday/request/hmac_authentication'
4
+ require 'captivus/notifier'
5
+ require 'captivus/backtrace'
6
+ require 'captivus/payload'
4
7
 
5
8
  module Captivus
6
9
  class << self
@@ -12,22 +15,35 @@ module Captivus
12
15
  config.configure *args, &block
13
16
  end
14
17
 
15
- def notify(exception)
16
- connection = Faraday.new(:url => "#{config.scheme}://#{config.host}") do |faraday|
17
- faraday.request :hmac_authentication, config.api_key, config.api_secret_key, {:service_id => 'Captivus'}
18
- faraday.adapter :net_http
19
- end
18
+ def notifier
19
+ @notifier ||= Notifier.new config
20
+ end
21
+
22
+ def notify(exception, data = {})
23
+ notifier.notify build_payload(exception, data)
24
+ end
25
+
26
+ private
20
27
 
21
- connection.post do |request|
22
- request.headers['Content-Type'] = 'application/json; charset=UTF-8'
23
- request.url '/events'
24
- request.body = MultiJson.dump(Payload.new(exception).as_json)
28
+ def build_payload(exception, data = {})
29
+ if exception.respond_to?(:class) && exception.class.respond_to?(:name) && exception.respond_to?(:message)
30
+ event_json = {
31
+ 'type' => exception.class.name,
32
+ 'message' => exception.message,
33
+ 'timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
34
+ }
35
+ else
36
+ raise ArgumentError, "Unexpected exception: #{exception.inspect}"
25
37
  end
38
+
39
+ Payload.new(Captivus::Util.hash_to_json({
40
+ 'notifier' => {'name' => 'captivus', 'version' => Captivus::VERSION, 'language' => 'Ruby'},
41
+ 'event' => event_json,
42
+ 'backtrace' => Backtrace.new(exception).as_json,
43
+ 'environment' => {'name' => config.environment}
44
+ }.merge(data)))
26
45
  end
27
46
  end
28
47
  end
29
48
 
30
- require 'captivus/auth_hmac'
31
- require 'captivus/backtrace'
32
- require 'captivus/payload'
33
- require 'captivus/rack_capturer'
49
+ require 'captivus/railtie' if defined?(Rails::Railtie)
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,40 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.17'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'pg'
9
+
10
+ # Use unicorn as the web server
11
+ # gem 'unicorn'
12
+
13
+ # Deploy with Capistrano
14
+ # gem 'capistrano'
15
+
16
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
17
+ # gem 'ruby-debug'
18
+ # gem 'ruby-debug19', :require => 'ruby-debug'
19
+
20
+ # Bundle the extra gems:
21
+ # gem 'bj'
22
+ # gem 'nokogiri'
23
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
24
+ # gem 'aws-s3', :require => 'aws/s3'
25
+
26
+ # Bundle gems for the local environment. Make sure to
27
+ # put test-only gems in this group so their generators
28
+ # and rake tasks are available in development mode:
29
+ # group :development, :test do
30
+ # gem 'webrat'
31
+ # end
32
+
33
+ gem 'captivus', :path => '..'
34
+
35
+ group :test do
36
+ gem "rspec-rails", "~> 2.11.4"
37
+ gem "capybara", "~> 1.1.2"
38
+ gem "sham_rack", "~> 1.3"
39
+ gem "timecop", '~> 0.5'
40
+ end