uuidable 0.2.5 → 1.0.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: 5628f9ea69f6e8c81ea139b7e9c737b6dd7531560c2f6e46240eee051d6c29bb
4
- data.tar.gz: ed36c9a7b63affee80dd3149eaf7d6f5f194b1f6377559ba0b7922af507a52c8
3
+ metadata.gz: 8f081ae636a60448b89df948da41feb1b11bfdc8a338d79b2c6c407732b2f3f8
4
+ data.tar.gz: 0a878578bbcb7d31c48a8688feeeaef4ac1d5aff333dc7b0b9087f27668d9680
5
5
  SHA512:
6
- metadata.gz: b1d5aa768583511f4d4427b6dab13ca72de4193993a05fd0fc29ef7140c9fcf40f55111b2cfab5fa8afde26c568fee1ae58f7ab82dd504effe76e351d14414c2
7
- data.tar.gz: 24aa031c103ae8c1958373806335d7de27c0b3cd5ebea17c625d79831610ef6db34784b46d0051163eb991e06e0b54b63f5c72a68fe2b06c216b4906c9f4f6eb
6
+ metadata.gz: bc2257a1ce64b2e4d3a69b50fd5600b8737c1e9ad733b05cf989ec247115bcd4b002a3a564502e0a69686b37f1421a22972494471aee5d5c91ae2c9fe6b27127
7
+ data.tar.gz: 1c3870cfe1234a8197a8f8d79746b8ba4c2bde15b3d61b83658c52548a2c9a4cd223141a11ac0585cfd8c545aaed7576e266155ecc4158a2d84a8d45e4927e14
@@ -0,0 +1,25 @@
1
+ name: Build + publish
2
+
3
+ on:
4
+ push:
5
+ tags: [ v* ]
6
+ jobs:
7
+ build:
8
+ name: Build + Publish
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+
13
+ - name: Release Gem
14
+ if: contains(github.ref, 'refs/tags/v')
15
+ uses: cadwallion/publish-rubygems-action@master
16
+ env:
17
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
18
+ RELEASE_COMMAND: bundle exec rake release
19
+ # steps:
20
+ # - uses: actions/checkout@v3
21
+ # - name: Set up Ruby
22
+ # uses: ruby/setup-ruby@v1
23
+ # with:
24
+ # ruby-version: .ruby-version
25
+ # bundler-cache: true
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Test
9
+
10
+ on:
11
+ push:
12
+ branches: [ '*' ]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ${{ matrix.os }}-latest
20
+ strategy:
21
+ matrix:
22
+ os: [ubuntu, macos]
23
+ ruby-version: ['2.7', '3.0', '3.1']
24
+
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - name: Set up Ruby
28
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run rubocop
35
+ run: bundle exec rubocop
36
+ - name: Run tests
37
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /.history/
data/.rubocop.yml CHANGED
@@ -1,11 +1,14 @@
1
- Metrics/LineLength:
2
- Max: 120
1
+ AllCops:
2
+ NewCops: disable
3
+
4
+ Layout/LineLength:
5
+ Max: 140
3
6
 
4
7
  Metrics/CyclomaticComplexity:
5
8
  Max: 10
6
9
 
7
10
  Metrics/MethodLength:
8
- Max: 20
11
+ Max: 30
9
12
 
10
13
  Metrics/AbcSize:
11
14
  Max: 25
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in uuidable.gemspec
data/Gemfile.lock CHANGED
@@ -1,29 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uuidable (0.2.5)
5
- activerecord (>= 4.2, < 6.1)
4
+ uuidable (1.0.0)
5
+ activerecord (>= 4.2, < 7.2)
6
+ mysql-binuuid-rails (>= 1.3, < 2)
6
7
  uuidtools (>= 2.1, < 3)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- activemodel (6.0.3.5)
12
- activesupport (= 6.0.3.5)
13
- activerecord (6.0.3.5)
14
- activemodel (= 6.0.3.5)
15
- activesupport (= 6.0.3.5)
16
- activesupport (6.0.3.5)
12
+ activemodel (7.0.4.1)
13
+ activesupport (= 7.0.4.1)
14
+ activerecord (7.0.4.1)
15
+ activemodel (= 7.0.4.1)
16
+ activesupport (= 7.0.4.1)
17
+ activesupport (7.0.4.1)
17
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
22
- addressable (2.4.0)
23
- ast (2.3.0)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ addressable (2.8.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ ast (2.4.2)
24
25
  backports (3.6.8)
25
- concurrent-ruby (1.1.8)
26
- diff-lcs (1.2.5)
26
+ concurrent-ruby (1.1.10)
27
+ diff-lcs (1.5.0)
27
28
  ethon (0.8.1)
28
29
  ffi (>= 1.3.0)
29
30
  faraday (0.9.2)
@@ -39,48 +40,55 @@ GEM
39
40
  net-http-persistent (>= 2.7)
40
41
  net-http-pipeline
41
42
  highline (1.7.8)
42
- i18n (1.8.9)
43
+ i18n (1.12.0)
43
44
  concurrent-ruby (~> 1.0)
44
45
  json (2.3.1)
45
46
  launchy (2.4.3)
46
47
  addressable (~> 2.3)
47
- minitest (5.14.3)
48
+ minitest (5.17.0)
48
49
  multi_json (1.11.2)
49
50
  multipart-post (2.0.0)
51
+ mysql-binuuid-rails (1.3.0)
52
+ activerecord (>= 5)
50
53
  net-http-persistent (2.9.4)
51
54
  net-http-pipeline (1.0.1)
52
- parallel (1.12.0)
53
- parser (2.4.0.2)
54
- ast (~> 2.3)
55
- powerpack (0.1.1)
55
+ parallel (1.22.1)
56
+ parser (3.1.2.0)
57
+ ast (~> 2.4.1)
58
+ public_suffix (4.0.7)
56
59
  pusher-client (0.6.2)
57
60
  json
58
61
  websocket (~> 1.0)
59
- rainbow (2.2.2)
60
- rake
61
- rake (13.0.1)
62
- rspec (3.4.0)
63
- rspec-core (~> 3.4.0)
64
- rspec-expectations (~> 3.4.0)
65
- rspec-mocks (~> 3.4.0)
66
- rspec-core (3.4.3)
67
- rspec-support (~> 3.4.0)
68
- rspec-expectations (3.4.0)
62
+ rainbow (3.1.1)
63
+ rake (13.0.6)
64
+ regexp_parser (2.5.0)
65
+ rexml (3.2.5)
66
+ rspec (3.11.0)
67
+ rspec-core (~> 3.11.0)
68
+ rspec-expectations (~> 3.11.0)
69
+ rspec-mocks (~> 3.11.0)
70
+ rspec-core (3.11.0)
71
+ rspec-support (~> 3.11.0)
72
+ rspec-expectations (3.11.0)
69
73
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.4.0)
71
- rspec-mocks (3.4.1)
74
+ rspec-support (~> 3.11.0)
75
+ rspec-mocks (3.11.1)
72
76
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.4.0)
74
- rspec-support (3.4.1)
75
- rubocop (0.50.0)
77
+ rspec-support (~> 3.11.0)
78
+ rspec-support (3.11.0)
79
+ rubocop (1.32.0)
80
+ json (~> 2.3)
76
81
  parallel (~> 1.10)
77
- parser (>= 2.3.3.1, < 3.0)
78
- powerpack (~> 0.1)
79
- rainbow (>= 2.2.2, < 3.0)
82
+ parser (>= 3.1.0.0)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.8, < 3.0)
85
+ rexml (>= 3.2.5, < 4.0)
86
+ rubocop-ast (>= 1.19.1, < 2.0)
80
87
  ruby-progressbar (~> 1.7)
81
- unicode-display_width (~> 1.0, >= 1.0.1)
82
- ruby-progressbar (1.9.0)
83
- thread_safe (0.3.6)
88
+ unicode-display_width (>= 1.4.0, < 3.0)
89
+ rubocop-ast (1.19.1)
90
+ parser (>= 3.1.1.0)
91
+ ruby-progressbar (1.11.0)
84
92
  travis (1.8.2)
85
93
  backports
86
94
  faraday (~> 0.9)
@@ -92,18 +100,17 @@ GEM
92
100
  typhoeus (~> 0.6, >= 0.6.8)
93
101
  typhoeus (0.8.0)
94
102
  ethon (>= 0.8.0)
95
- tzinfo (1.2.9)
96
- thread_safe (~> 0.1)
97
- unicode-display_width (1.3.0)
103
+ tzinfo (2.0.5)
104
+ concurrent-ruby (~> 1.0)
105
+ unicode-display_width (2.2.0)
98
106
  uuidtools (2.2.0)
99
107
  websocket (1.2.2)
100
- zeitwerk (2.4.2)
101
108
 
102
109
  PLATFORMS
103
110
  ruby
104
111
 
105
112
  DEPENDENCIES
106
- bundler (~> 1.11)
113
+ bundler (~> 2.4)
107
114
  rake (~> 13.0)
108
115
  rspec (~> 3.0)
109
116
  rubocop
@@ -111,4 +118,4 @@ DEPENDENCIES
111
118
  uuidable!
112
119
 
113
120
  BUNDLED WITH
114
- 1.17.3
121
+ 2.4.22
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Uuidable [![Build Status](https://travis-ci.org/flant/uuidable.svg?branch=master)](https://travis-ci.org/flant/uuidable)
1
+ # Uuidable
2
+
3
+ [![Build](https://github.com/flant/uuidable/actions/workflows/ruby.yml/badge.svg)](https://github.com/flant/uuidable/actions/workflows/ruby.yml) [![Gem Version](https://badge.fury.io/rb/uuidable.svg)](https://badge.fury.io/rb/uuidable)
2
4
 
3
5
  With this gem you can use UUID instead of id in routes. But id is still primary key.
4
6
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'uuidable'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Uuidable
2
4
  # ActiveRecord mixin
3
5
  module ActiveRecord
@@ -7,7 +9,7 @@ module Uuidable
7
9
 
8
10
  module Finder
9
11
  def find(*args)
10
- if args.first && args.first.is_a?(String) && args.first.match(UUIDTools::UUID_REGEXP)
12
+ if args.first.is_a?(String) && args.first&.match(UUIDTools::UUID_REGEXP)
11
13
  find_by_uuid!(*args)
12
14
  else
13
15
  super
@@ -19,8 +21,23 @@ module Uuidable
19
21
  module ClassMethods
20
22
  include Finder
21
23
 
22
- def uuidable(as_param: true)
23
- after_initialize { self.uuid = Uuidable.generate_uuid if attributes.keys.include?('uuid') && uuid.blank? }
24
+ def uuidable(as_param: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
25
+ # Configure all uuid columns for MySQL. Database may not be connected (i.e. on assets precompile), so we must supress errors.
26
+ conn_config = respond_to?(:connection_db_config) ? connection_db_config.configuration_hash : connection_config
27
+ if conn_config[:adapter].include?('mysql')
28
+ begin
29
+ columns.select { |c| c.type == :binary && c.limit == 16 && c.name.include?('uuid') }.each do |column|
30
+ attribute column.name.to_sym, MySQLBinUUID::Type.new
31
+ end
32
+ rescue ::ActiveRecord::ConnectionNotEstablished, Mysql2::Error::ConnectionError, ::ActiveRecord::NoDatabaseError # rubocop:disable Lint/SuppressedException
33
+ end
34
+ end
35
+
36
+ after_initialize do
37
+ self.uuid = Uuidable.generate_uuid if attributes.keys.include?('uuid') && uuid.blank?
38
+ self.uuid__old = uuid if respond_to?(:uuid__old)
39
+ end
40
+
24
41
  validates :uuid, presence: true, uniqueness: true, if: :uuid_changed?
25
42
 
26
43
  if as_param
@@ -44,6 +61,6 @@ module Uuidable
44
61
  end
45
62
 
46
63
  ActiveSupport.on_load(:active_record) do
47
- ActiveRecord::Base.send(:include, Uuidable::ActiveRecord)
48
- ActiveRecord::Relation.send(:prepend, Uuidable::ActiveRecord::Finder)
64
+ ActiveRecord::Base.include Uuidable::ActiveRecord
65
+ ActiveRecord::Relation.prepend Uuidable::ActiveRecord::Finder
49
66
  end
@@ -1,31 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Uuidable
2
4
  COLUMN_NAME = :uuid
3
5
  COLUMN_TYPE = :binary
4
- COLUMN_OPTIONS = { limit: 36, null: false }.freeze
6
+ COLUMN_OPTIONS = { limit: 16, null: false }.freeze
5
7
  INDEX_OPTIONS = { unique: true }.freeze
6
8
 
7
9
  # Module adds method to table definition
8
10
  module TableDefinition
9
- def uuid(opts = {})
11
+ def uuid(column_name = COLUMN_NAME, **opts)
10
12
  index_opts = opts.delete(:index)
11
13
  index_opts = {} if index_opts.nil?
12
14
 
13
- column_name = opts.delete(:column_name) || COLUMN_NAME
15
+ column_name ||= opts.delete(:column_name)
14
16
 
15
- column column_name, COLUMN_TYPE, COLUMN_OPTIONS.merge(opts)
16
- index column_name, INDEX_OPTIONS.merge(index_opts) if index_opts
17
+ column column_name, COLUMN_TYPE, **COLUMN_OPTIONS.merge(opts)
18
+ index column_name, **INDEX_OPTIONS.merge(index_opts) if index_opts
17
19
  end
18
20
  end
19
21
 
20
22
  # Module adds method to alter table migration
21
23
  module Migration
22
- def add_uuid_column(table_name, opts = {})
24
+ def add_uuid_column(table_name, column_name = COLUMN_NAME, **opts)
23
25
  index_opts = opts.delete(:index)
24
26
  index_opts = {} if index_opts == true
25
27
 
26
- column_name = opts.delete(:column_name) || COLUMN_NAME
28
+ column_name ||= opts.delete(:column_name)
27
29
 
28
- add_column table_name, column_name, COLUMN_TYPE, COLUMN_OPTIONS.merge(opts)
30
+ add_column table_name, column_name, COLUMN_TYPE, **COLUMN_OPTIONS.merge(opts)
29
31
 
30
32
  add_uuid_index(table_name, index_opts.merge(column_name: column_name)) if index_opts
31
33
  end
@@ -33,13 +35,13 @@ module Uuidable
33
35
  def add_uuid_index(table_name, opts = {})
34
36
  column_name = opts.delete(:column_name) || COLUMN_NAME
35
37
 
36
- add_index table_name, column_name, INDEX_OPTIONS.merge(opts)
38
+ add_index table_name, column_name, **INDEX_OPTIONS.merge(opts)
37
39
  end
38
40
  end
39
41
  end
40
42
 
41
43
  if defined? ActiveRecord::ConnectionAdapters::TableDefinition
42
- ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Uuidable::TableDefinition
44
+ ActiveRecord::ConnectionAdapters::TableDefinition.include Uuidable::TableDefinition
43
45
  end
44
46
 
45
- ActiveRecord::Migration.send :include, Uuidable::Migration if defined? ActiveRecord::Migration
47
+ ActiveRecord::Migration.include Uuidable::Migration if defined? ActiveRecord::Migration
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable all
4
+ module Uuidable
5
+ module V1MigrationHelpers
6
+ NEW_POSTFIX = '__new'
7
+ OLD_POSTFIX = '__old'
8
+
9
+ # Will create uuid columns with new type, move data from pre-v1 column and then move pre-v1 to *__old.
10
+ # WARNING: will only work on MySQL 8+.
11
+ def uuidable_migrate_uuid_columns_to_v1(table_name, columns_options = {}, **opts)
12
+ columns_options.stringify_keys!
13
+ uuid_columns = connection.columns(table_name).select do |column|
14
+ (columns_options.blank? || columns_options.key?(column.name)) &&
15
+ valid_column_for_migration?(column, **opts)
16
+ end
17
+
18
+ return if uuid_columns.blank?
19
+
20
+ indexes = indexes_with_columns(table_name, uuid_columns)
21
+
22
+ change_table table_name, bulk: true do |t|
23
+ uuid_columns.each do |column|
24
+ options = columns_options[column.name] || { null: column.null }
25
+ t.column :"#{column.name}#{NEW_POSTFIX}", :binary, **COLUMN_OPTIONS.merge(options).merge(after: column.name)
26
+ end
27
+ end
28
+
29
+ update = uuid_columns.map do |column, _opts|
30
+ <<~SQL
31
+ `#{table_name}`.`#{column.name}#{NEW_POSTFIX}` = IF(
32
+ IS_UUID(`#{table_name}`.`#{column.name}`),
33
+ UUID_TO_BIN(`#{table_name}`.`#{column.name}`),
34
+ `#{table_name}`.`#{column.name}`
35
+ )
36
+ SQL
37
+ end.join(', ')
38
+
39
+ execute "UPDATE `#{table_name}` SET #{update}"
40
+
41
+ change_table table_name, bulk: true do |t|
42
+ uuid_columns.each do |column|
43
+ t.rename column.name, :"#{column.name}#{OLD_POSTFIX}"
44
+ t.rename :"#{column.name}#{NEW_POSTFIX}", column.name
45
+ end
46
+
47
+ indexes.each do |ind|
48
+ t.remove_index name: ind.name
49
+ end
50
+ end
51
+
52
+ # recreate indexes with new column
53
+ change_table table_name, bulk: true do |t|
54
+ indexes.each do |ind|
55
+ t.index ind.columns, name: ind.name, unique: ind.unique
56
+ end
57
+ end
58
+ end
59
+
60
+ # WARNING: will only work until *__old columns is not deleted!
61
+ def uuidable_rollback_uuid_columns_from_v1(table_name, *columns)
62
+ columns.map!(&:to_s)
63
+ indexes = indexes(table_name)
64
+
65
+ uuid_columns = connection.columns(table_name).select do |column|
66
+ (columns.blank? || columns.include?(column.name)) &&
67
+ valid_column_for_migration?(column, limit: 16)
68
+ end
69
+
70
+ return if uuid_columns.blank?
71
+
72
+ indexes = indexes_with_columns(table_name, uuid_columns)
73
+
74
+ change_table table_name, bulk: true do |t|
75
+ uuid_columns.each do |column|
76
+ t.rename column.name, :"#{column.name}#{NEW_POSTFIX}"
77
+ t.rename :"#{column.name}#{OLD_POSTFIX}", column.name
78
+ end
79
+
80
+ indexes.each do |ind|
81
+ t.remove_index name: ind.name
82
+ end
83
+ end
84
+
85
+ change_table table_name, bulk: true do |t|
86
+ uuid_columns.each do |column|
87
+ t.remove :"#{column.name}#{NEW_POSTFIX}"
88
+ end
89
+
90
+ indexes.each do |ind|
91
+ t.index name: ind.name, unique: ind.unique
92
+ end
93
+ end
94
+ end
95
+
96
+ def uuidable_migrate_all_pre_v1_uuid_columns!
97
+ tables.each do |table_name|
98
+ uuidable_migrate_uuid_columns_to_v1 table_name
99
+ end
100
+ end
101
+
102
+ def uuidable_rollback_all_pre_v1_uuid_columns!
103
+ tables.each do |table_name|
104
+ uuidable_rollback_uuid_columns_from_v1 table_name
105
+ end
106
+ end
107
+
108
+ # WARNING: this is irreversible migration! It will drop all *uuid__old columns and their indexes in all tables!
109
+ def uuidable_drop_all_pre_v1_uuid_columns!
110
+ tables.each do |table_name|
111
+ indexes = indexes(table_name)
112
+ change_table table_name, bulk: true do |t|
113
+ connection.columns(table_name).each do |column|
114
+ next unless column.name.include?(OLD_POSTFIX)
115
+
116
+ indexes.each do |ind|
117
+ next unless ind.columns.include?(column.name)
118
+
119
+ t.remove_index name: ind.name
120
+ end
121
+
122
+ t.remove column.name
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ def valid_column_for_migration?(column, limit: 36, skip_type_check: false)
129
+ column.name.include?('uuid') &&
130
+ !column.name.include?(NEW_POSTFIX) &&
131
+ !column.name.include?(OLD_POSTFIX) &&
132
+ (skip_type_check || (
133
+ column.type == :binary &&
134
+ column.limit == limit
135
+ ))
136
+ end
137
+
138
+ def indexes_with_columns(table_name, columns)
139
+ indexes(table_name).select { |ind| (ind.columns & columns.map(&:name)).any? }
140
+ end
141
+ end
142
+ end
143
+ # rubocop:enable all
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Uuidable
2
- VERSION = '0.2.5'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
data/lib/uuidable.rb CHANGED
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'uuidable/version'
2
- require 'active_support'
4
+ require 'active_model'
3
5
  require 'uuidtools'
4
6
 
7
+ require 'mysql-binuuid-rails'
8
+
5
9
  # Main module
6
10
  module Uuidable
7
11
  module_function
@@ -12,4 +16,5 @@ module Uuidable
12
16
  end
13
17
 
14
18
  require 'uuidable/migration'
19
+ require 'uuidable/v1_migration_helpers'
15
20
  require 'uuidable/active_record'
data/uuidable.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'uuidable/version'
4
6
 
@@ -18,11 +20,14 @@ Gem::Specification.new do |spec|
18
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
21
  spec.require_paths = ['lib']
20
22
 
21
- spec.add_development_dependency 'bundler', '~> 1.11'
23
+ spec.required_ruby_version = '>= 2.7'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 2.4'
22
26
  spec.add_development_dependency 'rake', '~> 13.0'
23
27
  spec.add_development_dependency 'rspec', '~> 3.0'
24
28
  spec.add_development_dependency 'travis', '~> 1.8', '>= 1.8.2'
25
29
 
26
- spec.add_dependency 'activerecord', '>= 4.2', '< 6.1'
30
+ spec.add_dependency 'activerecord', '>= 4.2', '< 7.2'
31
+ spec.add_dependency 'mysql-binuuid-rails', '>= 1.3', '< 2'
27
32
  spec.add_dependency 'uuidtools', '>= 2.1', '< 3'
28
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuidable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-18 00:00:00.000000000 Z
11
+ date: 2024-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '2.4'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  version: '4.2'
82
82
  - - "<"
83
83
  - !ruby/object:Gem::Version
84
- version: '6.1'
84
+ version: '7.2'
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,7 +91,27 @@ dependencies:
91
91
  version: '4.2'
92
92
  - - "<"
93
93
  - !ruby/object:Gem::Version
94
- version: '6.1'
94
+ version: '7.2'
95
+ - !ruby/object:Gem::Dependency
96
+ name: mysql-binuuid-rails
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '1.3'
102
+ - - "<"
103
+ - !ruby/object:Gem::Version
104
+ version: '2'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '1.3'
112
+ - - "<"
113
+ - !ruby/object:Gem::Version
114
+ version: '2'
95
115
  - !ruby/object:Gem::Dependency
96
116
  name: uuidtools
97
117
  requirement: !ruby/object:Gem::Requirement
@@ -119,11 +139,12 @@ executables: []
119
139
  extensions: []
120
140
  extra_rdoc_files: []
121
141
  files:
142
+ - ".github/workflows/gem-push.yml"
143
+ - ".github/workflows/ruby.yml"
122
144
  - ".gitignore"
123
145
  - ".overcommit.yml"
124
146
  - ".rspec"
125
147
  - ".rubocop.yml"
126
- - ".travis.yml"
127
148
  - Gemfile
128
149
  - Gemfile.lock
129
150
  - LICENSE.txt
@@ -134,13 +155,14 @@ files:
134
155
  - lib/uuidable.rb
135
156
  - lib/uuidable/active_record.rb
136
157
  - lib/uuidable/migration.rb
158
+ - lib/uuidable/v1_migration_helpers.rb
137
159
  - lib/uuidable/version.rb
138
160
  - uuidable.gemspec
139
161
  homepage: https://github.com/flant/uuidable
140
162
  licenses:
141
163
  - MIT
142
164
  metadata: {}
143
- post_install_message:
165
+ post_install_message:
144
166
  rdoc_options: []
145
167
  require_paths:
146
168
  - lib
@@ -148,15 +170,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
170
  requirements:
149
171
  - - ">="
150
172
  - !ruby/object:Gem::Version
151
- version: '0'
173
+ version: '2.7'
152
174
  required_rubygems_version: !ruby/object:Gem::Requirement
153
175
  requirements:
154
176
  - - ">="
155
177
  - !ruby/object:Gem::Version
156
178
  version: '0'
157
179
  requirements: []
158
- rubygems_version: 3.0.8
159
- signing_key:
180
+ rubygems_version: 3.5.3
181
+ signing_key:
160
182
  specification_version: 4
161
183
  summary: Helps using uuid everywhere in routes instead of id for ActiveRecord models.
162
184
  test_files: []
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5.1
4
- before_install: gem install bundler -v 1.17.3
5
- script:
6
- - bundle exec rubocop
7
- - bundle exec rspec
8
- deploy:
9
- provider: rubygems
10
- api_key:
11
- secure: UrlqP2DVITJ7IfNWyJAL1981jzQlrRaBoOINDvaea1fSf54U0Bf4zvhiad/5ZMml8dv07sLnp4+gDyZW2jnxae+44A4BxxOYD8UGmEztSjFfQrR6Mbe7vapTatJ4r86c5kv/ea/seUQyy4JgR7cy6MlsFj6HJIw01IiIz3XDMF0hL0C2PXwtCnWgamgnDE6Eqrj/DJ2qhJf/8ELl53N/4fPfnFZKNXzUHhqJqNFgXmoQ092dhkkjmwSZqg0KyANLC1zMW0fqBGpX29/b2QCw0AQDWDlRstA6y2MaVnCGmAE37xZBbO7w03g1Neyjovoz2SklR3z16zmFMx/b6MGDTmnFtMFD6rNn0Paac5zO8U9UmrL4kCUicF9muekneh26Ba9IBIUc/BjujK+yzRHVX3ycdhKz263P1m5PrmJk4VO6OZxSN7rjHPHoz5dy864h1kfhQUQ7o/RxpN5N5i9/fUHH88dYq8mELRQtZGJl3DqJrv6S2NN67/3VLsbPD2LoO01YMKhJmu6MKQzcjGYaA/wjdPWHVsoORvWEY0oWEMrI8qIOCDQH9D1JPyhBUF35jgKI4AcgLNkboByKXdyZD+qklsy8pCl4BtQHtpowZ5/UOp1wi9K5RkU9AwD4RqNz5czliTyjOn5kICdgrdBk6LmU280sdynSlyxOK6AA1g4=
12
- gem: uuidable
13
- on:
14
- tags: true
15
- repo: flant/uuidable