data_collector 0.61.0 → 0.62.0

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: ef5644ca619ea4368ca7e6620fd5b692995b3f81206837e91a7f8b576799014e
4
- data.tar.gz: 1c064d51a23891829cc376822de08368e1129cc5891a13a47e3c66e893a75e11
3
+ metadata.gz: '0923a758b6a621afd2d2fb4aa85f580cb757ee3ca1150e7175827a9bf617e07b'
4
+ data.tar.gz: 1a83fecc0244088447747f4c196ffcfddc6cb70e5ab8f40232a0401ac9912fc3
5
5
  SHA512:
6
- metadata.gz: 524275f37414a0a67566ae4d942ffee36de24980c99138c87947f71c995adf57924a2d5e34de5e7e0b3b313e043132c7dbe76eb364ecd0bc014e3e5eca120466
7
- data.tar.gz: 5f54cc53b400f1778edf35b3e9ba5b9a981b17a688467ba05fd7f2e18449002c10ea55bc40d6c152d12481f7957ec17baf9ebf278a1bcab0b990000d1ab3873f
6
+ metadata.gz: d6d75c0bd763bbf2c107ebe7e5bc2c5c813454c6ad496eb234d38c79fae01525969e5d8b6abd601cf3103f8363f3f7965957cb54103eb10aaa80b65f80aa3073
7
+ data.tar.gz: '029d8bbf6819f90b955f373d8ee8e795fca2b130fc1900b487ef692a1b56cf7f7a8d02b222637bf83361354f1e795713c731eba90fb446f2906a758986c99af1'
@@ -10,7 +10,7 @@ module DataCollector
10
10
  @mtime = nil
11
11
 
12
12
  def self.version
13
- '0.0.3'
13
+ '0.0.4'
14
14
  end
15
15
 
16
16
  def self.name
@@ -59,7 +59,8 @@ module DataCollector
59
59
 
60
60
  ftime = File.exist?("#{@config_file_path}/#{@config_file_name}") ? File.mtime("#{@config_file_path}/#{@config_file_name}") : nil
61
61
  if @config.nil? || @config.empty? || @mtime != ftime
62
- config = YAML::load_file("#{@config_file_path}/#{@config_file_name}", aliases: true, permitted_classes: [Time, Symbol])
62
+ # config = YAML::load_file("#{@config_file_path}/#{@config_file_name}", aliases: true, permitted_classes: [Time, Symbol])
63
+ config = interpret_yaml_with_expressions("#{@config_file_path}/#{@config_file_name}", ENV)
63
64
  @config = process(config)
64
65
  end
65
66
  end
@@ -92,5 +93,36 @@ module DataCollector
92
93
  private_class_method :init
93
94
  private_class_method :discover_config_file_path
94
95
  private_class_method :process
96
+
97
+ private
98
+ def self.interpret_yaml_with_expressions(yaml_file, variables = {})
99
+ # Read the YAML file content
100
+ content = File.read(yaml_file)
101
+
102
+ # Process any :key: "${expression}" patterns
103
+ processed_content = content.gsub(/:key:\s*"?\$\{([^}]+)\}"?/) do |match|
104
+ expression = $1.strip
105
+
106
+ # Evaluate the expression using the provided variables
107
+ if variables.key?(expression)
108
+ # Replace with the variable value
109
+ match.gsub("${#{expression}}", variables[expression].to_s)
110
+ elsif expression.include?('.')
111
+ # Handle dot notation for nested variables
112
+ parts = expression.split('.')
113
+ value = variables
114
+ parts.each do |part|
115
+ value = value[part.to_sym] if value.is_a?(Hash) && value.key?(part.to_sym)
116
+ end
117
+ value.to_s
118
+ else
119
+ # Keep the original if we can't evaluate
120
+ match
121
+ end
122
+ end
123
+
124
+ # Parse the processed YAML content
125
+ YAML.load(processed_content, aliases: true, permitted_classes: [Time, Symbol])
126
+ end
95
127
  end
96
128
  end
@@ -138,7 +138,9 @@ module DataCollector
138
138
  module_function :error
139
139
 
140
140
  def logger(*destinations)
141
- @logger ||= begin
141
+ @logger if @logger && (@log_destination.eql?(destinations.flatten) || destinations.empty? || destinations.nil?)
142
+ @log_destination = destinations.flatten
143
+ @logger = begin
142
144
  destinations = STDOUT if destinations.nil? || destinations.empty?
143
145
  Logger.new(ProxyLogger.new(destinations))
144
146
  rescue StandardError => e
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.61.0"
3
+ VERSION = "0.62.0"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.61.0
4
+ version: 0.62.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0'
409
409
  requirements: []
410
- rubygems_version: 3.6.2
410
+ rubygems_version: 3.6.8
411
411
  specification_version: 4
412
412
  summary: ETL helper library
413
413
  test_files: []