dm-postgis 1.0.0
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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +28 -0
- data/VERSION +1 -0
- data/lib/dm-postgis.rb +34 -0
- metadata +71 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Roman Kamyk jr
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "dm-postgis"
|
8
|
+
gem.summary = %Q{Geometry type for DataMapper}
|
9
|
+
gem.description = %Q{Adds DMGeometry type to DataMapper that uses GeoRuby for (de)serializing Geometry types into Postgis}
|
10
|
+
gem.email = "roman.kamyk@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/rkj/dm-postgis"
|
12
|
+
gem.authors = ["Roman Kamyk jr"]
|
13
|
+
gem.add_dependency 'GeoRuby', '>= 1.3.4'
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/rdoctask'
|
21
|
+
Rake::RDocTask.new do |rdoc|
|
22
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
23
|
+
|
24
|
+
rdoc.rdoc_dir = 'rdoc'
|
25
|
+
rdoc.title = "dm-postgis #{version}"
|
26
|
+
rdoc.rdoc_files.include('README*')
|
27
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
28
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/lib/dm-postgis.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'geo_ruby'
|
2
|
+
|
3
|
+
module DataMapper
|
4
|
+
module Types
|
5
|
+
class DMGeometry < DataMapper::Type
|
6
|
+
include GeoRuby::SimpleFeatures
|
7
|
+
|
8
|
+
primitive Geometry
|
9
|
+
default nil
|
10
|
+
lazy false
|
11
|
+
|
12
|
+
def self.dump(value, property)
|
13
|
+
value.nil? ? nil : value.as_hex_ewkb
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.load(value, property)
|
17
|
+
value.nil? ? nil : Geometry.from_hex_ewkb(value)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.typecast(value, property)
|
21
|
+
return value if value.nil? || value.kind_of?(Geometry)
|
22
|
+
return Geometry.from_hex_ewkb(value)
|
23
|
+
end
|
24
|
+
end # class Text
|
25
|
+
end # module Types
|
26
|
+
|
27
|
+
class Property
|
28
|
+
PRIMITIVES << DataMapper::Types::DMGeometry
|
29
|
+
def typecast_to_geometry(raw_value)
|
30
|
+
return nil if raw_value.nil? || raw_value.empty?
|
31
|
+
return GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(raw_value)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end # module DataMapper
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dm-postgis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman Kamyk jr
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-16 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: GeoRuby
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.3.4
|
24
|
+
version:
|
25
|
+
description: Adds DMGeometry type to DataMapper that uses GeoRuby for (de)serializing Geometry types into Postgis
|
26
|
+
email: roman.kamyk@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- lib/dm-postgis.rb
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://github.com/rkj/dm-postgis
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.5
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Geometry type for DataMapper
|
70
|
+
test_files: []
|
71
|
+
|