armg 0.8.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b091745ad8e4956f0fe1d82c5550d6c700feeb34541fef66e96309f3bcf09c
4
- data.tar.gz: 0a045f637a8914a492cf93579f85399a6510183e23425ea152e864a81d9f8d8d
3
+ metadata.gz: 1d93f5c0ccd639a541a6b5c7f4d6e525bb726ee51dad6b7e10e44bbb5391e661
4
+ data.tar.gz: a8fc3cf837edfd65e95c989822016205e10cb018142315040e7997f82229eaa1
5
5
  SHA512:
6
- metadata.gz: e448dc89ea4e86c696a06a7e16ea09634a729347592ddfe0372ee9dd18dbda6f243f5313f05b2f84872171c84585c69def8207cf4a8aa6f0d2b0ab9006a5a2ca
7
- data.tar.gz: 9f426744830c050aa10152aa062232dc1bf9758b819c768b600f582c07ae3099acbb4413d43f2180c1b1a76593636192c6d06817770540922aef14abb895b845
6
+ metadata.gz: 24aecfae70437c9b4c84f34f31dac0b3ab4737e62318895c5808f0b410f929c3953574718bdf82a3eb8c3cb20f11f5958a014bec66e07d6f896ee1a3789d946e
7
+ data.tar.gz: d526c3fb89a6585b072e524fb99741faa92471a3ede5538d928364ae0b8144f37503b68778aad578fa26fc10da1463dda57d116a8038acd146cfde0ec83964f2
@@ -0,0 +1,58 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - 2.7
15
+ - 3.0
16
+ - 3.1
17
+ env:
18
+ - ARMG_TEST_MYSQL_PORT=10056 ARMG_TEST_MYSQL_ENGINE=MyISAM
19
+ - ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=MyISAM
20
+ - ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=InnoDB
21
+ - ARMG_TEST_MYSQL_PORT=10080 ARMG_TEST_MYSQL_ENGINE=MyISAM
22
+ - ARMG_TEST_MYSQL_PORT=10080 ARMG_TEST_MYSQL_ENGINE=InnoDB
23
+ gemfile:
24
+ - gemfiles/ar60.gemfile
25
+ - gemfiles/ar61.gemfile
26
+ - gemfiles/ar70.gemfile
27
+
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ - uses: actions/cache@v2
34
+ with:
35
+ path: gemfiles/vendor/bundle
36
+ key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('ridgepole.gemspec', '**/Gemfile', matrix.gemfile) }}
37
+ restore-keys: |
38
+ ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
39
+
40
+ - name: Setup dependencies
41
+ run: |
42
+ for i in {1..60}; do docker-compose up -d && break; sleep 1; done
43
+
44
+ gem install bundler
45
+ bundle config path vendor/bundle
46
+ bundle install --jobs 4 --retry 3
47
+
48
+ # Wait until database servers start
49
+ function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P $1 ping; }
50
+ for i in {1..60}; do mysql_ping 10056 && break; sleep 1; done
51
+ for i in {1..60}; do mysql_ping 10057 && break; sleep 1; done
52
+ for i in {1..60}; do mysql_ping 10080 && break; sleep 1; done
53
+ env:
54
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
55
+
56
+ - run: ${{ matrix.env }} bundle exec rake
57
+ env:
58
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ AllCops:
3
3
  - gemfiles/**/*
4
4
  - test.rb
5
5
  TargetRubyVersion: 2.4
6
+ NewCops: enable
6
7
  Bundler/OrderedGems:
7
8
  Include:
8
9
  - "Appraisals"
@@ -22,3 +23,7 @@ Style/HashTransformKeys:
22
23
  Enabled: true
23
24
  Style/HashTransformValues:
24
25
  Enabled: true
26
+ Gemspec/RequiredRubyVersion:
27
+ Enabled: false
28
+ Gemspec/DevelopmentDependencies:
29
+ EnforcedStyle: gemspec
data/Appraisals CHANGED
@@ -1,17 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'ar50' do
4
- gem 'activerecord', '~> 5.0.0'
5
- end
6
-
7
- appraise 'ar51' do
8
- gem 'activerecord', '~> 5.1.0'
3
+ appraise 'ar60' do
4
+ gem 'activerecord', '~> 6.0.0'
9
5
  end
10
6
 
11
- appraise 'ar52' do
12
- gem 'activerecord', '~> 5.2.0'
7
+ appraise 'ar61' do
8
+ gem 'activerecord', '~> 6.1.0'
13
9
  end
14
10
 
