pantheios-ruby 0.11.1 → 0.11.2

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: f17b99ae0e63f13c7cd21b0514d223e89308c4db
4
- data.tar.gz: 78ab9f8852effb70635b021e2d766d2334748d51
3
+ metadata.gz: ba27a1f4565489233730df50c8742a400e7c8cee
4
+ data.tar.gz: 6589a0a3912e4c690e9eaf11f3128a2e775639d6
5
5
  SHA512:
6
- metadata.gz: 1194d7902fc8fe1989522618c2c6725d6be8828dcd023248586fe5b4fb35eeb706fc5b8f4f04398781477e3d94567d3f399d58814bae801ad844e3521623cda2
7
- data.tar.gz: 979c17e7c5774c35e4d9558901648de1ae3ff1294f4ad68e1144524b02a7451677e5b3c87db5c8e964933ab7fdd17735776109bbe458c698448824fa32f28064
6
+ metadata.gz: ecb01f00e31caff3b26b1c550499c1a6a94d0a7733dac43b578dc0d30dcdebaef9e1df0afc26fe4dbfa5fa1716a50821bedf5271ddae91d130576bb0e9dd8354
7
+ data.tar.gz: 9a381fc7a7ad2f2c39edf9514ea47e9484ccf9701aa3098d2b9db70d160fd4ddb3474535f9ca3ad9828622107dbc0a721798db25572c70ac1015b665ea949b21
@@ -5,7 +5,7 @@
5
5
  # Purpose: The Pantheios.Ruby core (::Pantheios::Core)
6
6
  #
7
7
  # Created: 2nd April 2011
8
- # Updated: 6th January 2018
8
+ # Updated: 8th January 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
11
11
  #
@@ -47,9 +47,10 @@
47
47
  require 'pantheios/globals'
48
48
 
49
49
  require 'pantheios/application_layer/stock_severity_levels'
50
- require 'pantheios/util/process_util'
51
50
 
52
- require 'pantheios/services/simple_console_service'
51
+ require 'pantheios/services/simple_console_log_service'
52
+
53
+ require 'pantheios/util/process_util'
53
54
 
54
55
  =begin
55
56
  =end
@@ -73,10 +74,10 @@ module Core
73
74
 
74
75
  return true if $DEBUG
75
76
 
76
- levels = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
77
+ levels = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
77
78
 
78
- v_info = levels[:informational]
79
- v_sev = levels[severity] if ::Symbol === severity
79
+ v_info = levels[:informational]
80
+ v_sev = levels[severity] if ::Symbol === severity
80
81
 
81
82
  return false if v_sev > v_info
82
83
 
@@ -5,13 +5,13 @@
5
5
  # Purpose: The Pantheios.Ruby "globals" (::Pantheios::Globals)
6
6
  #
7
7
  # Created: 24th December 2017
8
- # Updated: 24th December 2017
8
+ # Updated: 8th January 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2017, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2017-2018, Matthew Wilson and Synesis Software
15
15
  # All rights reserved.
16
16
  #
17
17
  # Redistribution and use in source and binary forms, with or without
@@ -106,4 +106,6 @@ module Globals
106
106
  end # module Globals
107
107
  end # module Pantheios
108
108
 
109
+ # ############################## end of file ############################# #
110
+
109
111
 
@@ -44,6 +44,8 @@
44
44
  # ######################################################################## #
45
45
 
46
46
 
47
+ require 'pantheios/application_layer/stock_severity_levels'
48
+
47
49
  =begin
48
50
  =end
49
51
 
@@ -72,6 +74,8 @@ class SimpleConsoleLogService
72
74
 
73
75
  def infer_stream sev
74
76
 
77
+ sev = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES[sev] if ::Symbol === sev
78
+
75
79
  (sev.to_i < 6) ? $stderr : $stdout
76
80
  end
77
81
  end
@@ -5,7 +5,7 @@
5
5
  # Purpose: Version for Pantheios.Ruby library
6
6
  #
7
7
  # Created: 2nd April 2011
8
- # Updated: 6th January 2018
8
+ # Updated: 8th January 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/Pantheios-Ruby
11
11
  #
@@ -50,7 +50,7 @@
50
50
  module Pantheios
51
51
 
52
52
  # Current version of the Pantheios.Ruby library
53
- VERSION = '0.11.1'
53
+ VERSION = '0.11.2'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -25,6 +25,27 @@ class Test_SimpleConsoleLogservice < Test::Unit::TestCase
25
25
 
26
26
  if defined?(SimpleConsoleLogService)
27
27
 
28
+ def self.log_and_get_streams sev, msg, pref = nil, t = nil
29
+
30
+ prev_stdout, prev_stderr = $stdout, $stderr
31
+
32
+ begin
33
+
34
+ $stdout = StringIO.new
35
+ $stderr = StringIO.new
36
+
37
+ svc = SimpleConsoleLogService.new
38
+ t ||= Time.now
39
+
40
+ svc.log sev, t, pref, msg
41
+
42
+ [ $stdout.string, $stderr.string ]
43
+ ensure
44
+
45
+ $stdout, $stderr = prev_stdout, prev_stderr
46
+ end
47
+ end
48
+
28
49
  def test_SimpleConsoleLogService_type_is_a_class
29
50
 
30
51
  assert_kind_of(::Class, SimpleConsoleLogService)
@@ -55,7 +76,7 @@ class Test_SimpleConsoleLogservice < Test::Unit::TestCase
55
76
  end
56
77
  end
57
78
 
58
- def test_log_does_nothing_to_standard_streams
79
+ def test_log_writes_to_standard_streams
59
80
 
60
81
  prev_stdout, prev_stderr = $stdout, $stderr
61
82
 
@@ -75,13 +96,38 @@ class Test_SimpleConsoleLogservice < Test::Unit::TestCase
75
96
  stdout_s = $stdout.string
76
97
  stderr_s = $stderr.string
77
98
 
78
- assert_not_empty stdout_s, "NullLogService has not written to $stdout!"
79
- assert_not_empty stderr_s, "NullLogService has not written to $stderr!"
99
+ assert_not_empty stdout_s, "SimpleConsoleLogService has not written to $stdout!"
100
+ assert_not_empty stderr_s, "SimpleConsoleLogService has not written to $stderr!"
80
101
  ensure
81
102
 
82
103
  $stdout, $stderr = prev_stdout, prev_stderr
83
104
  end
84
105
  end
106
+
107
+ def test_writing_to_streams_based_on_severities
108
+
109
+ r = nil
110
+
111
+ stderr_levels = %w{ violation emergency alert critical failure warning warn }.map { |s| s.to_sym }
112
+ stdout_levels = %w{ notice informational info debug0 debug1 debug2 debug3 debug4 trace }.map { |s| s.to_sym }
113
+
114
+ stderr_levels.each do |sev|
115
+
116
+ r = self.class.log_and_get_streams sev, 'msg'
117
+
118
+ assert_empty r[0], "SimpleConsoleLogService wrote unexpectedly to $stdout for severity #{sev}"
119
+ assert_not_empty r[1], "SimpleConsoleLogService failed to write to $stderr for severity #{sev}"
120
+ end
121
+
122
+ stdout_levels.each do |sev|
123
+
124
+ r = self.class.log_and_get_streams sev, 'msg'
125
+
126
+ assert_not_empty r[0], "SimpleConsoleLogService failed to write to $stdout for severity #{sev}"
127
+ assert_empty r[1], "SimpleConsoleLogService wrote unexpectedly to $stderr for severity #{sev}"
128
+ end
129
+ end
85
130
  end
86
131
  end
87
132
 
133
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pantheios-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-06 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xqsr3