bugloco 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e01c60255d1c3940e8f6f58551df2d2df876c7d8
4
+ data.tar.gz: c9cdb69fa65eb6afaf910538aa82771bf868dc2f
5
+ SHA512:
6
+ metadata.gz: 4ce74a4980b9e4578e4427a233d8cbf7662db256e06e9d3b6c2f7c1c347403e12da671a4f806d9df69f43a1e636fba59d48b72c2ad59c730ef387cbd2cec8052
7
+ data.tar.gz: c1ba7c04fd26475ac0c0e14a665ecbdb0b365ebdcc0890da37b7823a8e280eeb3f0bdc2dd8fb94b5a7798b11e0454ad93817f641ef8ac1f851326e6eccee9ecc
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bugloco.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Wael M. Nasreddine
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Bugloco
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bugloco'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bugloco
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/bugloco/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ desc "Generate protobuf"
7
+ task :generate_protobuf do
8
+ require "protobuf/compiler/compiler"
9
+ protobuf_path = File.expand_path("../protobufs", __FILE__)
10
+ proto_file = File.join(protobuf_path, "bugloco.proto")
11
+ compiled_path = File.expand_path("../lib/bugloco/protobuf", __FILE__)
12
+
13
+ Protobuf::Compiler.compile(proto_file, protobuf_path, compiled_path)
14
+ end
15
+
16
+ task :default => :spec
data/bugloco.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bugloco/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bugloco"
8
+ spec.version = Bugloco::VERSION
9
+ spec.authors = ["Wael M. Nasreddine"]
10
+ spec.email = ["wael.nasreddine@gmail.com"]
11
+ spec.summary = "Bugloco ruby gem for sending exceptions to Bugloco"
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://bugloco.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", ">= 3.0.0"
24
+
25
+ spec.add_dependency "ruby_protobuf"
26
+ end
@@ -0,0 +1,127 @@
1
+ ### Generated by rprotoc. DO NOT EDIT!
2
+ ### <proto file: /home/wmn/code/bug-loco/bugloco-rb/protobufs/bugloco.proto>
3
+ # package bugloco.proto;
4
+ #
5
+ # syntax = "proto2";
6
+ # option bugloco_proto_version = 1;
7
+ #
8
+ # enum FilelocationType {
9
+ # PROJECT = 0;
10
+ # LIBRARY = 1;
11
+ # GEM = 2;
12
+ # }
13
+ #
14
+ # enum RunningMode {
15
+ # TEST = 0;
16
+ # STAGING = 1;
17
+ # PRODUCTION = 2;
18
+ # }
19
+ #
20
+ # message BacktraceEntry {
21
+ # required bugloco.proto.FilelocationType location = 1;
22
+ # required string full_path = 2;
23
+ # required string path = 3;
24
+ # required uint32 line_number = 4;
25
+ # required string function_name = 5;
26
+ # }
27
+ #
28
+ # message Company {
29
+ # required int32 id = 1;
30
+ # required string key = 2;
31
+ # }
32
+ #
33
+ # message Project {
34
+ # required int32 id = 1;
35
+ # }
36
+ #
37
+ # message Pair {
38
+ # required string key = 1;
39
+ # required string value = 2;
40
+ # }
41
+ #
42
+ # message Server {
43
+ # required string hostname = 1;
44
+ # optional string os = 2;
45
+ # optional string version = 3;
46
+ # }
47
+ #
48
+ # message Exception {
49
+ # required bugloco.proto.Company company = 1;
50
+ # required bugloco.proto.Project project = 2;
51
+ # required string error_type = 3;
52
+ # required string error_message = 4;
53
+ # repeated bugloco.proto.BacktraceEntry backtrace_entries = 5;
54
+ # repeated bugloco.proto.Pair environment_variables = 6;
55
+ # repeated bugloco.proto.Pair params = 7;
56
+ # optional string stack = 8;
57
+ # optional bugloco.proto.RunningMode running_mode = 9;
58
+ # optional bugloco.proto.Server server = 10;
59
+ # optional string controller = 11;
60
+ # optional string action = 12;
61
+ # }
62
+
63
+ require 'protobuf/message/message'
64
+ require 'protobuf/message/enum'
65
+ require 'protobuf/message/service'
66
+ require 'protobuf/message/extend'
67
+
68
+ module Bugloco
69
+ module Proto
70
+ ::Protobuf::OPTIONS[:"bugloco_proto_version"] = 1
71
+ class FilelocationType < ::Protobuf::Enum
72
+ defined_in __FILE__
73
+ PROJECT = value(:PROJECT, 0)
74
+ LIBRARY = value(:LIBRARY, 1)
75
+ GEM = value(:GEM, 2)
76
+ end
77
+ class RunningMode < ::Protobuf::Enum
78
+ defined_in __FILE__
79
+ TEST = value(:TEST, 0)
80
+ STAGING = value(:STAGING, 1)
81
+ PRODUCTION = value(:PRODUCTION, 2)
82
+ end
83
+ class BacktraceEntry < ::Protobuf::Message
84
+ defined_in __FILE__
85
+ required :'bugloco::proto::FilelocationType', :location, 1
86
+ required :string, :full_path, 2
87
+ required :string, :path, 3
88
+ required :uint32, :line_number, 4
89
+ required :string, :function_name, 5
90
+ end
91
+ class Company < ::Protobuf::Message
92
+ defined_in __FILE__
93
+ required :int32, :id, 1
94
+ required :string, :key, 2
95
+ end
96
+ class Project < ::Protobuf::Message
97
+ defined_in __FILE__
98
+ required :int32, :id, 1
99
+ end
100
+ class Pair < ::Protobuf::Message
101
+ defined_in __FILE__
102
+ required :string, :key, 1
103
+ required :string, :value, 2
104
+ end
105
+ class Server < ::Protobuf::Message
106
+ defined_in __FILE__
107
+ required :string, :hostname, 1
108
+ optional :string, :os, 2
109
+ optional :string, :version, 3
110
+ end
111
+ class Exception < ::Protobuf::Message
112
+ defined_in __FILE__
113
+ required :'bugloco::proto::Company', :company, 1
114
+ required :'bugloco::proto::Project', :project, 2
115
+ required :string, :error_type, 3
116
+ required :string, :error_message, 4
117
+ repeated :'bugloco::proto::BacktraceEntry', :backtrace_entries, 5
118
+ repeated :'bugloco::proto::Pair', :environment_variables, 6
119
+ repeated :'bugloco::proto::Pair', :params, 7
120
+ optional :string, :stack, 8
121
+ optional :'bugloco::proto::RunningMode', :running_mode, 9
122
+ optional :'bugloco::proto::Server', :server, 10
123
+ optional :string, :controller, 11
124
+ optional :string, :action, 12
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,3 @@
1
+ module Bugloco
2
+ VERSION = "0.0.1"
3
+ end
data/lib/bugloco.rb ADDED
@@ -0,0 +1,31 @@
1
+ require "bugloco/version"
2
+ require "bugloco/protobuf/bugloco.pb"
3
+
4
+ module Bugloco
5
+ class Exception
6
+ def initialize(exception)
7
+ @exception = exception
8
+ @proto_message = nil
9
+ end
10
+
11
+ def prepare_proto_message
12
+ return @proto_message unless @proto_message.nil?
13
+
14
+ @proto_message = Bugloco::Proto::Exception.new
15
+
16
+ load_environment
17
+
18
+ @proto_message
19
+ end
20
+
21
+ def load_environment
22
+ ENV.each do |k, v|
23
+ pair = Bugloco::Proto::Pair.new
24
+ pair.key = k
25
+ pair.value = v
26
+
27
+ @proto_message.environment_variables << pair
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,59 @@
1
+ package bugloco.proto;
2
+
3
+ syntax = "proto2";
4
+ option bugloco_proto_version = 1;
5
+
6
+ enum FilelocationType {
7
+ PROJECT = 0;
8
+ LIBRARY = 1;
9
+ GEM = 2;
10
+ }
11
+
12
+ enum RunningMode {
13
+ TEST = 0;
14
+ STAGING = 1;
15
+ PRODUCTION = 2;
16
+ }
17
+
18
+ message BacktraceEntry {
19
+ required bugloco.proto.FilelocationType location = 1;
20
+ required string full_path = 2;
21
+ required string path = 3;
22
+ required uint32 line_number = 4;
23
+ required string function_name = 5;
24
+ }
25
+
26
+ message Company {
27
+ required int32 id = 1;
28
+ required string key = 2;
29
+ }
30
+
31
+ message Project {
32
+ required int32 id = 1;
33
+ }
34
+
35
+ message Pair {
36
+ required string key = 1;
37
+ required string value = 2;
38
+ }
39
+
40
+ message Server {
41
+ required string hostname = 1;
42
+ optional string os = 2;
43
+ optional string version = 3;
44
+ }
45
+
46
+ message Exception {
47
+ required bugloco.proto.Company company = 1;
48
+ required bugloco.proto.Project project = 2;
49
+ required string error_type = 3;
50
+ required string error_message = 4;
51
+ repeated bugloco.proto.BacktraceEntry backtrace_entries = 5;
52
+ repeated bugloco.proto.Pair environment_variables = 6;
53
+ repeated bugloco.proto.Pair params = 7;
54
+ optional string stack = 8;
55
+ optional bugloco.proto.RunningMode running_mode = 9;
56
+ optional bugloco.proto.Server server = 10;
57
+ optional string controller = 11;
58
+ optional string action = 12;
59
+ }
@@ -0,0 +1,26 @@
1
+ describe Bugloco::Exception do
2
+ before do
3
+ ENV["BUGLOCO_KEY"] = "VAR"
4
+
5
+ begin
6
+ raise RuntimeError, "Fake error needed for the builder"
7
+ rescue RuntimeError => exception
8
+ @exception = Bugloco::Exception.new(exception)
9
+ @exception_proto_message = @exception.prepare_proto_message
10
+ end
11
+ end
12
+
13
+ after do
14
+ ENV["BUGLOCO_KEY"] = nil
15
+ end
16
+
17
+ context "message_builder" do
18
+ it "should collect the environment" do
19
+ expected = Bugloco::Proto::Pair.new
20
+ expected.key = "BUGLOCO_KEY"
21
+ expected.value = "VAR"
22
+
23
+ expect(@exception_proto_message.environment_variables).to include(expected)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ require "bugloco"
2
+
3
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
4
+ RSpec.configure do |config|
5
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bugloco
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Wael M. Nasreddine
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby_protobuf
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Bugloco ruby gem for sending exceptions to Bugloco
70
+ email:
71
+ - wael.nasreddine@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bugloco.gemspec
83
+ - lib/bugloco.rb
84
+ - lib/bugloco/protobuf/bugloco.pb.rb
85
+ - lib/bugloco/version.rb
86
+ - protobufs/bugloco.proto
87
+ - spec/bugloco_spec.rb
88
+ - spec/spec_helper.rb
89
+ homepage: https://bugloco.com
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Bugloco ruby gem for sending exceptions to Bugloco
113
+ test_files:
114
+ - spec/bugloco_spec.rb
115
+ - spec/spec_helper.rb