spreader 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spreader.rb +2 -2
- metadata +1 -1
data/lib/spreader.rb
CHANGED
@@ -21,7 +21,7 @@ class Spreader
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def xml?(relative_path)
|
24
|
-
head = IO.popen('head -' + ((IO.popen("wc -l #{relative_path}").gets
|
24
|
+
head = IO.popen('head -' + ((IO.popen("wc -l #{relative_path}").gets).to_i + 1).to_s + " #{relative_path}")
|
25
25
|
while line = head.gets
|
26
26
|
@xml = true if (line.include? '<') && !@xml
|
27
27
|
end
|
@@ -62,7 +62,7 @@ class Spreader
|
|
62
62
|
load(transform(data, model_name, latitude_field_name, longitude_field_name))
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
65
|
+
def sow(relative_path, model_name, latitude_field_name, longitude_field_name)
|
66
66
|
spreader = Spreader.new
|
67
67
|
spreader.transformLoad(spreader.extract(relative_path){|data| XML::Reader.file("#{data}", :options => XML::Parser::Options::NOBLANKS | XML::Parser::Options::NOENT)}, model_name, latitude_field_name, longitude_field_name) if spreader.xml?(relative_path)
|
68
68
|
spreader.transformLoad(spreader.extract(relative_path){|data| File.open("#{data}")}, model_name, latitude_field_name, longitude_field_name) if !spreader.xml?(relative_path)
|