armg 0.8.1 → 0.10.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: 6f21d8219a8753c5343896f6bac0a9095dcc3b041e2081c2b2f429e5236c2b8c
4
+ data.tar.gz: 1537948342121354504c2ae87f7b71271b8407bb2fa23c5f80d8551b81d307ca
5
5
  SHA512:
6
- metadata.gz: e448dc89ea4e86c696a06a7e16ea09634a729347592ddfe0372ee9dd18dbda6f243f5313f05b2f84872171c84585c69def8207cf4a8aa6f0d2b0ab9006a5a2ca
7
- data.tar.gz: 9f426744830c050aa10152aa062232dc1bf9758b819c768b600f582c07ae3099acbb4413d43f2180c1b1a76593636192c6d06817770540922aef14abb895b845
6
+ metadata.gz: 613068eaf698bba0925b0b50a07d91cb070e9b6056b42e1662ab5e9a795738f25c0b5296b43a66280c1506bd56dd76f63fa1cbc3fa70e32ca85966fb862f5e39
7
+ data.tar.gz: c563b9cd4ee699b03f449773e896db1d004d3cc90abedebe4a2c2f7188acc4e335a51d58350e16885ac139fda90207f9fa9bbdea37c0730b9bea60c8c966cded
@@ -0,0 +1,55 @@
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
+ gemfile:
22
+ - gemfiles/ar60.gemfile
23
+ - gemfiles/ar61.gemfile
24
+ - gemfiles/ar70.gemfile
25
+
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - uses: actions/cache@v2
32
+ with:
33
+ path: gemfiles/vendor/bundle
34
+ key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('ridgepole.gemspec', '**/Gemfile', matrix.gemfile) }}
35
+ restore-keys: |
36
+ ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
37
+
38
+ - name: Setup dependencies
39
+ run: |
40
+ for i in {1..60}; do docker-compose up -d && break; sleep 1; done
41
+
42
+ gem install bundler
43
+ bundle config path vendor/bundle
44
+ bundle install --jobs 4 --retry 3
45
+
46
+ # Wait until database servers start
47
+ function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P $1 ping; }
48
+ for i in {1..60}; do mysql_ping 10056 && break; sleep 1; done
49
+ for i in {1..60}; do mysql_ping 10057 && break; sleep 1; done
50
+ env:
51
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
52
+
53
+ - run: ${{ matrix.env }} bundle exec rake
54
+ env:
55
+ 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,5 @@ Style/HashTransformKeys:
22
23
  Enabled: true
23
24
  Style/HashTransformValues:
24
25
  Enabled: true
26
+ Gemspec/RequiredRubyVersion:
27
+ Enabled: false
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,31 @@
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
+ ## [0.10.0] - 2022-06-18
22
+
23
+ ### Added
24
+
25
+ - Support ActiveRecord 7.0 [#14](https://github.com/cookpad/armg/pull/14)
26
+ - Support Ruby 3.0 and 3.1 [#15](https://github.com/cookpad/armg/pull/15)
27
+
28
+ ### Removed
29
+
30
+ - Drop support for ActiveRecord 5.0, 5.1, and 5.2 [#15](https://github.com/cookpad/armg/pull/15)
31
+ - Drop support for Ruby 2.4, 2.5, and 2.6 [#15](https://github.com/cookpad/armg/pull/15)
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
data/armg.gemspec CHANGED
@@ -12,9 +12,8 @@ Gem::Specification.new do |spec|
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
@@ -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.10.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2022-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: '6'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
22
+ version: '8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5'
29
+ version: '6'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '8'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rgeo
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +144,34 @@ dependencies:
144
144
  version: 0.1.3
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: rubocop
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: 1.7.0
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 1.7.0
159
+ - !ruby/object:Gem::Dependency
160
+ name: rubocop-rake
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ - !ruby/object:Gem::Dependency
174
+ name: rubocop-rspec
147
175
  requirement: !ruby/object:Gem::Requirement
148
176
  requirements:
149
177
  - - ">="
@@ -163,11 +191,12 @@ executables: []
163
191
  extensions: []
164
192
  extra_rdoc_files: []
165
193
  files:
194
+ - ".github/workflows/test.yml"
166
195
  - ".gitignore"
167
196
  - ".rspec"
168
197
  - ".rubocop.yml"
169
- - ".travis.yml"
170
198
  - Appraisals
199
+ - CHANGELOG.md
171
200
  - Gemfile
172
201
  - LICENSE.txt
173
202
  - README.md
@@ -177,10 +206,9 @@ files:
177
206
  - bin/setup
178
207
  - docker-compose.yml
179
208
  - gemfiles/.bundle/config
180
- - gemfiles/ar50.gemfile
181
- - gemfiles/ar51.gemfile
182
- - gemfiles/ar52.gemfile
183
209
  - gemfiles/ar60.gemfile
210
+ - gemfiles/ar61.gemfile
211
+ - gemfiles/ar70.gemfile
184
212
  - lib/armg.rb
185
213
  - lib/armg/abstract_mysql_adapter_ext.rb
186
214
  - lib/armg/armg.rb
@@ -192,11 +220,12 @@ files:
192
220
  - lib/armg/wkb_serializer.rb
193
221
  - lib/armg/wkt_deserializer.rb
194
222
  - lib/armg/wkt_serializer.rb
195
- homepage: https://github.com/winebarrel/armg
223
+ homepage: https://github.com/cookpad/armg
196
224
  licenses:
197
225
  - MIT
198
- metadata: {}
199
- post_install_message:
226
+ metadata:
227
+ rubygems_mfa_required: 'true'
228
+ post_install_message:
200
229
  rdoc_options: []
201
230
  require_paths:
202
231
  - lib
@@ -211,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
240
  - !ruby/object:Gem::Version
212
241
  version: '0'
213
242
  requirements: []
214
- rubygems_version: 3.0.3
215
- signing_key:
243
+ rubygems_version: 3.2.15
244
+ signing_key:
216
245
  specification_version: 4
217
246
  summary: Add MySQL geometry type to Active Record.
218
247
  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: "../"