eco-helpers 3.0.32 → 3.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04541ff2083942aea30704e9e9fa81eb8eaa97a077751f9026f6ce0736d16fc7
4
- data.tar.gz: 00d0b4cb1333605a5d951f393e8ba7ca78dd0d720037564b8e7998cf02fb8924
3
+ metadata.gz: e694dc0194835048aa7c3f08476a92c6c1460d5e535b0115e329d0370a38cc00
4
+ data.tar.gz: 42060e18701ce44244eb1246203a46c09e0fa157112f339fa2a4487b5559a425
5
5
  SHA512:
6
- metadata.gz: 605d6b462db16cca9303a33126f8524abd249627d868f36c169fbee3a42492cc1efe49e4ed2943be66d753bdffd629fddba9c7ab62d0a1acc3152e0370425726
7
- data.tar.gz: a6f41f8e987373457c237314c218dd493e3aaf775084e4616fb69f403e04876ca8af360c28b6564ecafd70405aa03c83a769c99f25342cbb0006f4b8762f9ea9
6
+ metadata.gz: c9a18f38a0ccd380b6f72a5925dbbeaa10ef9c9812b70712e55fd86bf5ff9532cf884cc2a0c74a7c53c3aa989d2978ed6b986ab35524e2ea9d338d30d7b3adbe
7
+ data.tar.gz: 6fabe85f5b1255edf3fe6b7ad345e69ed067b839a1a9b41dce42a009aeff996c82cf1c32d8dc7ca47a628d38d8c8dfc584202c435ebd62b50f09725b9922513c
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [3.0.33] - 2025-04-xx
5
+ ## [3.0.35] - 2025-04-xx
6
6
 
7
7
  ### Added
8
8
 
@@ -10,6 +10,31 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ ## [3.0.34] - 2025-04-09
14
+
15
+ ### Changed
16
+
17
+ - `Location::Service::TreeDiff::Convertible::Inputable` (in `Eco::API::UseCases::GraphQL::Samples`)
18
+ - `#input_file` to `exit 0` when no files are found.
19
+ - It is **important to note** that we want the full process chain to abort (that is the reason in the first place why the `exit 1` was in place).
20
+
21
+ ### Fixed
22
+
23
+ - `CliDefault::Input` to log in `:general` channel what files have beens scoped.
24
+
25
+ ## [3.0.33] - 2025-04-08
26
+
27
+ ### Added
28
+
29
+ - `Mailer` to include `:general` channel messages.
30
+ - And simplified code
31
+ - `CliDefault::Input` to log in `:general` channel what files have beens scoped.
32
+
33
+ ### Changed
34
+
35
+ - **Improved** recursive `cause` on repeated error.
36
+ - `AuxiliarLogger` to use `:debug` as default, when `:general` channel is used without specifying an actual log level.
37
+
13
38
  ## [3.0.32] - 2025-04-08
14
39
 
15
40
  ### Added
@@ -22,19 +22,14 @@ class Eco::API::Common::Loaders::Workflow::Mailer < Eco::API::Common::Loaders::W
22
22
  next unless some_update_case?(io) || maybe_error_pages_or_tree_updates?(io)
23
23
 
24
24
  subject = base_subject
25
+ subject = "#{subject} & Errors" if session.job_groups.errors?
26
+ subject = "#{subject} - Exception!" if error?
25
27
 
26
- if session.job_groups.empty? && error?
27
- subject = "#{subject} - Exception!"
28
- session.mail(subject: subject, body: errors_n_warnings(io))
29
- else
30
- subject = "#{subject} & Errors" if session.job_groups.errors?
31
- subject = "#{subject} - Exception!" if error?
28
+ body = general_messages(io)
29
+ body << "\n#{session.summary}" unless session.job_groups.empty? && error?
30
+ body << "\n#{errors_n_warnings(io)}"
32
31
 
33
- msg = "#{session.summary}\n"
34
- msg += errors_n_warnings(io)
35
-
36
- session.mail(subject: subject, body: msg) unless msg.strip.empty?
37
- end
32
+ session.mail(subject: subject, body: body) unless body.strip.empty?
38
33
  end
39
34
  end
40
35
 
@@ -66,6 +61,13 @@ class Eco::API::Common::Loaders::Workflow::Mailer < Eco::API::Common::Loaders::W
66
61
  some_other_case?(io) && error?
67
62
  end
68
63
 
64
+ def general_messages(io)
65
+ gen_msg = io.logger.cache.logs(level: %i[general])
66
+ return if gen_msg.empty?
67
+
68
+ "GENERAL MESSAGES:\n#{gen_msg.join}\n"
69
+ end
70
+
69
71
  def errors_n_warnings(io)
70
72
  [error_message, log_err_n_warn(io)].join("\n")
71
73
  end
@@ -23,7 +23,8 @@ module Eco
23
23
  meth = channel.to_s.downcase.to_sym
24
24
 
25
25
  define_method(meth) do |msg = nil, &block|
