bmc-daemon-lib 0.8.0 → 0.9.0

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: 7357ca31777d1e1c08aba18cca42f68f41094dbf
4
- data.tar.gz: c39322bb7e140fa19a06697aa7ca5c16945721aa
3
+ metadata.gz: f1519e2b73ad52b107340fdc4b552a241eda330f
4
+ data.tar.gz: efe6a470bc0c1b5bb64652ca2c8c09f8eb5e2af4
5
5
  SHA512:
6
- metadata.gz: c9b89de735c85cae26e6d60f51be0d89044fb382cd06ccf9bac18a67126c9f2447490a4ae13c1368aab7656fd835ba39400a9a5b3c998f1f50d73b4becd97e52
7
- data.tar.gz: 054ebf6c828545e658cbe275054b8e5eb1722be24a3ede634e4f7d8fb121daa33697038a53522f7081c893710347c0a9e7711ce2c54e0faadda5e5dbd9c87cfa
6
+ metadata.gz: 35b425a7c42b1b2f4ac771d7f056ddc69d71a74854c5af549464b1c33680d2b82159ae2e2de93da6069875cff9e8edb5ae13e6d0fe11668dc5124ae125aa8eee
7
+ data.tar.gz: bf675ec3c7f45e69dcfe57a3fd5f903080982e764c585e882b40774b7e5579dd81dc2ea02c2aa0242da1c9c51dd1bd80034e5c857880fe554a4bb3cb04273c79
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bmc-daemon-lib (0.8.0)
4
+ bmc-daemon-lib (0.9.0)
5
5
  chamber (~> 2.9.1)
6
6
 
7
7
  GEM
@@ -12,8 +12,8 @@ GEM
12
12
  hashie (~> 3.3)
13
13
  thor (~> 0.19.1)
14
14
  diff-lcs (1.3)
15
- hashie (3.5.1)
16
- parser (2.3.3.1)
15
+ hashie (3.5.3)
16
+ parser (2.4.0.0)
17
17
  ast (~> 2.2)
18
18
  powerpack (0.1.1)
19
19
  rainbow (2.2.1)
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.8.0"
4
+ spec.version = "0.9.0"
5
5
 
6
6
  # Project description
7
7
  spec.name = "bmc-daemon-lib"
@@ -63,8 +63,8 @@ module BmcDaemonLib
63
63
  ENV["NEWRELIC_AGENT_ENABLED"] = "false"
64
64
 
65
65
  # Add other config files
66
- add_config generate(:config_defaults)
67
- add_config generate(:config_etc)
66
+ add_config generate_config_defaults
67
+ add_config generate_config_etc
68
68
 
69
69
  # Return something
70
70
  return @app_name
@@ -136,54 +136,61 @@ module BmcDaemonLib
136
136
  return logfile
137
137
  end
138
138
 
139
- def self.feature? name
139
+ # Feature testers
140
+ def self.feature_newrelic?
141
+ ensure_init
142
+ return false if Gem.datadir('newrelic_rpm').nil?
143
+ return false if self.at(:newrelic, :enabled) == false
144
+ return false if self.at(:newrelic, :disabled) == true
145
+ return self.at(:newrelic, :license) || false
146
+ end
147
+ def self.feature_rollbar?
140
148
  ensure_init
149
+ return false if Gem.datadir('rollbar').nil?
150
+ return false if self.at(:rollbar, :enabled) == false
151
+ return false if self.at(:rollbar, :disabled) == true
152
+ return self.at(:rollbar, :token) || false
153
+ end
141
154
 
142
- # Guess if the specific feature si available
155
+ def self.feature? name
143
156
  case name
144
157
  when :newrelic
145
- return false if Gem.datadir('newrelic_rpm').nil?
146
- return false if self.at(:newrelic, :enabled) == false
147
- return false if self.at(:newrelic, :disabled) == true
148
- return self.at(:newrelic, :license) || false
158
+ return feature_newrelic?
149
159
  when :rollbar
150
- return false if Gem.datadir('rollbar').nil?
151
- return false if self.at(:rollbar, :enabled) == false
152
- return false if self.at(:rollbar, :disabled) == true
153
- return self.at(:rollbar, :token) || false
160
+ return feature_rollbar?
154
161
  end
155
162
  return false
156
163
  end
157
164
 
158
- # Defaults generators
159
- def self.generate what
165
+ # Generators
166
+ def self.generate_user_agent
160
167
  ensure_init
161
- return case what
162
-
163
- when :user_agent
164
- "#{@app_name}/#{@app_ver}" if @app_name && @app_ver
165
-
166
- when :config_defaults
167
- "#{@app_root}/defaults.yml" if @app_root
168
-
169
- when :config_etc
170
- "/etc/#{@app_name}.yml" if @app_name
171
-
172
- when :process_name
173
- parts = [@app_name, @app_env]
174
- parts << self[:port] if self[:port]
175
- parts.join('-')
176
-
177
- when :pidfile
178
- process_name = self.generate(:process_name)
179
- File.expand_path "#{process_name}.pid", PIDFILE_DIR
180
-
181
- when :config_message
182
- config_defaults = self.generate(:config_defaults)
168
+ "#{@app_name}/#{@app_ver}" if @app_name && @app_ver
169
+ end
170
+ def self.generate_config_defaults
171
+ ensure_init
172
+ "#{@app_root}/defaults.yml" if @app_root
173
+ end
174
+ def self.generate_config_etc
175
+ ensure_init
176
+ "/etc/#{@app_name}.yml" if @app_name
177
+ end
178
+ def self.generate_process_name
179
+ ensure_init
180
+ parts = [@app_name, @app_env]
181
+ parts << self[:port] if self[:port]
182
+ parts.join('-')
183
+ end
184
+ def self.generate_pidfile
185
+ ensure_init
186
+ process_name = self.generate_process_name
187
+ File.expand_path "#{process_name}.pid", PIDFILE_DIR
188
+ end
189
+ def self.generate_config_message
190
+ ensure_init
191
+ config_defaults = self.generate_config_defaults
183
192
  config_etc = self.generate(:config_etc)
184
-
185
193
  "A default configuration is available (#{config_defaults}) and can be copied to the default location (#{config_etc}): \n sudo cp #{config_defaults} #{config_etc}"
186
- end
187
194
  end
188
195
 
189
196
  def self.prepare_newrelic
@@ -53,7 +53,7 @@ module BmcDaemonLib
53
53
  def worker_sleep seconds
54
54
  return if seconds.nil? || seconds.to_f == 0.0
55
55
  worker_status STATUS_SLEEPING
56
- log_info "worker_sleep: #{seconds}", @config
56
+ log_debug "worker_sleep: #{seconds}"
57
57
  sleep seconds
58
58
  end
59
59
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmc-daemon-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler