rgeo-activerecord 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Version of rgeo-activerecord
4
- #
4
+ #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010 Daniel Azuma
7
- #
6
+ # Copyright 2010-2012 Daniel Azuma
7
+ #
8
8
  # All rights reserved.
9
- #
9
+ #
10
10
  # Redistribution and use in source and binary forms, with or without
11
11
  # modification, are permitted provided that the following conditions are met:
12
- #
12
+ #
13
13
  # * Redistributions of source code must retain the above copyright notice,
14
14
  # this list of conditions and the following disclaimer.
15
15
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
18
18
  # * Neither the name of the copyright holder, nor the names of any other
19
19
  # contributors to this software, may be used to endorse or promote products
20
20
  # derived from this software without specific prior written permission.
21
- #
21
+ #
22
22
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
23
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
24
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,16 +41,16 @@ end
41
41
 
42
42
 
43
43
  module RGeo
44
-
44
+
45
45
  module ActiveRecord
46
-
46
+
47
47
  # Current version of RGeo::ActiveRecord as a frozen string
48
48
  VERSION_STRING = ::File.read(::File.dirname(__FILE__)+'/../../../Version').strip.freeze
49
-
49
+
50
50
  # Current version of RGeo::ActiveRecord as a Versionomy object, if the
51
51
  # Versionomy gem is available; otherwise equal to VERSION_STRING.
52
52
  VERSION = defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING) : VERSION_STRING
53
-
53
+
54
54
  end
55
-
55
+
56
56
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Tests for basic ActiveRecord extensions
4
- #
4
+ #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010 Daniel Azuma
7
- #
6
+ # Copyright 2010-2012 Daniel Azuma
7
+ #
8
8
  # All rights reserved.
9
- #
9
+ #
10
10
  # Redistribution and use in source and binary forms, with or without
11
11
  # modification, are permitted provided that the following conditions are met:
12
- #
12
+ #
13
13
  # * Redistributions of source code must retain the above copyright notice,
14
14
  # this list of conditions and the following disclaimer.
15
15
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
18
18
  # * Neither the name of the copyright holder, nor the names of any other
19
19
  # contributors to this software, may be used to endorse or promote products
20
20
  # derived from this software without specific prior written permission.
21
- #
21
+ #
22
22
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
23
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
24
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,66 +41,70 @@ require 'rgeo/active_record'
41
41
  module RGeo
42
42
  module ActiveRecord
43
43
  module Tests # :nodoc:
44
-
44
+
45
45
  class TestBasic < ::Test::Unit::TestCase # :nodoc:
46
-
47
-
46
+
47
+
48
+ class MyTable < ::ActiveRecord::Base
49
+ end
50
+
51
+
48
52
  def test_has_version
49
53
  assert_not_nil(::RGeo::ActiveRecord::VERSION)
50
54
  end
51
-
52
-
55
+
56
+
53
57
  def test_default_factory_generator
54
- ::ActiveRecord::Base.rgeo_factory_generator = nil
55
- factory_ = ::ActiveRecord::Base.rgeo_factory_for_column(:hello).call(:has_z_coordinate => true, :srid => 4326)
58
+ MyTable.rgeo_factory_generator = nil
59
+ factory_ = MyTable.rgeo_factory_for_column(:hello).call(:has_z_coordinate => true, :srid => 4326)
56
60
  assert_equal(true, factory_.property(:has_z_coordinate))
57
61
  assert_equal(true, factory_.property(:is_cartesian))
58
62
  assert_nil(factory_.property(:is_geographic))
59
63
  assert_equal(4326, factory_.srid)
60
64
  end
61
-
62
-
65
+
66
+
63
67
  def test_set_factory_generator
64
- ::ActiveRecord::Base.rgeo_factory_generator = ::RGeo::Geographic.method(:spherical_factory)
65
- factory_ = ::ActiveRecord::Base.rgeo_factory_for_column(:hello, :has_z_coordinate => true, :srid => 4326)
68
+ MyTable.rgeo_factory_generator = ::RGeo::Geographic.method(:spherical_factory)
69
+ factory_ = MyTable.rgeo_factory_for_column(:hello, :has_z_coordinate => true, :srid => 4326)
66
70
  assert_equal(true, factory_.property(:has_z_coordinate))
67
71
  assert_equal(true, factory_.property(:is_geographic))
68
72
  assert_nil(factory_.property(:is_cartesian))
69
73
  assert_equal(false, factory_.has_projection?)
70
74
  assert_equal(4326, factory_.srid)
71
75
  end
72
-
73
-
76
+
77
+
74
78
  def test_specific_factory_for_column
75
- ::ActiveRecord::Base.rgeo_factory_generator = nil
76
- ::ActiveRecord::Base.set_rgeo_factory_for_column(:foo, ::RGeo::Geographic.simple_mercator_factory(:has_z_coordinate => true))
77
- factory_ = ::ActiveRecord::Base.rgeo_factory_for_column(:foo)
79
+ MyTable.rgeo_factory_generator = nil
80
+ MyTable.set_rgeo_factory_for_column(:foo, ::RGeo::Geographic.simple_mercator_factory(:has_z_coordinate => true))
81
+ factory_ = MyTable.rgeo_factory_for_column(:foo)
78
82
  assert_equal(true, factory_.property(:has_z_coordinate))
79
83
  assert_equal(true, factory_.property(:is_geographic))
80
84
  assert_nil(factory_.property(:is_cartesian))
81
85
  assert_equal(true, factory_.has_projection?)
82
86
  assert_equal(4326, factory_.srid)
83
87
  end
84
-
85
-
88
+
89
+
86
90
  def test_default_as_json_wkt
87
91
  GeometryMixin.set_json_generator(nil)
88
92
  factory_ = ::RGeo::Cartesian.preferred_factory
89
93
  p_ = factory_.point(1, 2)
90
94
  assert_equal("POINT (1.0 2.0)", p_.as_json)
91
95
  end
92
-
93
-
96
+
97
+
94
98
  def test_default_as_json_geojson
95
99
  GeometryMixin.set_json_generator(:geojson)
96
100
  factory_ = ::RGeo::Cartesian.preferred_factory
97
101
  p_ = factory_.point(1, 2)
98
102
  assert_equal({'type' => 'Point', 'coordinates' => [1.0, 2.0]}, p_.as_json)
99
103
  end
100
-
101
-
104
+
105
+
102
106
  end
103
-
107
+
104
108
  end
105
109
  end
106
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-26 00:00:00.000000000Z
12
+ date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rgeo
16
- requirement: &2160521800 !ruby/object:Gem::Requirement
16
+ requirement: &2164456360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.3.2
21
+ version: 0.3.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160521800
24
+ version_requirements: *2164456360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &2160521000 !ruby/object:Gem::Requirement
27
+ requirement: &2164455600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160521000
35
+ version_requirements: *2164455600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: arel
38
- requirement: &2160520440 !ruby/object:Gem::Requirement
38
+ requirement: &2164455040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.0.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2160520440
46
+ version_requirements: *2164455040
47
47
  description: RGeo is a geospatial data library for Ruby. RGeo::ActiveRecord is an
48
48
  optional RGeo module providing some spatial extensions to ActiveRecord, as well
49
49
  as common tools used by RGeo-based spatial adapters.
@@ -63,6 +63,7 @@ files:
63
63
  - lib/rgeo/active_record/task_hacker.rb
64
64
  - lib/rgeo/active_record/version.rb
65
65
  - lib/rgeo/active_record.rb
66
+ - lib/rgeo-activerecord.rb
66
67
  - test/tc_basic.rb
67
68
  - History.rdoc
68
69
  - README.rdoc
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  version: 1.3.1
88
89
  requirements: []
89
90
  rubyforge_project: virtuoso
90
- rubygems_version: 1.8.7
91
+ rubygems_version: 1.8.12
91
92
  signing_key:
92
93
  specification_version: 3
93
94
  summary: An RGeo module providing spatial extensions to ActiveRecord.