cartodb-importer 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = "cartodb-importer"
7
7
  s.version = CartoDB::Importer::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Fernando Blat"]
10
- s.email = ["ferblape@gmail.com"]
9
+ s.authors = ["Fernando Blat", "Andrew Hill", "Javier de la Torre"]
10
+ s.email = ["andrew@vizzuality.com"]
11
11
  s.homepage = ""
12
12
  s.summary = %q{Import CSV, SHP, and other files with data into a PostgreSQL table}
13
13
  s.description = %q{Import CSV, SHP, and other files with data into a PostgreSQL table}
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_runtime_dependency "pg", "0.11"
22
+ s.add_runtime_dependency "pg", '~> 0.11'
23
23
  s.add_runtime_dependency "sequel"
24
24
  s.add_runtime_dependency "roo"
25
25
  s.add_runtime_dependency "spreadsheet"
@@ -150,7 +150,7 @@ module CartoDB
150
150
  random_table_name = "importing_#{Time.now.to_i}_#{@suggested_name}"
151
151
 
152
152
  normalizer_command = "#{python_bin_path} -Wignore #{File.expand_path("../../../misc/shp_normalizer.py", __FILE__)} #{path} #{random_table_name}"
153
- shp_args_command = `#{normalizer_command}`
153
+ shp_args_command = `#{normalizer_command}`
154
154
  if shp_args_command.strip.blank?
155
155
  raise "Error running python shp_normalizer script: #{normalizer_command}"
156
156
  end