15
- appraise 'ar60' do
16
- gem 'activerecord', '~> 6.0.0'
11
+ appraise 'ar70' do
12
+ gem 'activerecord', '~> 7.0.0'
17
13
  end
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ ### Changed
12
+
13
+ ### Deprecated
14
+
15
+ ### Removed
16
+
17
+ ### Fixed
18
+
19
+ ### Security
20
+
21
+ ## [v0.11.0] - 2023-03-07
22
+
23
+ ### Added
24
+
25
+ - Support MySQL 8.0 (with limitation) [#18](https://github.com/cookpad/armg/pull/18)
26
+ - Be careful of your SRID when upgrading.
27
+
28
+ ## [v0.10.0] - 2022-06-18
29
+
30
+ ### Added
31
+
32
+ - Support ActiveRecord 7.0 [#14](https://github.com/cookpad/armg/pull/14)
33
+ - Support Ruby 3.0 and 3.1 [#15](https://github.com/cookpad/armg/pull/15)
34
+
35
+ ### Removed
36
+
37
+ - Drop support for ActiveRecord 5.0, 5.1, and 5.2 [#15](https://github.com/cookpad/armg/pull/15)
38
+ - Drop support for Ruby 2.4, 2.5, and 2.6 [#15](https://github.com/cookpad/armg/pull/15)
39
+
40
+ [Unreleased]: https://github.com/cookpad/armg/compare/v0.10.0...HEAD
41
+ [v0.10.0]: https://github.com/cookpad/armg/compare/v0.9.0...v0.10.0
42
+ [v0.11.0]: https://github.com/cookpad/armg/compare/v0.10.0...v0.11.0
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  Add MySQL geometry type to Active Record.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/armg.svg)](https://badge.fury.io/rb/armg)
6
- [![Build Status](https://travis-ci.org/winebarrel/armg.svg?branch=master)](https://travis-ci.org/winebarrel/armg)
6
+ [![Build Status](https://github.com/cookpad/armg/workflows/test/badge.svg?branch=master)](https://github.com/cookpad/armg/actions)
7
+
7
8
 
8
9
  ## Installation
9
10
 
@@ -107,10 +108,10 @@ Geom.create!(id: 4, location: 'Point(-122.1 47.3)')
107
108
  docker-compose up -d
108
109
  bundle install
109
110
  bundle exec appraisal install
110
- bundle exec appraisal ar51 rake
111
- # bundle exec appraisal ar50 rake
112
- # ARMG_TEST_MYSQL_PORT=10057 bundle exec appraisal ar51 rake # MySQL 5.7
113
- # ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=InnoDB bundle exec appraisal ar51 rake
111
+ bundle exec appraisal ar61 rake
112
+ # bundle exec appraisal ar60 rake
113
+ # ARMG_TEST_MYSQL_PORT=10057 bundle exec appraisal ar61 rake # MySQL 5.7
114
+ # ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=InnoDB bundle exec appraisal ar61 rake
114
115
  ```
115
116
 
116
117
  ## Using with [Ridgepole](https://github.com/winebarrel/ridgepole)
@@ -119,17 +120,22 @@ You need to extend the TableDefinition class.
119
120
 
120
121
  ```ruby
121
122
  # ridgepole-geo.rb
122
- module Ridgepole
123
- class DSLParser
124
- class TableDefinition
125
- def geometry(*args)
126
- options = args.extract_options!
127
- column_names = args
128
- column_names.each { |name| column(name, :geometry, options) }
129
- end
130
- end
123
+ module TableDefinitionExtForGeometry
124
+ def geometry(*args)
125
+ options = args.extract_options!
126
+ column_names = args
127
+ column_names.each { |name| column(name, :geometry, options) }
128
+ end
129
+ end
130
+ Ridgepole::DSLParser::TableDefinition.prepend(TableDefinitionExtForGeometry)
131
+
132
+ module DiffExtForGeometry
133
+ def normalize_index_options!(opts)
134
+ super
135
+ opts.delete(:length) if opts[:type] == :spatial
131
136
  end
132
137
  end
138
+ Ridgepole::Diff.prepend(DiffExtForGeometry)
133
139
  ```
134
140
 
135
141
  ```sh
@@ -149,6 +155,14 @@ Apply `Schemafile`
149
155
  No change
150
156
  ```
151
157
 
158
+ ## Limitation on MySQL 8.0
159
+
160
+ At the moment, armg gem supports only SRIDs with long-lat axis order in MySQL 8.0.
161
+ e.g. SRID=3857 (WGS 84 / Pseudo-Mercator -- Spherical Mercator, Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI)
162
+
163
+ That is, armg does not support SRIDs with lat-long axis order.
164
+ e.g. SRID=4326 (WGS 84 -- WGS84 - World Geodetic System 1984, used in GPS)
165
+
152
166
  ## Related links
153
167
 
154
168
  * [rgeo/rgeo: Geospatial data library for Ruby](https://github.com/rgeo/rgeo)
data/armg.gemspec CHANGED
@@ -7,14 +7,13 @@ require 'armg/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'armg'
9
9
  spec.version = Armg::VERSION
10
- spec.authors = ['Genki Sugawara']
11
- spec.email = ['sugawara@cookpad.com']
10
+ spec.authors = ['Genki Sugawara', 'Cookpad Inc.']
11
+ spec.email = ['kaimono-dev@cookpad.com']
12
12
 
13
13
  spec.summary = 'Add MySQL geometry type to Active Record.'
14
14
  spec.description = 'Add MySQL geometry type to Active Record.'
15
- spec.homepage = 'https://github.com/winebarrel/armg'
15
+ spec.homepage = 'https://github.com/cookpad/armg'
16
16
  spec.license = 'MIT'
17
-
18
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
18
  f.match(%r{^(test|spec|features)/})
20
19
  end
@@ -22,7 +21,9 @@ Gem::Specification.new do |spec|
22
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
22
  spec.require_paths = ['lib']
24
23
 
25
- spec.add_dependency 'activerecord', '>= 5', '< 7'
24
+ spec.metadata['rubygems_mfa_required'] = 'true'
25
+
26
+ spec.add_dependency 'activerecord', '>= 6', '< 8'
26
27
  spec.add_dependency 'rgeo'
27
28
  spec.add_development_dependency 'appraisal', '>= 2.2.0'
28
29
  spec.add_development_dependency 'bundler'
@@ -31,5 +32,7 @@ Gem::Specification.new do |spec|
31
32
  spec.add_development_dependency 'rake'
32
33
  spec.add_development_dependency 'rspec', '~> 3.0'
33
34
  spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
34
- spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'rubocop', '>= 1.7.0'
36
+ spec.add_development_dependency 'rubocop-rake'
37
+ spec.add_development_dependency 'rubocop-rspec'
35
38
  end
data/docker-compose.yml CHANGED
@@ -12,3 +12,9 @@ services:
12
12
  image: "mysql:5.7"
13
13
  environment:
14
14
  - MYSQL_ALLOW_EMPTY_PASSWORD=1
15
+ mysql80:
16
+ ports:
17
+ - "10080:3306"
18
+ image: "mysql:8.0"
19
+ environment:
20
+ - MYSQL_ALLOW_EMPTY_PASSWORD=1
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 5.0.0"
5
+ gem "activerecord", "~> 6.1.0"
6
6
 
7
7
  gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 5.1.0"
5
+ gem "activerecord", "~> 7.0.0"
6
6
 
7
7
  gemspec path: "../"
@@ -2,11 +2,6 @@
2
2
 
3
3
  module Armg
4
4
  module AbstractMysqlAdapterExt
5
- def initialize_type_map(m = type_map)
6
- super
7
- m.register_type(/^geometry/i, Armg::MysqlGeometry.new)
8
- end
9
-
10
5
  def indexes(*args, &block)
11
6
  is = super
12
7
 
@@ -16,5 +11,9 @@ module Armg
16
11
 
17
12
  is
18
13
  end
14
+
15
+ def type_map
16
+ @type_map ||= super.tap { |m| m.register_type(/^geometry/i, Armg::MysqlGeometry.new) }
17
+ end
19
18
  end
20
19
  end
data/lib/armg/armg.rb CHANGED
@@ -5,12 +5,6 @@ module Armg
5
5
  @serializer = Armg::WkbSerializer.new
6
6
 
7
7
  class << self
8
- attr_reader :deserializer
9
-
10
- attr_writer :deserializer
11
-
12
- attr_reader :serializer
13
-
14
- attr_writer :serializer
8
+ attr_accessor :deserializer, :serializer
15
9
  end
16
10
  end
@@ -3,7 +3,7 @@
3
3
  module Armg
4
4
  module TableDefinitionExt
5
5
  def geometry(*args, **options)
6
- args.each { |name| column(name, :geometry, options) }
6
+ args.each { |name| column(name, :geometry, **options) }
7
7
  end
8
8
  end
9
9
  end
data/lib/armg/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Armg
4
- VERSION = '0.8.1'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: armg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
- autorequire:
8
+ - Cookpad Inc.
9
+ autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
12
+ date: 2023-03-07 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activerecord
@@ -16,20 +17,20 @@ dependencies:
16
17
  requirements:
17
18
  - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: '5'
20
+ version: '6'
20
21
  - - "<"
21
22
  - !ruby/object:Gem::Version
22
- version: '7'
23
+ version: '8'
23
24
  type: :runtime
24
25
  prerelease: false
25
26
  version_requirements: !ruby/object:Gem::Requirement
26
27
  requirements:
27
28
  - - ">="
28
29
  - !ruby/object:Gem::Version
29
- version: '5'
30
+ version: '6'
30
31
  - - "<"
31
32
  - !ruby/object:Gem::Version
32
- version: '7'
33
+ version: '8'
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: rgeo
35
36
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +145,34 @@ dependencies:
144
145
  version: 0.1.3
145
146
  - !ruby/object:Gem::Dependency
146
147
  name: rubocop
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 1.7.0
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: 1.7.0
160
+ - !ruby/object:Gem::Dependency
161
+ name: rubocop-rake
162
+ requirement: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: rubocop-rspec
147
176
  requirement: !ruby/object:Gem::Requirement
148
177
  requirements:
149
178
  - - ">="
@@ -158,16 +187,17 @@ dependencies:
158
187
  version: '0'
159
188
  description: Add MySQL geometry type to Active Record.
160
189
  email:
161
- - sugawara@cookpad.com
190
+ - kaimono-dev@cookpad.com
162
191
  executables: []
163
192
  extensions: []
164
193
  extra_rdoc_files: []
165
194
  files:
195
+ - ".github/workflows/test.yml"
166
196
  - ".gitignore"
167
197
  - ".rspec"
168
198
  - ".rubocop.yml"
169
- - ".travis.yml"
170
199
  - Appraisals
200
+ - CHANGELOG.md
171
201
  - Gemfile
172
202
  - LICENSE.txt
173
203
  - README.md
@@ -177,10 +207,9 @@ files:
177
207
  - bin/setup
178
208
  - docker-compose.yml
179
209
  - gemfiles/.bundle/config
180
- - gemfiles/ar50.gemfile
181
- - gemfiles/ar51.gemfile
182
- - gemfiles/ar52.gemfile
183
210
  - gemfiles/ar60.gemfile
211
+ - gemfiles/ar61.gemfile
212
+ - gemfiles/ar70.gemfile
184
213
  - lib/armg.rb
185
214
  - lib/armg/abstract_mysql_adapter_ext.rb
186
215
  - lib/armg/armg.rb
@@ -192,11 +221,12 @@ files:
192
221
  - lib/armg/wkb_serializer.rb
193
222
  - lib/armg/wkt_deserializer.rb
194
223
  - lib/armg/wkt_serializer.rb
195
- homepage: https://github.com/winebarrel/armg
224
+ homepage: https://github.com/cookpad/armg
196
225
  licenses:
197
226
  - MIT
198
- metadata: {}
199
- post_install_message:
227
+ metadata:
228
+ rubygems_mfa_required: 'true'
229
+ post_install_message:
200
230
  rdoc_options: []
201
231
  require_paths:
202
232
  - lib
@@ -211,8 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
241
  - !ruby/object:Gem::Version
212
242
  version: '0'
213
243
  requirements: []
214
- rubygems_version: 3.0.3
215
- signing_key:
244
+ rubygems_version: 3.3.26
245
+ signing_key:
216
246
  specification_version: 4
217
247
  summary: Add MySQL geometry type to Active Record.
218
248
  test_files: []
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- dist: xenial
2
- sudo: required
3
- group: edge
4
- services:
5
- - docker
6
- language: ruby
7
- rvm:
8
- - 2.4.9
9
- - 2.5.7
10
- - 2.6.5
11
- gemfile:
12
- - gemfiles/ar50.gemfile
13
- - gemfiles/ar51.gemfile
14
- - gemfiles/ar52.gemfile
15
- - gemfiles/ar60.gemfile
16
- before_script:
17
- - sudo service mysql stop
18
- - docker-compose up -d
19
- - function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P $1 ping; }
20
- - for i in {1..60}; do mysql_ping 10056 && break; sleep 1; done
21
- - for i in {1..60}; do mysql_ping 10057 && break; sleep 1; done
22
- cache:
23
- - bundler
24
- env:
25
- - ARMG_TEST_MYSQL_PORT=10056 ARMG_TEST_MYSQL_ENGINE=MyISAM
26
- - ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=MyISAM
27
- - ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=InnoDB
28
- script:
29
- - bundle exec rake
30
- matrix:
31
- exclude:
32
- - rvm: 2.4.9
33
- gemfile: gemfiles/ar60.gemfile
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.2.0"
6
-
7
- gemspec path: "../"