26
- def_block.call(meth, msg, &block)
26
+ # `block` instead of `&block`
27
+ instance_exec(meth, msg, block, &def_block)
27
28
  end
28
29
  end
29
30
  end
@@ -8,7 +8,7 @@ module Eco
8
8
  require_relative 'logger/channels'
9
9
  include Channels
10
10
 
11
- channels! do |channel, message = nil, &block|
11
+ channels! do |channel, message = nil, block|
12
12
  format_proc(console: true) do |severity, datetime, msg, formatted_msg|
13
13
  cache.add(severity, datetime, msg, formatted_msg)
14
14
  end.call(channel, Time.now, 'prog_name', message || block.call)
@@ -1,5 +1,10 @@
1
1
  class ::Exception
2
- def patch_full_message(trace_count: -1)
2
+ def patch_full_message(trace_count: -1, cause_levels: 3)
3
+ return unless cause_levels.positive?
4
+
5
+ cause_levels -= 1
6
+ trace_count = 3 if trace_count.negative? || trace_count > 3
7
+
3
8
  tracing = backtrace || []
4
9
  first_ln = tracing[0]
5
10
  tracing = tracing[1..trace_count]
@@ -14,7 +19,10 @@ class ::Exception
14
19
 
15
20
  unless cause.nil?
16
21
  msg << "\nCAUSE:"
17
- msg << cause.patch_full_message(trace_count: trace_count)
22
+ msg << cause.patch_full_message(
23
+ trace_count: trace_count,
24
+ cause_levels: cause_levels
25
+ )
18
26
  end
19
27
 
20
28
  msg.join("\n")
@@ -27,7 +27,7 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
27
27
  log(:info) { "Using input file '#{file}'" }
28
28
  else
29
29
  log(:warn) { 'Could not find any input file' }
30
- exit(1)
30
+ exit 0
31
31
  end
32
32
  end
33
33
  end
@@ -19,7 +19,10 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
19
19
  private
20
20
 
21
21
  def input_csv
22
- @input_csv ||= Eco::CSV.read(input_file, encoding: input_encoding).then do |csv|
22
+ @input_csv ||= Eco::CSV.read(
23
+ input_file,
24
+ encoding: input_encoding
25
+ ).then do |csv|
23
26
  next csv unless header_maps&.any?
24
27
 
25
28
  csv.transform_headers do |name|
@@ -65,7 +65,10 @@ module Eco::API::UseCases::GraphQL::Samples
65
65
  end
66
66
  end
67
67
 
68
- def comparer(source_1 = live_nodes_list, source_2 = file_nodes_list)
68
+ def comparer(
69
+ source_1 = live_nodes_list,
70
+ source_2 = file_nodes_list
71
+ )
69
72
  @comparer ||= nodes_diff_class.new(
70
73
  source_1,
71
74
  source_2,
@@ -85,6 +85,14 @@ class Eco::CliDefault::Input < Eco::API::Common::Loaders::CliConfig
85
85
  options.deep_merge!(input: {file: {name: file}})
86
86
  options.deep_merge!(input: {file: {format: format}})
87
87
 
88
+ session.log(:general) {
89
+ files_msg = 'Using this/these as INPUT FILE(s):'
90
+ files_msg << "\n * "
91
+ files_msg << [file].flatten.map do |path|
92
+ File.basename(path)
93
+ end.join("\n * ")
94
+ }
95
+
88
96
  case format
89
97
  when :xml
90
98
  [file].flatten.each {|f| session.config.files.validate(:xml, f)}
@@ -9,7 +9,7 @@ module Eco
9
9
  def logger
10
10
  if instance_variable_defined?(:@session) && !@session.nil?
11
11
  @session.logger
12
- elsif respond_to?(:session, true)
12
+ elsif respond_to?(:session, true) && !send(:session).nil?
13
13
  send(:session).logger
14
14
  elsif Object.const_defined?(:ASSETS)
15
15
  ASSETS.session.logger
@@ -29,7 +29,7 @@ module Eco
29
29
  return unless logger
30
30
 
31
31
  levels = levels.compact.uniq.map(&:to_sym)
32
- levels.unshift(:info) if levels.include?(:general) && levels.length == 1
32
+ levels.unshift(:debug) if levels.include?(:general) && levels.length == 1
33
33
 
34
34
  levels.uniq.each do |level|
35
35
  next unless logger.respond_to?(:level, true)
@@ -68,7 +68,7 @@ module Eco
68
68
  proc do |severity, datetime, _progname, msg|
69
69
  str_stamp = console ? console_timestamp(datetime) : timestamp(datetime)
70
70
 
71
- "#{severity.to_s[0]}: #{str_stamp}#{msg}\n".tap do |formatted_msg|
71
+ "#{severity.to_s[0].upcase}: #{str_stamp}#{msg}\n".tap do |formatted_msg|
72
72
  block&.call(severity, datetime, msg, formatted_msg)
73
73
  end
74
74
  end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = '3.0.32'.freeze
2
+ VERSION = '3.0.34'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.32
4
+ version: 3.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-07 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug