bugloco 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f77f2e45084fd90245873bae6177592eab5c0cfa
4
- data.tar.gz: 26e56be260f658a023966e125490bcb71ccb1997
3
+ metadata.gz: 26f57587dd1c07883b2dd735a8334887a8d009a5
4
+ data.tar.gz: 755abd2583eabbdf9ba177225ddad97815b88ea3
5
5
  SHA512:
6
- metadata.gz: 1275e34393868460335ff64794d38cf591118dab58645441448b16c9c38eac5f2c3c58e7b20f977e76171da5f5c52c34217bded77d15e442967b29b4cf9c5868
7
- data.tar.gz: 41656a91b8b9f55dba3becea2e62ab8d9966249262d139e76290cc58d9d8b47712458afedb53297d5cec3271df41a24b3e919260cb3f265a3624cc2af0323e8d
6
+ metadata.gz: 27b56a17b95626809312f56ec8aad51d65ddd9a12c57c90df90efa329dac0d2ff2a6fc461969eebd1d00ed08956270ba946706e50c60f18da884d5f8fca089c2
7
+ data.tar.gz: c605a2a62cb21fec3f0b6fb4375166c3751b6e3450643c534eb44de3de75ab9d74fc345b53c5de701b0eacde9a49b9ed7533a9a53b780c2a952c92943a7a0d8b
@@ -112,7 +112,7 @@ module Bugloco
112
112
  end
113
113
 
114
114
  if type.nil?
115
- type = Bugloco::Proto::LocationType::UNKNOWN
115
+ type = Bugloco::Proto::LocationType::UNKNOWN_LT
116
116
  end
117
117
  end
118
118
 
@@ -139,18 +139,42 @@ module Bugloco
139
139
  end
140
140
 
141
141
  def load_running_mode
142
- running_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"]
143
-
144
- running_mode = case running_env
145
- when "test"
146
- Bugloco::Proto::RunningMode::TEST
147
- when "staging"
148
- Bugloco::Proto::RunningMode::STAGING
149
- when "production"
150
- Bugloco::Proto::RunningMode::PRODUCTION
151
- end
152
-
153
- @proto_message.running_mode = running_mode
142
+ load_running_mode_from_rails || load_running_mode_from_rack
143
+ end
144
+
145
+ def load_running_mode_from_rails
146
+ if defined?(::Rails)
147
+ @proto_message.running_mode = case ::Rails.env
148
+ when "development"
149
+ Bugloco::Proto::RunningMode::DEVELOPMENT
150
+ when "test"
151
+ Bugloco::Proto::RunningMode::TEST
152
+ when "staging"
153
+ Bugloco::Proto::RunningMode::STAGING
154
+ when "production"
155
+ Bugloco::Proto::RunningMode::PRODUCTION
156
+ end
157
+
158
+ true
159
+ else
160
+ false
161
+ end
162
+ end
163
+
164
+ def load_running_mode_from_rack
165
+ rack_env = ENV["RACK_ENV"]
166
+ return false if rack_env.nil? || rack_env.empty?
167
+
168
+ @proto_message.running_mode = case rack_env
169
+ when "test"
170
+ Bugloco::Proto::RunningMode::TEST
171
+ when "staging"
172
+ Bugloco::Proto::RunningMode::STAGING
173
+ when "production"
174
+ Bugloco::Proto::RunningMode::PRODUCTION
175
+ end
176
+
177
+ true
154
178
  end
155
179
 
156
180
  def load_exception_class_and_message
@@ -1,26 +1,29 @@
1
1
  ### Generated by rprotoc. DO NOT EDIT!
2
2
  ### <proto file: /home/wmn/code/bugloco/bugloco-rb/protobufs/bugloco.proto>
3
3
  # syntax = "proto2";
4
- #
4
+ #
5
5
  # package bugloco.proto;
6
- #
6
+ #
7
7
  # enum LocationType {
8
- # UNKNOWN = 0;
8
+ # UNKNOWN_LT = 0;
9
9
  # PROJECT = 1;
10
10
  # GEM = 2;
11
11
  # }
12
- #
12
+ #
13
13
  # enum RunningMode {
14
- # TEST = 0;
15
- # STAGING = 1;
16
- # PRODUCTION = 2;
14
+ # UNKNOWN_RM = 0;
15
+ # DEVELOPMENT = 1;
16
+ # TEST = 2;
17
+ # STAGING = 3;
18
+ # PRODUCTION = 4;
17
19
  # }
18
- #
20
+ #
19
21
  # enum Status {
20
- # SUCCESS = 0;
21
- # FAILURE = 1;
22
+ # UNKNOWN_ST = 0;
23
+ # SUCCESS = 1;
24
+ # FAILURE = 2;
22
25
  # }
23
- #
26
+ #
24
27
  # enum ErrorCode {
25
28
  # UNKNOWN_ERROR = 0;
26
29
  # API_KEY_INVALID = 1;
@@ -29,7 +32,7 @@
29
32
  # INVALID_PROTO_MESSAGE = 4;
30
33
  # PROBLEM_PERSISTING_NOTICE = 5;
31
34
  # }
32
- #
35
+ #
33
36
  # message BacktraceEntry {
34
37
  # required bugloco.proto.LocationType location_type = 1;
35
38
  # required string full_path = 2;
@@ -37,38 +40,38 @@
37
40
  # required int32 line_number = 4;
38
41
  # required string function_name = 5;
39
42
  # }
40
- #
43
+ #
41
44
  # message Company {
42
45
  # required string api_key = 1;
43
46
  # }
44
- #
47
+ #
45
48
  # message Project {
46
49
  # required string key = 1;
47
50
  # optional string framework = 2;
48
51
  # optional string version = 3;
49
52
  # }
50
- #
53
+ #
51
54
  # message Pair {
52
55
  # required string key = 1;
53
56
  # required string value = 2;
54
57
  # }
55
- #
58
+ #
56
59
  # message Server {
57
60
  # required string hostname = 1;
58
61
  # optional string os = 2;
59
62
  # }
60
- #
63
+ #
61
64
  # message Notifier {
62
65
  # required string name = 1;
63
66
  # required string version = 2;
64
67
  # }
65
- #
68
+ #
66
69
  # message User {
67
70
  # optional string remote_ip = 1;
68
71
  # optional string remote_host = 2;
69
72
  # optional string user_agent = 3;
70
73
  # }
71
- #
74
+ #
72
75
  # message Request {
73
76
  # repeated bugloco.proto.Pair environment_variables = 1;
74
77
  # repeated bugloco.proto.Pair parameters = 2;
@@ -78,7 +81,7 @@
78
81
  # optional string url = 6;
79
82
  # optional string referer = 7;
80
83
  # }
81
- #
84
+ #
82
85
  # message Notice {
83
86
  # required bugloco.proto.Company company = 1;
84
87
  # required bugloco.proto.Project project = 2;
@@ -92,12 +95,12 @@
92
95
  # optional bugloco.proto.Server server = 10;
93
96
  # repeated bugloco.proto.Pair custom = 11;
94
97
  # }
95
- #
98
+ #
96
99
  # message ErrorMessage {
97
100
  # required string field = 1;
98
101
  # required string message = 2;
99
102
  # }
100
- #
103
+ #
101
104
  # message Response {
102
105
  # required bugloco.proto.Status status = 1;
103
106
  # optional string notice_key = 2;
@@ -114,20 +117,23 @@ module Bugloco
114
117
  module Proto
115
118
  class LocationType < ::Protobuf::Enum
116
119
  defined_in __FILE__
117
- UNKNOWN = value(:UNKNOWN, 0)
120
+ UNKNOWN_LT = value(:UNKNOWN_LT, 0)
118
121
  PROJECT = value(:PROJECT, 1)
119
122
  GEM = value(:GEM, 2)
120
123
  end
121
124
  class RunningMode < ::Protobuf::Enum
122
125
  defined_in __FILE__
123
- TEST = value(:TEST, 0)
124
- STAGING = value(:STAGING, 1)
125
- PRODUCTION = value(:PRODUCTION, 2)
126
+ UNKNOWN_RM = value(:UNKNOWN_RM, 0)
127
+ DEVELOPMENT = value(:DEVELOPMENT, 1)
128
+ TEST = value(:TEST, 2)
129
+ STAGING = value(:STAGING, 3)
130
+ PRODUCTION = value(:PRODUCTION, 4)
126
131
  end
127
132
  class Status < ::Protobuf::Enum
128
133
  defined_in __FILE__
129
- SUCCESS = value(:SUCCESS, 0)
130
- FAILURE = value(:FAILURE, 1)
134
+ UNKNOWN_ST = value(:UNKNOWN_ST, 0)
135
+ SUCCESS = value(:SUCCESS, 1)
136
+ FAILURE = value(:FAILURE, 2)
131
137
  end
132
138
  class ErrorCode < ::Protobuf::Enum
133
139
  defined_in __FILE__
@@ -214,4 +220,4 @@ module Bugloco
214
220
  repeated :'bugloco::proto::ErrorMessage', :error_messages, 4
215
221
  end
216
222
  end
217
- end
223
+ end
@@ -1,3 +1,3 @@
1
1
  module Bugloco
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -3,20 +3,23 @@ syntax = "proto2";
3
3
  package bugloco.proto;
4
4
 
5
5
  enum LocationType {
6
- UNKNOWN = 0;
6
+ UNKNOWN_LT = 0;
7
7
  PROJECT = 1;
8
8
  GEM = 2;
9
9
  }
10
10
 
11
11
  enum RunningMode {
12
- TEST = 0;
13
- STAGING = 1;
14
- PRODUCTION = 2;
12
+ UNKNOWN_RM = 0;
13
+ DEVELOPMENT = 1;
14
+ TEST = 2;
15
+ STAGING = 3;
16
+ PRODUCTION = 4;
15
17
  }
16
18
 
17
19
  enum Status {
18
- SUCCESS = 0;
19
- FAILURE = 1;
20
+ UNKNOWN_ST = 0;
21
+ SUCCESS = 1;
22
+ FAILURE = 2;
20
23
  }
21
24
 
22
25
  enum ErrorCode {
@@ -210,6 +210,12 @@ describe Bugloco::Notice do
210
210
 
211
211
  context "rails" do
212
212
  before do
213
+ module ::Rails
214
+ def self.env
215
+ "production"
216
+ end
217
+ end
218
+
213
219
  Bugloco.config do |config|
214
220
  config.project_root = File.expand_path("../../../", __FILE__)
215
221
  end
@@ -240,10 +246,9 @@ describe Bugloco::Notice do
240
246
  expect(@notice_proto_message.backtrace).to eq([first, second, third])
241
247
  end
242
248
 
243
- it "should include information about RAILS_ENV" do
244
- @extra_env["RAILS_ENV"] = "staging"
249
+ it "should include information from Rails.env" do
245
250
  run_rack_app
246
- expected = Bugloco::Proto::RunningMode::STAGING
251
+ expected = Bugloco::Proto::RunningMode::PRODUCTION
247
252
  expect(@notice_proto_message.running_mode).to eq(expected)
248
253
  end
249
254
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugloco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wael M. Nasreddine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-04 00:00:00.000000000 Z
11
+ date: 2014-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler