soaspec 0.2.13 → 0.2.14

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: f0083db30d4a6c0ecee3867fd083318cb06fb971
4
- data.tar.gz: 4a09507a106955ee4d8728f2335a69641189bdbe
3
+ metadata.gz: 110bae91f81c299800f9a29e7188cf4097b7d318
4
+ data.tar.gz: eac802e27d70316d243c4a28c24413164d16436f
5
5
  SHA512:
6
- metadata.gz: adfe9d60caad2441f1b83c0aef71ba7f56bb4d4cfad85890422fcc9ffa3ad262c467f3571094d6bc03d1e105fe56e882c441daa2de1ca266bfb3b8b9ffdfc773
7
- data.tar.gz: e82c9d480898b80c549892048695d80fd733df5c91fdf90fa330aebe5c5bec44a7831aaae7fbdb64c6f60ba475b513d671c1cd2e2dd07efacfcd3ac2b3e82087
6
+ metadata.gz: fb3b7ba536114cc6ab7ffc3b2d0fc20fd6134e4f95af8759ae6404f1a39f4e74ac9fe9a42c47af89bdbe826fdc78731c844b9401a298888c5b5d2cc384c1edf5
7
+ data.tar.gz: c8ed7a0cb504cee4df85e773e8ba585c59406d0c635ed6a312bd4c6c5d30ad9290aa1f3c4158780c9544cce75697a758879b783e082cdb8fde2378456c7865f7
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.2.14
2
+ * Bug Fix
3
+ * Remove default log file being created before it is changed to a custom location
4
+
1
5
  Version 0.2.13
2
6
  * Enhancements
3
7
  * Allow terminal logging color to be changed through a `terminal_color` attribute
@@ -97,5 +97,3 @@ module Soaspec
97
97
  end
98
98
  end
99
99
  end
100
-
101
- RestClient.log = Soaspec::SpecLogger.create
@@ -34,13 +34,30 @@ module Soaspec
34
34
  attr_accessor :terminal_color
35
35
  # Readers for log parameters
36
36
  attr_reader :output_to_terminal, :output_to_file, :time_test_run
37
+
37
38
  # Set file to log traffic to
38
- attr_writer :traffic_file
39
+ def traffic_file=(file)
40
+ @traffic_file = file
41
+ reset_log
42
+ end
43
+
44
+ # @return [String] Traffic file to create logs at
45
+ def traffic_file
46
+ return File.join(traffic_folder, @traffic_file) if @traffic_file
47
+
48
+ filename = "traffic_#{time_test_run}.log"
49
+ File.join(traffic_folder, filename)
50
+ end
51
+
52
+ # Unset Logger object. It will be recreated on next time 'info' is called
53
+ def reset_log
54
+ @logger = nil
55
+ end
39
56
 
40
57
  # Whether to log all API traffic
41
58
  def log_api_traffic=(set)
42
59
  @log_api_traffic = set
43
- RestClient.log = nil unless set
60
+ reset_log
44
61
  end
45
62
 
46
63
  # @return [Boolean] Whether to log all API traffic
@@ -51,21 +68,13 @@ module Soaspec
51
68
  # @param [Symbol, Boolean] value # Whether to output API traffic to log file
52
69
  def output_to_file=(value)
53
70
  @output_to_file = value
54
- RestClient.log = Soaspec::SpecLogger.create
71
+ reset_log
55
72
  end
56
73
 
57
74
  # @param [Symbol, Boolean] value # Whether to output API traffic to STDOUT
58
75
  def output_to_terminal=(value)
59
76
  @output_to_terminal = value
60
- RestClient.log = Soaspec::SpecLogger.create
61
- end
62
-
63
- # @return [String] Traffic file to create logs at
64
- def traffic_file
65
- return File.join(traffic_folder, @traffic_file) if @traffic_file
66
-
67
- filename = "traffic_#{time_test_run}.log"
68
- File.join(traffic_folder, filename)
77
+ reset_log
69
78
  end
70
79
 
71
80
  # Create new log file if necessary and setup logging level
@@ -78,14 +87,17 @@ module Soaspec
78
87
  print message.colorize(terminal_color) if @output_to_terminal
79
88
  message if @output_to_file
80
89
  end
90
+ RestClient.log = @logger
81
91
  @logger
82
92
  end
83
93
 
84
94
  # Log a message using Soaspec logger
95
+ # Logger (and it's file) will be created if it's not already set
85
96
  # @param [String] message The message to add to the logger
86
97
  def info(message)
87
98
  return unless log_api_traffic?
88
99
 
100
+ create unless @logger
89
101
  if message.respond_to? :each
90
102
  message.each do |message_item|
91
103
  @logger.info(message_item)
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.2.13'.freeze
2
+ VERSION = '0.2.14'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-11 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler