activerecord-spatialite-adapter 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +4 -0
- data/README.rdoc +3 -3
- data/Version +1 -1
- metadata +8 -11
- data/lib/active_record/connection_adapters/spatialite_adapter/databases.rake +0 -101
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -100,8 +100,8 @@ This adapter has the following requirements:
|
|
100
100
|
* SpatiaLite 2.3 or later (2.4 recommended).
|
101
101
|
* sqlite3 gem 1.3.3 or later.
|
102
102
|
* \ActiveRecord 3.0.3 or later. Earlier versions will not work.
|
103
|
-
* rgeo gem 0.2.
|
104
|
-
* rgeo-activerecord gem 0.3.
|
103
|
+
* rgeo gem 0.2.8 or later.
|
104
|
+
* rgeo-activerecord gem 0.3.3 or later.
|
105
105
|
|
106
106
|
Install this adapter as a gem:
|
107
107
|
|
@@ -204,7 +204,7 @@ Development of RGeo is sponsored by GeoPage, Inc. (http://www.geopage.com).
|
|
204
204
|
|
205
205
|
=== License
|
206
206
|
|
207
|
-
Copyright 2010 Daniel Azuma
|
207
|
+
Copyright 2010-2011 Daniel Azuma
|
208
208
|
|
209
209
|
All rights reserved.
|
210
210
|
|
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: activerecord-spatialite-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Azuma
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-04-11 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rgeo-activerecord
|
@@ -21,7 +20,7 @@ dependencies:
|
|
21
20
|
requirements:
|
22
21
|
- - ~>
|
23
22
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.3.
|
23
|
+
version: 0.3.3
|
25
24
|
type: :runtime
|
26
25
|
version_requirements: *id001
|
27
26
|
- !ruby/object:Gem::Dependency
|
@@ -54,13 +53,11 @@ files:
|
|
54
53
|
- lib/active_record/connection_adapters/spatialite_adapter/version.rb
|
55
54
|
- lib/active_record/connection_adapters/spatialite_adapter.rb
|
56
55
|
- lib/rgeo/active_record/spatialite_adapter/railtie.rb
|
57
|
-
- lib/active_record/connection_adapters/spatialite_adapter/databases.rake
|
58
|
-
- History.rdoc
|
59
|
-
- README.rdoc
|
60
56
|
- test/tc_basic.rb
|
61
57
|
- test/tc_spatial_queries.rb
|
58
|
+
- History.rdoc
|
59
|
+
- README.rdoc
|
62
60
|
- Version
|
63
|
-
has_rdoc: true
|
64
61
|
homepage: http://virtuoso.rubyforge.org/activerecord-spatialite-adapter
|
65
62
|
licenses: []
|
66
63
|
|
@@ -78,13 +75,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
76
|
none: false
|
80
77
|
requirements:
|
81
|
-
- - "
|
78
|
+
- - ">"
|
82
79
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
80
|
+
version: 1.3.1
|
84
81
|
requirements: []
|
85
82
|
|
86
83
|
rubyforge_project: virtuoso
|
87
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.7.2
|
88
85
|
signing_key:
|
89
86
|
specification_version: 3
|
90
87
|
summary: An ActiveRecord adapter for SpatiaLite, based on RGeo.
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Rakefile changes for SpatiaLite adapter
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
require 'rgeo/active_record/task_hacker'
|
38
|
-
|
39
|
-
|
40
|
-
class Object
|
41
|
-
alias_method :create_database_without_spatialite, :create_database
|
42
|
-
alias_method :drop_database_without_spatialite, :drop_database
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def create_database(config_)
|
47
|
-
if config_['adapter'] == 'spatialite'
|
48
|
-
if ::File.exist?(config_['database'])
|
49
|
-
$stderr.puts "#{config_['database']} already exists"
|
50
|
-
else
|
51
|
-
begin
|
52
|
-
# Create the SQLite database
|
53
|
-
::ActiveRecord::Base.establish_connection(config_)
|
54
|
-
conn_ = ::ActiveRecord::Base.connection
|
55
|
-
conn_.execute('SELECT InitSpatialMetaData()')
|
56
|
-
rescue ::Exception => e_
|
57
|
-
$stderr.puts e_, *(e_.backtrace)
|
58
|
-
$stderr.puts "Couldn't create database for #{config_.inspect}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
else
|
62
|
-
create_database_without_spatialite(config_)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def drop_database(config_)
|
68
|
-
if config_['adapter'] == 'spatialite'
|
69
|
-
require 'pathname'
|
70
|
-
path_ = ::Pathname.new(config_['database'])
|
71
|
-
file_ = path_.absolute? ? path_.to_s : ::File.join(::Rails.root, path_)
|
72
|
-
::FileUtils.rm(file_)
|
73
|
-
else
|
74
|
-
drop_database_without_spatialite(config_)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
::RGeo::ActiveRecord::TaskHacker.modify('db:charset', nil, 'spatialite') do |config_|
|
80
|
-
::ActiveRecord::Base.establish_connection(config_)
|
81
|
-
puts(::ActiveRecord::Base.connection.encoding)
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
::RGeo::ActiveRecord::TaskHacker.modify('db:structure:dump', nil, 'spatialite') do |config_|
|
86
|
-
dbfile_ = config_["database"] || config_["dbfile"]
|
87
|
-
`sqlite3 #{dbfile_} .schema > db/#{::Rails.env}_structure.sql`
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
::RGeo::ActiveRecord::TaskHacker.modify('db:test:clone_structure', 'test', 'spatialite') do |config_|
|
92
|
-
dbfile_ = config_["database"] || config_["dbfile"]
|
93
|
-
`sqlite3 #{dbfile_} < #{::Rails.root}/db/#{::Rails.env}_structure.sql`
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
::RGeo::ActiveRecord::TaskHacker.modify('db:test:purge', 'test', 'spatialite') do |config_|
|
98
|
-
dbfile_ = config_["database"] || config_["dbfile"]
|
99
|
-
::File.delete(dbfile_) if ::File.exist?(dbfile_)
|
100
|
-
create_database(config_)
|
101
|
-
end
|