shp2geocouch 0.0.7 → 0.0.8

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 CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
data/bin/shp2geocouch CHANGED
@@ -12,6 +12,7 @@ class ShapefileToGeoCouch
12
12
  def initialize(options)
13
13
  set_accessors(options)
14
14
  @uri = parse_database_url
15
+ @name = @uri.path[1..-1]
15
16
  @db = CouchRest.database! @database_url
16
17
  @geocouch_utils = "http://max.iriscouch.com/apps"
17
18
  verify_dependencies
@@ -36,10 +37,12 @@ class ShapefileToGeoCouch
36
37
  def parse_database_url
37
38
  URI.parse(@database_url)
38
39
  end
39
-
40
+
40
41
  def couch_url
41
42
  port = @uri.port && @uri.port != 80 ? ":#{@uri.port}" : ""
42
- "#{@uri.scheme}://#{@uri.host}#{port}"
43
+ user = @uri.user ? "#{@uri.user}:" : ""
44
+ password = @uri.password ? "#{@uri.password}@" : ""
45
+ "#{@uri.scheme}://#{user}#{password}#{@uri.host}#{port}"
43
46
  end
44
47
 
45
48
  def output_folder
@@ -114,7 +117,7 @@ class ShapefileToGeoCouch
114
117
  if !view_exists?
115
118
  puts "Replicating geocouch-utils + map browser from #{@geocouch_utils}..."
116
119
  HTTParty.post(couch_url + '/_replicate',
117
- :body => '{"source":"' + @geocouch_utils + '","target":"' + @name + '", "doc_ids":["_design/geo"]}',
120
+ :body => '{"source":"' + @geocouch_utils + '","target":"' + couch_url + "/" + @name + '", "doc_ids":["_design/geo"]}',
118
121
  :headers => {'content-type' => "application/json"}
119
122
  ) rescue timeout = true
120
123
  if timeout
@@ -161,7 +164,7 @@ raise "You must specify a .shp or a .zip" unless extension =~ /zip|shp/i
161
164
 
162
165
  name = ARGV[0].split('/')[-1].split('.')[0]
163
166
 
164
- options = {:path => ARGV[0], :name => name.downcase, :extension => extension}.merge(defaults)
167
+ options = {:path => ARGV[0], :extension => extension}.merge(defaults)
165
168
  options[:database_url] = ARGV[1] || "http://localhost:5984/#{name.downcase}"
166
169
 
167
170
  ShapefileToGeoCouch.new(options)
Binary file
data/shp2geocouch.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shp2geocouch}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Max Ogden"]
12
- s.date = %q{2011-04-21}
12
+ s.date = %q{2011-04-23}
13
13
  s.default_executable = %q{shp2geocouch}
14
14
  s.description = %q{rubygem that converts Shapefiles into GeoCouch databases}
15
15
  s.email = %q{max@maxogden.com}
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "bin/shp2geocouch",
27
- "pkg/shp2geocouch-0.0.7.gem",
27
+ "pkg/shp2geocouch-0.0.8.gem",
28
28
  "shp2geocouch.gemspec"
29
29
  ]
30
30
  s.homepage = %q{http://github.com/maxogden/shp2geocouch}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shp2geocouch
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Max Ogden
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-21 00:00:00 -07:00
18
+ date: 2011-04-23 00:00:00 -07:00
19
19
  default_executable: shp2geocouch
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,7 @@ files:
61
61
  - Rakefile
62
62
  - VERSION
63
63
  - bin/shp2geocouch
64
- - pkg/shp2geocouch-0.0.7.gem
64
+ - pkg/shp2geocouch-0.0.8.gem
65
65
  - shp2geocouch.gemspec
66
66
  has_rdoc: true
67
67
  homepage: http://github.com/maxogden/shp2geocouch
Binary file