@@ -159,7 +159,7 @@ module CartoDB
159
159
  %x[#{full_shp_command}]
160
160
 
161
161
  @db_connection.run("CREATE TABLE #{@suggested_name} AS SELECT * FROM #{random_table_name}")
162
- @db_connection.run("DROP TABLE #{random_table_name}")
162
+ #@db_connection.run("DROP TABLE #{random_table_name}")
163
163
  @table_created = true
164
164
 
165
165
  entries.each{ |e| FileUtils.rm_rf(e) } if entries.any?
@@ -1,6 +1,6 @@
1
1
  module CartoDB
2
2
  class Importer
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
6
6
 
@@ -15,9 +15,7 @@ name = sys.argv[2]
15
15
  dbf_file = shp_file[0:-4] + '.dbf'
16
16
  prj_file = shp_file[0:-4] + '.prj'
17
17
 
18
-
19
- #Try detecting the SRID, by default we set to 4326 and hope the best
20
- #srid=4326
18
+ #Try detecting the SRID
21
19
  if os.path.isfile(prj_file):
22
20
  prj_filef = open(prj_file, 'r')
23
21
  prj_txt = prj_filef.read()
data/spec/import_spec.rb CHANGED
@@ -249,4 +249,24 @@ describe CartoDB::Importer do
249
249
  result.import_type.should == '.tif'
250
250
  end
251
251
  end
252
+ describe "Extended" do
253
+ it "should import 1 SHP file" do
254
+ importer = CartoDB::Importer.new :import_from_file => File.expand_path("../../../vm-cartodb/extended_tests/cua2005index_sp.zip", __FILE__),
255
+ :database => "cartodb_importer_test", :username => 'postgres', :password => '',
256
+ :host => 'localhost', :port => 5432
257
+ result = importer.import!
258
+ result.name.should == 'cua2005index_sp_shp'
259
+ result.rows_imported.should == 4365
260
+ result.import_type.should == '.shp'
261
+ end
262
+ it "should import 2 SHP file" do
263
+ importer = CartoDB::Importer.new :import_from_file => File.expand_path("../../../vm-cartodb/extended_tests/cua2005index_utm.zip", __FILE__),
264
+ :database => "cartodb_importer_test", :username => 'postgres', :password => '',
265
+ :host => 'localhost', :port => 5432
266
+ result = importer.import!
267
+ result.name.should == 'cua2005index_utm_shp'
268
+ result.rows_imported.should == 4528
269
+ result.import_type.should == '.shp'
270
+ end
271
+ end
252
272
  end
metadata CHANGED
@@ -1,31 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartodb-importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Fernando Blat
9
+ - Andrew Hill
10
+ - Javier de la Torre
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2011-09-12 00:00:00.000000000 -06:00
13
- default_executable:
14
+ date: 2011-09-12 00:00:00.000000000Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: pg
17
- requirement: &70149885580060 !ruby/object:Gem::Requirement
18
+ requirement: &70326945028900 !ruby/object:Gem::Requirement
18
19
  none: false
19
20
  requirements:
20
- - - =
21
+ - - ~>
21
22
  - !ruby/object:Gem::Version
22
23
  version: '0.11'
23
24
  type: :runtime
24
25
  prerelease: false
25
- version_requirements: *70149885580060
26
+ version_requirements: *70326945028900
26
27
  - !ruby/object:Gem::Dependency
27
28
  name: sequel
28
- requirement: &70149885579640 !ruby/object:Gem::Requirement
29
+ requirement: &70326945028480 !ruby/object:Gem::Requirement
29
30
  none: false
30
31
  requirements:
31
32
  - - ! '>='
@@ -33,10 +34,10 @@ dependencies:
33
34
  version: '0'
34
35
  type: :runtime
35
36
  prerelease: false
36
- version_requirements: *70149885579640
37
+ version_requirements: *70326945028480
37
38
  - !ruby/object:Gem::Dependency
38
39
  name: roo
39
- requirement: &70149885579160 !ruby/object:Gem::Requirement
40
+ requirement: &70326945028020 !ruby/object:Gem::Requirement
40
41
  none: false
41
42
  requirements:
42
43
  - - ! '>='
@@ -44,10 +45,10 @@ dependencies:
44
45
  version: '0'
45
46
  type: :runtime
46
47
  prerelease: false
47
- version_requirements: *70149885579160
48
+ version_requirements: *70326945028020
48
49
  - !ruby/object:Gem::Dependency
49
50
  name: spreadsheet
50
- requirement: &70149885578740 !ruby/object:Gem::Requirement
51
+ requirement: &70326945027600 !ruby/object:Gem::Requirement
51
52
  none: false
52
53
  requirements:
53
54
  - - ! '>='
@@ -55,10 +56,10 @@ dependencies:
55
56
  version: '0'
56
57
  type: :runtime
57
58
  prerelease: false
58
- version_requirements: *70149885578740
59
+ version_requirements: *70326945027600
59
60
  - !ruby/object:Gem::Dependency
60
61
  name: google-spreadsheet-ruby
61
- requirement: &70149885578300 !ruby/object:Gem::Requirement
62
+ requirement: &70326945027180 !ruby/object:Gem::Requirement
62
63
  none: false
63
64
  requirements:
64
65
  - - ! '>='
@@ -66,10 +67,10 @@ dependencies:
66
67
  version: '0'
67
68
  type: :runtime
68
69
  prerelease: false
69
- version_requirements: *70149885578300
70
+ version_requirements: *70326945027180
70
71
  - !ruby/object:Gem::Dependency
71
72
  name: rubyzip
72
- requirement: &70149885577880 !ruby/object:Gem::Requirement
73
+ requirement: &70326945026760 !ruby/object:Gem::Requirement
73
74
  none: false
74
75
  requirements:
75
76
  - - ! '>='
@@ -77,10 +78,10 @@ dependencies:
77
78
  version: '0'
78
79
  type: :runtime
79
80
  prerelease: false
80
- version_requirements: *70149885577880
81
+ version_requirements: *70326945026760
81
82
  - !ruby/object:Gem::Dependency
82
83
  name: builder
83
- requirement: &70149885577460 !ruby/object:Gem::Requirement
84
+ requirement: &70326945026340 !ruby/object:Gem::Requirement
84
85
  none: false
85
86
  requirements:
86
87
  - - ! '>='
@@ -88,10 +89,10 @@ dependencies:
88
89
  version: '0'
89
90
  type: :runtime
90
91
  prerelease: false
91
- version_requirements: *70149885577460
92
+ version_requirements: *70326945026340
92
93
  - !ruby/object:Gem::Dependency
93
94
  name: rspec
94
- requirement: &70149885577020 !ruby/object:Gem::Requirement
95
+ requirement: &70326945025920 !ruby/object:Gem::Requirement
95
96
  none: false
96
97
  requirements:
97
98
  - - ! '>='
@@ -99,10 +100,10 @@ dependencies:
99
100
  version: '0'
100
101
  type: :development
101
102
  prerelease: false
102
- version_requirements: *70149885577020
103
+ version_requirements: *70326945025920
103
104
  - !ruby/object:Gem::Dependency
104
105
  name: mocha
105
- requirement: &70149885576580 !ruby/object:Gem::Requirement
106
+ requirement: &70326945025500 !ruby/object:Gem::Requirement
106
107
  none: false
107
108
  requirements:
108
109
  - - ! '>='
@@ -110,10 +111,10 @@ dependencies:
110
111
  version: '0'
111
112
  type: :development
112
113
  prerelease: false
113
- version_requirements: *70149885576580
114
+ version_requirements: *70326945025500
114
115
  - !ruby/object:Gem::Dependency
115
116
  name: ruby-debug19
116
- requirement: &70149885576160 !ruby/object:Gem::Requirement
117
+ requirement: &70326945025080 !ruby/object:Gem::Requirement
117
118
  none: false
118
119
  requirements:
119
120
  - - ! '>='
@@ -121,10 +122,10 @@ dependencies:
121
122
  version: '0'
122
123
  type: :development
123
124
  prerelease: false
124
- version_requirements: *70149885576160
125
+ version_requirements: *70326945025080
125
126
  description: Import CSV, SHP, and other files with data into a PostgreSQL table
126
127
  email:
127
- - ferblape@gmail.com
128
+ - andrew@vizzuality.com
128
129
  executables: []
129
130
  extensions: []
130
131
  extra_rdoc_files: []
@@ -153,7 +154,6 @@ files:
153
154
  - spec/export_spec.rb
154
155
  - spec/import_spec.rb
155
156
  - spec/spec_helper.rb
156
- has_rdoc: true
157
157
  homepage: ''
158
158
  licenses: []
159
159
  post_install_message:
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project: cartodb-importer
177
- rubygems_version: 1.6.2
177
+ rubygems_version: 1.8.10
178
178
  signing_key:
179
179
  specification_version: 3
180
180
  summary: Import CSV, SHP, and other files with data into a PostgreSQL table