easy_app_helper 4.2.2 → 4.2.3

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: 8f9a76df6a11e57f95aaa3fd4c29ed693eeeb7e2
4
- data.tar.gz: f5bb1986b5bd1fae6847a14c064b2bd5cd85791e
3
+ metadata.gz: eec0965d2481f26200028412a45d62e7a67f7777
4
+ data.tar.gz: 3eca04154c9b5714fb04fab33613bc4270c4b92d
5
5
  SHA512:
6
- metadata.gz: f1fc1d459470d91e720b53b88472b79504829b31156a9f0532d113a72889d70043e947cf777ae6cb9451466c29b7420537ed4c7340ea77e88f8b7c50441ffb6e
7
- data.tar.gz: 16d06cb048630646b37501c23c3466899420d9f27c99a9619d5dab9a6b34485a76b2b8ba2391c009e12bfd8a940ea133ae831d687756b2cd7e07c6fdd7c28b23
6
+ metadata.gz: de5600747d5e0f5b7d1254d3504479dfc426e2e8d6315910b7c694bbaa6f69e7290c9060afe19e4d6bc5016b4fa54a42c332f5ba9e0ebb1343820414e562ae74
7
+ data.tar.gz: a6d6c174722d8dbbe1cf350b2f91de55598f1fd37fba657e3896650ef4a82bb72bc25d144f1293d6cdc78eba6a7d55f30c5172bfdfa2367103e451863e6d57f6
@@ -6,9 +6,9 @@ module EasyAppHelper
6
6
  def self.init_command_line_options
7
7
  EasyAppHelper.config.add_command_line_section('Debug and logging options') do |slop|
8
8
  slop.on :debug, 'Run in debug mode.', argument: false
9
- slop.on 'debug-on-err', 'Run in debug mode with output to stderr.', argument: false
10
- slop.on 'log-level', "Log level from 0 to 5, default #{::Logger::Severity::WARN}.", argument: true, as: Integer
11
- slop.on 'log-file', 'File to log to.', argument: true, as: String
9
+ slop.on :'debug-on-err', 'Run in debug mode with output to stderr.', argument: false
10
+ slop.on :'log-level', "Log level from 0 to 5, default #{::Logger::Severity::WARN}.", argument: true, as: Integer
11
+ slop.on :'log-file', 'File to log to.', argument: true, as: String
12
12
  end
13
13
  end
14
14
 
@@ -22,12 +22,22 @@ module EasyAppHelper
22
22
  log_device = File::NULL
23
23
  if EasyAppHelper.config[:debug]
24
24
  log_device = if EasyAppHelper.config[:'log-file']
25
- if File.writable? EasyAppHelper.config[:'log-file']
26
- EasyAppHelper.config[:'log-file']
25
+ if File.exists? EasyAppHelper.config[:'log-file']
26
+ if File.writable? EasyAppHelper.config[:'log-file']
27
+ EasyAppHelper.config[:'log-file']
28
+ else
29
+ STDERR.puts "WARNING: Log file '#{EasyAppHelper.config[:'log-file']}' is not writable. Switching to STDERR..."
30
+ EasyAppHelper.config[:'log-file'] = nil
31
+ STDERR
32
+ end
27
33
  else
28
- STDERR.puts "WARNING: Log file '#{EasyAppHelper.config[:'log-file']}' is not writable. Switching to STDERR..."
29
- EasyAppHelper.config[:'log-file'] = nil
30
- STDERR
34
+ if File.writable? File.dirname(EasyAppHelper.config[:'log-file'])
35
+ EasyAppHelper.config[:'log-file']
36
+ else
37
+ STDERR.puts "WARNING: Cannot write log file in '#{File.dirname EasyAppHelper.config[:'log-file']}'. Switching to STDERR..."
38
+ EasyAppHelper.config[:'log-file'] = nil
39
+ STDERR
40
+ end
31
41
  end
32
42
  elsif EasyAppHelper.config[:'debug-on-err']
33
43
  STDERR
@@ -1,3 +1,3 @@
1
1
  module EasyAppHelper
2
- VERSION = '4.2.2'
2
+ VERSION = '4.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_app_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - L.Briais
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-16 00:00:00.000000000 Z
11
+ date: 2016-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler