activerecord-postgis-adapter 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13b719128d29998b594c6b5824d977cbd9c613fe
4
+ data.tar.gz: aff10c325efe668907b5cceab815f86b621679a8
5
+ SHA512:
6
+ metadata.gz: 7129620feb197a400636bc4b5b563229041a03558bd6d095eca6c72c4ba12a52849919198907eeb8e65fa7c07e00fb34759afcacd528078e68ec78cba5e0f793
7
+ data.tar.gz: f4d7459e39bc259aaaa00d7a9eca3adfa1b36809ff017db983f7d01df366ffe9a3eb8f4e3299e931a48e6bf72e5a714c003b6fd684b2d247fb7a2e4d97170fb4
@@ -1,3 +1,10 @@
1
+ === 0.6.2 / 2013-03-08
2
+
3
+ * The PostGIS setup now properly connects as the superuser. (Reported by Adam Trilling)
4
+ * Fix database setup rake tasks under jruby/jdbc adapter. (Pull request by Nick Muerdter)
5
+ * Drop table no longer tries to modify the geometry_columns view under PostGIS 2.0.
6
+ * The Rakefile is now compatible with RubyGems 2.0.
7
+
1
8
  === 0.6.1 / 2013-02-28
2
9
 
3
10
  * Fixed some gem loading issues.
data/Version CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -92,7 +92,7 @@ def setup_gis(config_)
92
92
  ::ActiveRecord::Base.establish_connection(config_.merge('schema_search_path' => 'public', 'username' => su_username_, 'password' => su_password_))
93
93
  conn_ = ::ActiveRecord::Base.connection
94
94
  search_path_ = get_search_path(config_)
95
- quoted_username_ = ::PGconn.quote_ident(username_)
95
+ quoted_username_ = ::ActiveRecord::Base.connection.quote_column_name(username_)
96
96
  auth_ = has_su_ ? " AUTHORIZATION #{quoted_username_}" : ''
97
97
  search_path_.each do |schema_|
98
98
  exists = schema_.downcase == 'public' || conn_.execute("SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='#{schema_}'").try(:first)
@@ -128,6 +128,7 @@ def setup_gis(config_)
128
128
  postgis_version = conn_.execute( "SELECT #{postgis_schema_}.postgis_version();" ).first[ 'postgis_version' ]
129
129
  if postgis_version =~ /^2/
130
130
  conn_.execute("ALTER VIEW #{postgis_schema_}.geometry_columns OWNER TO #{quoted_username_}")
131
+ conn_.execute("ALTER VIEW #{postgis_schema_}.geography_columns OWNER TO #{quoted_username_}")
131
132
  else
132
133
  conn_.execute("ALTER TABLE #{postgis_schema_}.geometry_columns OWNER TO #{quoted_username_}")
133
134
  end
@@ -221,7 +221,9 @@ module ActiveRecord # :nodoc:
221
221
 
222
222
 
223
223
  def drop_table(table_name_, *options_)
224
- execute("DELETE from geometry_columns where f_table_name='#{quote_string(table_name_.to_s)}'")
224
+ if postgis_lib_version.to_s.split('.').first.to_i == 1
225
+ execute("DELETE from geometry_columns where f_table_name='#{quote_string(table_name_.to_s)}'")
226
+ end
225
227
  super
226
228
  end
227
229
 
@@ -215,7 +215,9 @@ module ActiveRecord # :nodoc:
215
215
 
216
216
 
217
217
  def drop_table(table_name_, *options_)
218
- execute("DELETE from geometry_columns where f_table_name='#{quote_string(table_name_.to_s)}'")
218
+ if postgis_lib_version.to_s.split('.').first.to_i == 1
219
+ execute("DELETE from geometry_columns where f_table_name='#{quote_string(table_name_.to_s)}'")
220
+ end
219
221
  super
220
222
  end
221
223
 
@@ -50,6 +50,7 @@ module ActiveRecord # :nodoc:
50
50
 
51
51
 
52
52
  def setup_gis
53
+ establish_su_connection
53
54
  setup_gis_schemas
54
55
  if script_dir
55
56
  setup_gis_from_script_dir
@@ -59,6 +60,7 @@ module ActiveRecord # :nodoc:
59
60
  if has_su? && (script_dir || extension_names)
60
61
  setup_gis_grant_privileges
61
62
  end
63
+ establish_connection(configuration) if has_su?
62
64
  end
63
65
 
64
66
 
@@ -69,7 +71,6 @@ module ActiveRecord # :nodoc:
69
71
  extra_configs_ = {'encoding' => encoding}
70
72
  extra_configs_['owner'] = username if has_su?
71
73
  connection.create_database(configuration['database'], configuration.merge(extra_configs_))
72
- establish_connection(configuration) unless master_established_
73
74
  setup_gis
74
75
  rescue ::ActiveRecord::StatementInvalid => error_
75
76
  if /database .* already exists/ === error_.message
@@ -108,12 +109,20 @@ module ActiveRecord # :nodoc:
108
109
  end
109
110
 
110
111
 
112
+ def establish_su_connection
113
+ establish_connection(configuration.merge(
114
+ 'schema_search_path' => 'public',
115
+ 'username' => su_username,
116
+ 'password' => su_password))
117
+ end
118
+
119
+
111
120
  def username
112
121
  @username ||= configuration['username']
113
122
  end
114
123
 
115
124
  def quoted_username
116
- @quoted_username ||= ::PGconn.quote_ident(username)
125
+ @quoted_username ||= ::ActiveRecord::Base.connection.quote_column_name(username)
117
126
  end
118
127
 
119
128
  def password
@@ -176,14 +185,12 @@ module ActiveRecord # :nodoc:
176
185
 
177
186
 
178
187
  def setup_gis_schemas
179
- establish_connection(configuration.merge('schema_search_path' => 'public'))
180
188
  auth_ = has_su? ? " AUTHORIZATION #{quoted_username}" : ''
181
189
  search_path.each do |schema_|
182
190
  if schema_.downcase != 'public' && !connection.execute("SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='#{schema_}'").try(:first)
183
191
  connection.execute("CREATE SCHEMA #{schema_}#{auth_}")
184
192
  end
185
193
  end
186
- establish_connection(configuration)
187
194
  end
188
195
 
189
196
 
@@ -212,6 +219,7 @@ module ActiveRecord # :nodoc:
212
219
  postgis_version_ = connection.execute( "SELECT #{postgis_schema}.postgis_version();" ).first['postgis_version']
213
220
  if postgis_version_ =~ /^2/
214
221
  connection.execute("ALTER VIEW #{postgis_schema}.geometry_columns OWNER TO #{quoted_username}")
222
+ connection.execute("ALTER VIEW #{postgis_schema}.geography_columns OWNER TO #{quoted_username}")
215
223
  else
216
224
  connection.execute("ALTER TABLE #{postgis_schema}.geometry_columns OWNER TO #{quoted_username}")
217
225
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgis-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
5
- prerelease:
4
+ version: 0.6.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel Azuma
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-01 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rgeo-activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,49 +27,43 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: minitest
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rdoc
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: This is an ActiveRecord connection adapter for PostGIS. It is based on
@@ -117,28 +108,28 @@ files:
117
108
  - README.rdoc
118
109
  - Version
119
110
  homepage: http://dazuma.github.com/activerecord-postgis-adapter
120
- licenses: []
111
+ licenses:
112
+ - BSD
113
+ metadata: {}
121
114
  post_install_message:
122
115
  rdoc_options: []
123
116
  require_paths:
124
117
  - lib
125
118
  required_ruby_version: !ruby/object:Gem::Requirement
126
- none: false
127
119
  requirements:
128
- - - ! '>='
120
+ - - '>='
129
121
  - !ruby/object:Gem::Version
130
122
  version: 1.8.7
131
123
  required_rubygems_version: !ruby/object:Gem::Requirement
132
- none: false
133
124
  requirements:
134
- - - ! '>'
125
+ - - '>'
135
126
  - !ruby/object:Gem::Version
136
127
  version: 1.3.1
137
128
  requirements: []
138
129
  rubyforge_project: virtuoso
139
- rubygems_version: 1.8.25
130
+ rubygems_version: 2.0.2
140
131
  signing_key:
141
- specification_version: 3
132
+ specification_version: 4
142
133
  summary: An ActiveRecord adapter for PostGIS, based on RGeo.
143
134
  test_files:
144
135
  - test/tc_basic.rb