bummer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 Thierry Joyal
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/lib/bummer.rb ADDED
@@ -0,0 +1,47 @@
1
+ require "bummer/config"
2
+
3
+ module Bummer
4
+
5
+ def self.send_exception(exception)
6
+ Bummer::Config.configure!
7
+
8
+ information = {
9
+ :application => Bummer::Config.application,
10
+ :installation => Bummer::Config.installation,
11
+ :group => exception.class.to_s,
12
+ :key => exception.message,
13
+ :description => exception.backtrace.join("\n"),
14
+ :created_at => Time.now
15
+ }
16
+
17
+ server = "http://#{Bummer::Config.host}:#{Bummer::Config.port}/events/log.json"
18
+
19
+ res = nil
20
+ begin
21
+ event = information.each.with_object({}){|(k, v), o|
22
+ o["event[#{k}]"] = v
23
+ }
24
+
25
+ res = Net::HTTP.post_form( URI.parse(server), event )
26
+
27
+ case res
28
+ when Net::HTTPCreated
29
+ puts "[Bummer] Error reported to the vault"
30
+ else
31
+ #Net::HTTPOK
32
+ #Net::HTTPUnauthorized
33
+ #Net::HTTPInternalServerError
34
+ puts "[Bummer] An error occurred when reporting the error to the vault '#{res.inspect}'"
35
+ puts "[Bummer] Exception : '#{exception.inspect}'"
36
+ end
37
+
38
+ rescue Errno::ECONNREFUSED => e
39
+ puts "[Bummer] Connection refused to the vault '#{server}'"
40
+ puts "[Bummer] Exception : '#{exception.inspect}'"
41
+ end
42
+
43
+ end
44
+
45
+
46
+
47
+ end
@@ -0,0 +1,39 @@
1
+ module Bummer
2
+ module Config
3
+ class << self
4
+
5
+ attr_accessor :host,
6
+ :port,
7
+ :application,
8
+ :installation
9
+
10
+ def configure(&block)
11
+ @configuration = block
12
+ end
13
+
14
+ def configure!
15
+ @configuration.call(self) if @configuration
16
+ end
17
+
18
+ protected
19
+
20
+ def init!
21
+ @defaults = {
22
+ :@host => 'localhost',
23
+ :@port => '3010',
24
+ :@application => 'default',
25
+ :@installation => 'default'
26
+ }
27
+ end
28
+
29
+ def reset!
30
+ @defaults.each do |k,v|
31
+ instance_variable_set(k,v)
32
+ end
33
+ end
34
+ end
35
+
36
+ init!
37
+ reset!
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Bummer
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bummer
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Thierry Joyal
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-28 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Vault provides a quick way to manage error logs in your rails apps.
23
+ email:
24
+ - thierry.joyal@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - lib/bummer.rb
33
+ - lib/bummer/config.rb
34
+ - lib/bummer/version.rb
35
+ - MIT-LICENSE
36
+ - README.md
37
+ has_rdoc: true
38
+ homepage: http://github.com/tjoyal/bummer
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Vault your errors
71
+ test_files: []
72
+