data_collector 0.23.0 → 0.24.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: 1a6db4367b12a41101620cc818a1995868aab20b65157de8c19ea60c68aa90a0
4
- data.tar.gz: 39a2cbcd665f85d71bda741a131c54d4f2871ae83ae63b86c9eed9f0d84e405a
3
+ metadata.gz: 7745e79eb3836ab3c469cc5da39f395d42c144940b98115c96058fb01f8a629c
4
+ data.tar.gz: 77aeb246a6a23477d07195c020091999825af21c9639c0a9679017daefeea9e9
5
5
  SHA512:
6
- metadata.gz: 5d7e6e243f9693603c4502b2f1bbe2fb64b8cf95718be257066940d6fafed24a8352ded805f285b617e25f5fbd703bf6e812dbd9f2b85d5c22cc143e7cdfdc1e
7
- data.tar.gz: 73b0c03ef6ccb7855cfc1b6f424c543cc00fc79e182ccc2525c068f3b8d97535e4eaaaa66b0fd59225049d6a0dfb3dc55861319638dfb4c6df489ede6c1f9077
6
+ metadata.gz: e48596ac6e5fc14be89c2aadc50416558fa4a08594d28cccee630c1157dc365a556999c82d303e4669c94e1db88d6b0cf3f044730d0057586220a6c3172b72a6
7
+ data.tar.gz: 2112dfa9191e8aa948317a16d581a9ea487327030cb013b43937757c144c33ca4fc975faee91fd6731d8f043ed0cefd5ecc28a562351c5de9b96196167871e36
@@ -26,7 +26,7 @@ module DataCollector
26
26
  private
27
27
 
28
28
  def create_listener
29
- absolute_path = File.absolute_path("#{URI.decode_uri_component(@uri.to_s)}")
29
+ absolute_path = File.absolute_path("#{@uri.host}#{@uri.path}")
30
30
  raise DataCollector::Error, "#{@uri.to_s} not found" unless File.exist?(absolute_path)
31
31
 
32
32
  @listener ||= Listen.to(absolute_path, @options) do |modified, added, _|
@@ -4,7 +4,7 @@ module DataCollector
4
4
  class Input
5
5
  class Generic
6
6
  def initialize(uri, options = {})
7
- @uri = URI(URI.decode_uri_component(uri.to_s))
7
+ @uri = URI(URI.decode_uri_component(uri.to_s)) #"#{uri.scheme}://#{URI.decode_uri_component(uri.host)}#{URI.decode_uri_component(uri.path)}"
8
8
  @options = options
9
9
  @running = false
10
10
 
@@ -160,7 +160,8 @@ module DataCollector
160
160
 
161
161
  def from_file(uri, options = {})
162
162
  data = nil
163
- absolute_path = File.absolute_path("#{URI.decode_uri_component(uri.to_s)}")
163
+ uri = normalize_uri(uri)
164
+ absolute_path = File.absolute_path(uri)
164
165
  raise DataCollector::Error, "#{uri.to_s} not found" unless File.exist?("#{absolute_path}")
165
166
  unless options.has_key?('raw') && options['raw'] == true
166
167
  @raw = data = File.read("#{absolute_path}")
@@ -233,5 +234,8 @@ module DataCollector
233
234
  return file_type
234
235
  end
235
236
 
237
+ def normalize_uri(uri)
238
+ "#{URI.decode_uri_component(uri.host)}#{URI.decode_uri_component(uri.path)}"
239
+ end
236
240
  end
237
241
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.23.0"
3
+ VERSION = "0.24.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik