activerecord-postgis-adapter 0.6.3 → 0.6.4

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 CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.6.4 / 2013-05-28
2
+
3
+ * Fixed a crash with array conversions in Rails 4. (Contributed by Christopher Bull)
4
+ * The gis setup task was broken in any Rails other than 3.2.x. Fixed (I think). (Reports by Rupert de Guzman and slbug)
5
+ * Raise a more useful exception for the (as yet) unsupported combination of Rails 4 and JRuby.
6
+
1
7
  === 0.6.3 / 2013-05-04
2
8
 
3
9
  * Several fixes for compatibility with changes to Rails 4.0.0 rc1. (Reports by slbug and Victor Costan)
data/README.rdoc CHANGED
@@ -26,7 +26,7 @@ The adapter has the following requirements.
26
26
  * \ActiveRecord 3.0.3 or later. Earlier versions will not work. Rails 4.0 is supported on an experimental basis.
27
27
  * The rgeo and rgeo-activerecord gems are also required.
28
28
 
29
- As of this writing, the JDBC Postgres driver is not yet compatible with Rails 4, so the combination of JRuby/JDBC/Rails 4 is not yet supported. Similarly, Rubinius receives limited testing and support.
29
+ As of this writing, the design of the JDBC Postgres driver for Rails 4 still appears to be in flux. Accordingly, I'm holding off on supporting Rails 4 on JRuby for now. Similarly, Rubinius receives limited testing and support.
30
30
 
31
31
  === Installation and Configuration
32
32
 
data/Version CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -74,6 +74,12 @@ when 3
74
74
  require 'active_record/connection_adapters/postgis_adapter/shared/setup.rb'
75
75
  require 'active_record/connection_adapters/postgis_adapter/rails3/create_connection'
76
76
  when 4
77
+
78
+ # TEMP
79
+ if defined?(::RUBY_ENGINE) && ::RUBY_ENGINE == 'jruby'
80
+ raise "**** Sorry, activerecord-postgis-adapter does not yet support Rails 4 on JRuby ****"
81
+ end
82
+
77
83
  require 'active_record/connection_adapters/postgis_adapter/shared/version.rb'
78
84
  require 'active_record/connection_adapters/postgis_adapter/shared/common_adapter_methods.rb'
79
85
  require 'active_record/connection_adapters/postgis_adapter/rails4/main_adapter.rb'
@@ -50,7 +50,14 @@ namespace :db do
50
50
  namespace :gis do
51
51
  desc "Setup PostGIS data in the database"
52
52
  task :setup => [:load_config, :rails_env] do
53
- configs_for_environment.each { |config| setup_gis(config) }
53
+ if self.respond_to?(:configs_for_environment)
54
+ configs_ = configs_for_environment
55
+ else
56
+ environments_ = [::Rails.env]
57
+ environments_ << 'test' if ::Rails.env.development?
58
+ configs_ ::ActiveRecord::Base.configurations.values_at(*environments_).compact.reject{ |config_| config_['database'].blank? }
59
+ end
60
+ configs_.each { |config_| setup_gis(config_) }
54
61
  end
55
62
  end
56
63
  end
@@ -63,6 +63,15 @@ module ActiveRecord # :nodoc:
63
63
  end
64
64
 
65
65
 
66
+ def type_cast(value_, column_)
67
+ if ::RGeo::Feature::Geometry.check_type(value_)
68
+ ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb, :emit_ewkb_srid => true).generate(value_)
69
+ else
70
+ super
71
+ end
72
+ end
73
+
74
+
66
75
  def columns(table_name_, name_=nil)
67
76
  # FULL REPLACEMENT. RE-CHECK ON NEW VERSIONS.
68
77
  # We needed to return a spatial column subclass.
@@ -40,8 +40,11 @@
40
40
  namespace :db do
41
41
  namespace :gis do
42
42
  desc "Setup PostGIS data in the database"
43
- task :setup => [:load_config, :rails_env] do
44
- configs_for_environment.each do |config_|
43
+ task :setup => [:load_config] do
44
+ environments_ = [::Rails.env]
45
+ environments_ << 'test' if ::Rails.env.development?
46
+ configs_ ::ActiveRecord::Base.configurations.values_at(*environments_).compact.reject{ |config_| config_['database'].blank? }
47
+ configs_.each do |config_|
45
48
  ::ActiveRecord::ConnectionAdapters::PostGISAdapter::PostGISDatabaseTasks.new(config_).setup_gis
46
49
  end
47
50
  end
@@ -64,6 +64,15 @@ module ActiveRecord # :nodoc:
64
64
  end
65
65
 
66
66
 
67
+ def type_cast(value_, column_, array_member_=false)
68
+ if ::RGeo::Feature::Geometry.check_type(value_)
69
+ ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb, :emit_ewkb_srid => true).generate(value_)
70
+ else
71
+ super
72
+ end
73
+ end
74
+
75
+
67
76
  def columns(table_name_, name_=nil)
68
77
  # FULL REPLACEMENT. RE-CHECK ON NEW VERSIONS.
69
78
  # We needed to return a spatial column subclass.
@@ -103,15 +103,6 @@ module ActiveRecord # :nodoc:
103
103
  end
104
104
 
105
105
 
106
- def type_cast(value_, column_)
107
- if ::RGeo::Feature::Geometry.check_type(value_)
108
- ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb, :emit_ewkb_srid => true).generate(value_)
109
- else
110
- super
111
- end
112
- end
113
-
114
-
115
106
  end
116
107
 
117
108
 
data/test/tc_basic.rb CHANGED
@@ -110,7 +110,7 @@ module RGeo
110
110
  obj_.save!
111
111
  id_ = obj_.id
112
112
  obj2_ = klass_.find(id_)
113
- assert_equal(@factory.point(1, 2), obj2_.latlon)
113
+ assert_equal(@factory.point(1.0, 2.0), obj2_.latlon)
114
114
  assert_equal(3785, obj2_.latlon.srid)
115
115
  assert_equal(true, ::RGeo::Geos.is_geos?(obj2_.latlon))
116
116
  end
@@ -123,7 +123,7 @@ module RGeo
123
123
  obj_.save!
124
124
  id_ = obj_.id
125
125
  obj2_ = klass_.find(id_)
126
- assert_equal(@geographic_factory.point(1, 2), obj2_.latlon)
126
+ assert_equal(@geographic_factory.point(1.0, 2.0), obj2_.latlon)
127
127
  assert_equal(4326, obj2_.latlon.srid)
128
128
  assert_equal(false, ::RGeo::Geos.is_geos?(obj2_.latlon))
129
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgis-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-04 00:00:00.000000000 Z
12
+ date: 2013-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rgeo-activerecord