hdo-storting-importer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,7 @@ module Hdo
39
39
 
40
40
  def read_type(plural, klass)
41
41
  objs = @files.map do |e|
42
- doc = Nokogiri::XML.parse(File.read(e))
42
+ doc = Nokogiri::XML.parse(open(e).read)
43
43
  doc.remove_namespaces!
44
44
 
45
45
  klass.from_storting_doc(doc)
@@ -104,7 +104,12 @@ module Hdo
104
104
  csvs = @files.any? ? @files : Dir[File.join(StortingImporter.root, 'data/promises-*.csv')].sort_by { |e| File.basename(e) }
105
105
  content = ''
106
106
  csvs.each do |csv|
107
- content << File.read(File.expand_path(csv), encoding: "ISO-8859-1").encode("UTF-8")
107
+ if csv =~ /^http/
108
+ content << open(csv).read
109
+ else
110
+ # local csv files are ISO-8859-1 for some reason.
111
+ content << File.read(File.expand_path(csv), encoding: "ISO-8859-1").encode("UTF-8")
112
+ end
108
113
  end
109
114
 
110
115
  Util.builder do |xml|
@@ -1,5 +1,5 @@
1
1
  module Hdo
2
2
  module StortingImporter
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hdo-storting-importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: