datacatalog-importer 0.1.3 → 0.1.4
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.
- data/VERSION +1 -1
- data/datacatalog-importer.gemspec +2 -2
- data/lib/utility.rb +5 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{datacatalog-importer}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David James"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-03}
|
13
13
|
s.description = %q{This framework makes it easier to write importers for the National Data Catalog.}
|
14
14
|
s.email = %q{djames@sunlightfoundation.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/utility.rb
CHANGED
@@ -28,7 +28,7 @@ module DataCatalog
|
|
28
28
|
|
29
29
|
def self.headers
|
30
30
|
{
|
31
|
-
"UserAgent" => "National Data Catalog Importer/0.1.
|
31
|
+
"UserAgent" => "National Data Catalog Importer/0.1.4",
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -47,11 +47,10 @@ module DataCatalog
|
|
47
47
|
|
48
48
|
def self.parse_csv_from_file_or_uri(uri, file, options={})
|
49
49
|
if options[:force_fetch] || !File.exist?(file)
|
50
|
-
document =
|
50
|
+
document = fetch(uri)
|
51
51
|
File.open(file, "w") { |f| f.write(document) }
|
52
52
|
end
|
53
53
|
parse_csv_from_file(file, options[:extra_header_rows] || 0)
|
54
|
-
# Why always parse the file? Consistency with parse_html_from_file_or_uri.
|
55
54
|
end
|
56
55
|
|
57
56
|
def self.parse_html_from_file_or_uri(uri, file, options={})
|
@@ -64,9 +63,9 @@ module DataCatalog
|
|
64
63
|
|
65
64
|
def self.parse_csv_from_uri(uri)
|
66
65
|
puts "Fetching #{uri}..."
|
67
|
-
open(uri, headers)
|
68
|
-
|
69
|
-
|
66
|
+
data = open(uri, headers)
|
67
|
+
puts data.inspect
|
68
|
+
FasterCSV.parse(data)
|
70
69
|
end
|
71
70
|
|
72
71
|
def self.parse_html_from_uri(uri)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datacatalog-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David James
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-03 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|