rgeo-activerecord 0.4.6 → 0.5.0.beta1
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/History.rdoc +5 -0
- data/README.rdoc +4 -12
- data/Version +1 -1
- data/lib/rgeo/active_record/adapter_test_helper.rb +22 -11
- data/lib/rgeo/active_record/common_adapter_elements.rb +12 -1
- metadata +36 -4
data/History.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 0.5.0.beta1 / 2013-02-04
|
2
|
+
|
3
|
+
* Updates for compatibility with Rails 4 and support of Rails 4 oriented adapters.
|
4
|
+
* Testing tool is better factored to allow customization of cleanup
|
5
|
+
|
1
6
|
=== 0.4.6 / 2012-12-11
|
2
7
|
|
3
8
|
* You can now provide both a default and an override database config file in the test helper.
|
data/README.rdoc
CHANGED
@@ -27,6 +27,9 @@ RGeo::ActiveRecord has the following requirements:
|
|
27
27
|
Should be compatible with Rails versions through 3.2.x.
|
28
28
|
* arel 2.0.6 or later. Earlier versions will not work.
|
29
29
|
|
30
|
+
This version of rgeo-activerecord also includes experimental support for
|
31
|
+
the (unreleased as of this writing) version 4.0 of Rails.
|
32
|
+
|
30
33
|
Generally, \ActiveRecord adapters which depend on this module should be
|
31
34
|
installed as gems, and they will install this module automatically as
|
32
35
|
a dependency. However, you can also install it manually as a gem:
|
@@ -37,17 +40,6 @@ a dependency. However, you can also install it manually as a gem:
|
|
37
40
|
See the README for the "rgeo" gem, a required dependency, for further
|
38
41
|
installation information.
|
39
42
|
|
40
|
-
=== To-do list
|
41
|
-
|
42
|
-
We consider this gem to be in a late alpha state. There are a still a
|
43
|
-
few holes in the intended functionality, but it is now being tested in a
|
44
|
-
variety of contexts, and we know of several successful production
|
45
|
-
deployments.
|
46
|
-
|
47
|
-
We are also currently working on a mechanism for constructing complex
|
48
|
-
spatial queries via extensions to Arel. This work is in the experimental
|
49
|
-
stage.
|
50
|
-
|
51
43
|
=== Development and support
|
52
44
|
|
53
45
|
Documentation is available at http://dazuma.github.com/rgeo-activerecord/rdoc
|
@@ -70,7 +62,7 @@ Development is supported by Pirq. (http://pirq.com).
|
|
70
62
|
|
71
63
|
=== License
|
72
64
|
|
73
|
-
Copyright 2010-
|
65
|
+
Copyright 2010-2013 Daniel Azuma
|
74
66
|
|
75
67
|
All rights reserved.
|
76
68
|
|
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0.beta1
|
@@ -67,7 +67,7 @@ module RGeo
|
|
67
67
|
database_config_ = ::YAML.load_file(klass_.const_get(:OVERRIDE_DATABASE_CONFIG_PATH)) rescue nil
|
68
68
|
database_config_ ||= ::YAML.load_file(klass_.const_get(:DATABASE_CONFIG_PATH)) rescue nil
|
69
69
|
if database_config_
|
70
|
-
database_config_.
|
70
|
+
database_config_.stringify_keys!
|
71
71
|
if klass_.respond_to?(:before_open_database)
|
72
72
|
klass_.before_open_database(:config => database_config_)
|
73
73
|
end
|
@@ -112,6 +112,7 @@ module RGeo
|
|
112
112
|
@factory = ::RGeo::Cartesian.preferred_factory(:srid => 3785)
|
113
113
|
@geographic_factory = ::RGeo::Geographic.spherical_factory(:srid => 4326)
|
114
114
|
cleanup_tables
|
115
|
+
cleanup_caches
|
115
116
|
end
|
116
117
|
|
117
118
|
|
@@ -119,6 +120,7 @@ module RGeo
|
|
119
120
|
|
120
121
|
def teardown
|
121
122
|
cleanup_tables
|
123
|
+
cleanup_caches
|
122
124
|
end
|
123
125
|
|
124
126
|
|
@@ -132,21 +134,30 @@ module RGeo
|
|
132
134
|
if klass_.connection.tables.include?('spatial_test')
|
133
135
|
klass_.connection.drop_table(:spatial_test)
|
134
136
|
end
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
# Utility method that cleans up any schema info that was cached by
|
141
|
+
# ActiveRecord during a test. Normally called automatically at setup
|
142
|
+
# and teardown. If you override those methods, you'll need to call
|
143
|
+
# this from your method.
|
144
|
+
|
145
|
+
def cleanup_caches
|
146
|
+
klass_ = self.class.const_get(:DEFAULT_AR_CLASS)
|
135
147
|
# Clear any RGeo factory settings.
|
136
148
|
klass_.connection_pool.rgeo_factory_settings.clear!
|
137
149
|
# Clear out any ActiveRecord caches that are present.
|
138
|
-
# Different
|
139
|
-
|
140
|
-
if
|
141
|
-
# 3.2.x
|
142
|
-
|
143
|
-
c_.schema_cache.clear!
|
144
|
-
end
|
145
|
-
else
|
146
|
-
# 3.1.x
|
147
|
-
klass_.connection_pool.clear_cache!
|
150
|
+
# Different Rails versions use different types of caches.
|
151
|
+
klass_.connection_pool.with_connection do |c_|
|
152
|
+
if c_.respond_to?(:schema_cache)
|
153
|
+
# 3.2.x and 4.0.x
|
154
|
+
c_.schema_cache.clear!
|
148
155
|
end
|
149
156
|
end
|
157
|
+
if klass_.connection_pool.respond_to?(:clear_cache!)
|
158
|
+
# 3.1.x
|
159
|
+
klass_.connection_pool.clear_cache!
|
160
|
+
end
|
150
161
|
if klass_.connection.respond_to?(:clear_cache!)
|
151
162
|
# 3.1 and above
|
152
163
|
klass_.connection.clear_cache!
|
@@ -65,7 +65,8 @@ module RGeo
|
|
65
65
|
|
66
66
|
# Index definition struct with a spatial flag field.
|
67
67
|
|
68
|
-
class SpatialIndexDefinition < ::
|
68
|
+
class SpatialIndexDefinition < ::ActiveRecord::ConnectionAdapters::IndexDefinition
|
69
|
+
attr_accessor :spatial
|
69
70
|
end
|
70
71
|
|
71
72
|
|
@@ -92,7 +93,9 @@ module RGeo
|
|
92
93
|
# Provide methods for each geometric subtype during table definitions.
|
93
94
|
|
94
95
|
::ActiveRecord::ConnectionAdapters::TableDefinition.class_eval do
|
96
|
+
|
95
97
|
alias_method :method_missing_without_rgeo_modification, :method_missing
|
98
|
+
|
96
99
|
def method_missing(method_name_, *args_, &block_)
|
97
100
|
if @base.respond_to?(:spatial_column_constructor) && (info_ = @base.spatial_column_constructor(method_name_))
|
98
101
|
info_ = info_.dup
|
@@ -105,13 +108,16 @@ module RGeo
|
|
105
108
|
method_missing_without_rgeo_modification(method_name_, *args_, &block_)
|
106
109
|
end
|
107
110
|
end
|
111
|
+
|
108
112
|
end
|
109
113
|
|
110
114
|
|
111
115
|
# Provide methods for each geometric subtype during table changes.
|
112
116
|
|
113
117
|
::ActiveRecord::ConnectionAdapters::Table.class_eval do
|
118
|
+
|
114
119
|
alias_method :method_missing_without_rgeo_modification, :method_missing
|
120
|
+
|
115
121
|
def method_missing(method_name_, *args_, &block_)
|
116
122
|
if @base.respond_to?(:spatial_column_constructor) && (info_ = @base.spatial_column_constructor(method_name_))
|
117
123
|
info_ = info_.dup
|
@@ -124,14 +130,18 @@ module RGeo
|
|
124
130
|
method_missing_without_rgeo_modification(method_name_, *args_, &block_)
|
125
131
|
end
|
126
132
|
end
|
133
|
+
|
127
134
|
end
|
128
135
|
|
129
136
|
|
130
137
|
# Hack schema dumper to output spatial index flag
|
131
138
|
|
132
139
|
::ActiveRecord::SchemaDumper.class_eval do
|
140
|
+
|
133
141
|
private
|
142
|
+
|
134
143
|
alias_method :_old_indexes_method, :indexes
|
144
|
+
|
135
145
|
def indexes(table_, stream_)
|
136
146
|
if (indexes_ = @connection.indexes(table_)).any?
|
137
147
|
add_index_statements_ = indexes_.map do |index_|
|
@@ -150,6 +160,7 @@ module RGeo
|
|
150
160
|
stream_.puts
|
151
161
|
end
|
152
162
|
end
|
163
|
+
|
153
164
|
end
|
154
165
|
|
155
166
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0.beta1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Azuma
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rgeo
|
@@ -59,6 +59,38 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.0.6
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rdoc
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
62
94
|
description: RGeo is a geospatial data library for Ruby. RGeo::ActiveRecord is an
|
63
95
|
optional RGeo module providing some spatial extensions to ActiveRecord, as well
|
64
96
|
as common tools used by RGeo-based spatial adapters.
|
@@ -103,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
135
|
version: 1.3.1
|
104
136
|
requirements: []
|
105
137
|
rubyforge_project: virtuoso
|
106
|
-
rubygems_version: 1.8.
|
138
|
+
rubygems_version: 1.8.25
|
107
139
|
signing_key:
|
108
140
|
specification_version: 3
|
109
141
|
summary: An RGeo module providing spatial extensions to ActiveRecord.
|