bmc-daemon-lib 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29df8c92767e8d6c0a33210b7c02a3095790cf37
4
- data.tar.gz: 7c4744d9b4981d68bac75faa50b121c8cf8c7cca
3
+ metadata.gz: 239b8f0424a5cac440f94c96d90c22596b26b8d6
4
+ data.tar.gz: e5af414d7d6537423a7f689f535762dee3b28823
5
5
  SHA512:
6
- metadata.gz: f40cd3776b912f2059f8cbc58874deda6a381a66a0113510df38cdb5e6cd295eab798f97a78679dfa61ef4ed82a55883b9d8933d62d8dd919ef5798f57423425
7
- data.tar.gz: fa834d967a25fdabbd2c30c74c4f71601d83b5143d279ef53aa3072c5b513c237be6a3b528a06c2ac9b9579f491e90639b843d360f17eea760c2017e0acf0e77
6
+ metadata.gz: f3b5dbc5d9868a7addaf034e0eab01c5a7fe6c14445c8927bc9312f230feefae51a1094f3e08f9403bd468ff1d00273989b0ee6d77e4c43a0b295d1e5b8f5161
7
+ data.tar.gz: 5e11b9a03c718469a6dd2c0c89287d45028a280b4cf5eaa8f579aa699e37cc0892c5601b327a0e950009152b1d40611eb5c527aa9137ec0dc125af35327cc024
data/Gemfile.lock CHANGED
@@ -1,10 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bmc-daemon-lib (0.3.6)
4
+ bmc-daemon-lib (0.3.8)
5
5
  chamber (~> 2.9)
6
- newrelic_rpm
7
- rollbar
8
6
 
9
7
  GEM
10
8
  remote: https://rubygems.org/
@@ -15,15 +13,11 @@ GEM
15
13
  thor (~> 0.19.1)
16
14
  diff-lcs (1.2.5)
17
15
  hashie (3.4.4)
18
- multi_json (1.12.1)
19
- newrelic_rpm (3.16.2.321)
20
16
  parser (2.3.1.2)
21
17
  ast (~> 2.2)
22
18
  powerpack (0.1.1)
23
19
  rainbow (2.1.0)
24
20
  rake (11.2.2)
25
- rollbar (2.12.0)
26
- multi_json
27
21
  rspec (3.5.0)
28
22
  rspec-core (~> 3.5.0)
29
23
  rspec-expectations (~> 3.5.0)
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.3.6"
4
+ spec.version = "0.3.8"
5
5
 
6
6
  # Project description
7
7
  spec.name = "bmc-daemon-lib"
@@ -25,9 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rspec"
26
26
  spec.add_development_dependency "rubocop"
27
27
 
28
-
29
28
  # Runtime dependencies
30
29
  spec.add_runtime_dependency "chamber", "~> 2.9"
31
- spec.add_runtime_dependency "newrelic_rpm"
32
- spec.add_runtime_dependency "rollbar"
33
30
  end
@@ -3,8 +3,6 @@ require "rubygems"
3
3
  require "syslog"
4
4
  require "thread"
5
5
  require "chamber"
6
- require 'newrelic_rpm'
7
- require 'rollbar'
8
6
 
9
7
  # Project's libs
10
8
  require_relative "bmc-daemon-lib/conf"
@@ -79,8 +79,8 @@ module BmcDaemonLib
79
79
  Encoding.default_external = "utf-8"
80
80
 
81
81
  # Init New Relic, Rollbar
82
- prepare_newrelic if self.feature?(:newrelic)
83
- prepare_rollbar if self.feature?(:rollbar)
82
+ # prepare_newrelic
83
+ #prepare_rollbar if self.feature?(:rollbar)
84
84
 
85
85
  # Try to access any key to force parsing of the files
86
86
  self[:dummy]
@@ -132,12 +132,13 @@ module BmcDaemonLib
132
132
  # Guess if the specific feature si available
133
133
  case name
134
134
  when :newrelic
135
- self.at(:newrelic, :license)
135
+ return false if Gem.datadir('newrelic_rpm').nil?
136
+ return self.at(:newrelic, :license)
136
137
  when :rollbar
137
- self.at(:rollbar, :token)
138
- else
139
- false
138
+ return false if Gem.datadir('rollbar').nil?
139
+ return self.at(:rollbar, :token)
140
140
  end
141
+ return false
141
142
  end
142
143
 
143
144
  # Defaults generators
@@ -171,19 +172,9 @@ module BmcDaemonLib
171
172
  end
172
173
  end
173
174
 
174
-
175
- protected
176
-
177
- def self.load_files
178
- load files: @files, namespaces: { environment: @app_env }
179
- end
180
-
181
- def self.add_config path
182
- @files << File.expand_path(path) if path && File.readable?(path)
183
- end
184
-
185
175
  def self.prepare_newrelic
186
- # Require lib
176
+ # Disable if no config present
177
+ return unless self.feature?(:newrelic)
187
178
  section = self[:newrelic]
188
179
 
189
180
  # Enable GC profiler
@@ -210,8 +201,8 @@ module BmcDaemonLib
210
201
  end
211
202
 
212
203
  def self.prepare_rollbar
213
- # # Disable if no config present
214
- # return unless self.feature?(:rollbar)
204
+ # Disable if no config present
205
+ return unless self.feature?(:rollbar)
215
206
  section = self[:rollbar]
216
207
 
217
208
  # Configure
@@ -219,23 +210,26 @@ module BmcDaemonLib
219
210
  config.enabled = true
220
211
  config.access_token = section[:token].to_s
221
212
  config.code_version = @app_version
222
-
223
- #config.logger
224
- config.environment = @app_env
225
-
226
- # Report asynchronously
213
+ config.environment = @app_env
214
+ #config.logger = Logger.new(logfile_path(:rollbar))
215
+ config.logger = LoggerPool.instance.get :rollbar
227
216
  config.use_async = true
228
- # Here we'll disable in 'test':
229
- # if Rails.env.test? || Rails.env.development?
230
- # config.enabled = false
231
- # end
232
- #logfile_path(:newrelic)
233
217
  end
234
218
 
235
219
  # Notify startup
236
220
  Rollbar.info("#{@app_name} #{@app_ver} [#{@host}]")
237
221
  end
238
222
 
223
+ protected
224
+
225
+ def self.load_files
226
+ load files: @files, namespaces: { environment: @app_env }
227
+ end
228
+
229
+ def self.add_config path
230
+ @files << File.expand_path(path) if path && File.readable?(path)
231
+ end
232
+
239
233
  private
240
234
 
241
235
  def self.ensure_init
@@ -6,6 +6,8 @@ module BmcDaemonLib
6
6
  class LoggerPool
7
7
  include Singleton
8
8
 
9
+ LOG_ROTATION = "daily"
10
+
9
11
  def get pipe = nil
10
12
  pipe = :default if pipe.to_s.empty?
11
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmc-daemon-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
@@ -80,34 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.9'
83
- - !ruby/object:Gem::Dependency
84
- name: newrelic_rpm
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rollbar
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
83
  description: 'Shared utilities to build a daemon: logger, configuration, helpers'
112
84
  email: bmc-daemon-lib@bmconseil.com
113
85
  executables: []