ulid-rails 0.5.0 → 0.6.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: b4ae7aa650be9d57249be6d2a1a3bf77bf26fdb14493533137d7296f07772410
4
- data.tar.gz: 521af5d85b5b033b182678cd189ebbbbebf6e4571f2cfe076bcae4fa37800c6d
3
+ metadata.gz: 286faae595c37c666671a84b8eeeb070497b585dd58cde500e96f8b9939e61e8
4
+ data.tar.gz: 8463132209c6706611a889e16ddfcf91d24173e88ec47cba9da743df8ccdc12f
5
5
  SHA512:
6
- metadata.gz: 7feebaa207e82b83fb213380f14df767216afb69ab8ee91d4ffd68495776d9b8c7f1ee2550f92ac5f7292b5b5c1511dc4a714cfa0671b2a7fe3528a15fb567b8
7
- data.tar.gz: 886b465219c7fd77f57dad6c2c6c658149cfa22918ab7505863af86382beafbeb1d4616f02e1d13190fb14ab2044a95c8a9ca55bba6cbd87703c870e00c19284
6
+ metadata.gz: b84e1c464698d32480e5d27a9d91d13565478e5c3aebc2f8e4fd9c58bf07774eee5b65df3dc2cf4326bfcca7790ab2698ebc51d63cba7b82458707e72959b149
7
+ data.tar.gz: c687adcd8d9b8abee8c85c3bd4ce30dd5393883b7993366ca85c502b748cb668dd150ff5977153b8f90278d36fecbc8f02b07aa3d88a138031f78da0a5376120
@@ -5,10 +5,18 @@ jobs:
5
5
  tests:
6
6
  runs-on: ubuntu-latest
7
7
  strategy:
8
- matrix:
9
- activerecord-version: ["5.2", "6.0", "6.1"]
8
+ matrix:
9
+ activerecord-version: ["5.0", "5.1", "4.2", "5.2", "6.0", "6.1"]
10
10
  ruby-version: ["2.6", "2.7", "3.0"]
11
11
  exclude:
12
+ - activerecord-version: "4.2"
13
+ ruby-version: "2.7"
14
+ - activerecord-version: "4.2"
15
+ ruby-version: "3.0"
16
+ - activerecord-version: "5.0"
17
+ ruby-version: "3.0"
18
+ - activerecord-version: "5.1"
19
+ ruby-version: "3.0"
12
20
  - activerecord-version: "5.2"
13
21
  ruby-version: "3.0"
14
22
  steps:
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /Gemfile.lock
10
+ /gemfiles/*.gemfile.lock
data/.standard.yml CHANGED
@@ -1 +1,4 @@
1
1
  ruby_version: 2.3
2
+ ignore:
3
+ - 'vendor/**/*'
4
+ - 'gemfiles/vendor/**/*'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ulid-rails CHANGELOG
2
2
 
3
+ ## 0.6
4
+
5
+ - Add support for Rails 4.2, 5.0 and 5.1.
6
+
3
7
  ## 0.5
4
8
 
5
9
  - Ensure ULID order respects timestamp order to millisecond precision.
data/README.md CHANGED
@@ -114,6 +114,18 @@ Just run the below command to test with all supported DB engines.
114
114
  $ docker-compose run test
115
115
  ```
116
116
 
117
+ Or run with a specific ActiveRecord version
118
+
119
+ ```
120
+ $ docker-compose run -e AR_VERSION=6.1 test
121
+ ```
122
+
123
+ Or run tests locally, without docker-compose
124
+
125
+ ```
126
+ $ AR_VERSION=4.2 bundle update && AR_VERSION=4.2 bundle exec rake test
127
+ ```
128
+
117
129
  ## License
118
130
 
119
131
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ gem "activesupport", "~> 4.2"
2
+ gem "activemodel", "~> 4.2"
3
+ gem "activerecord", "~> 4.2"
4
+ gem "sqlite3", "~> 1.3.6"
5
+ gem "mysql2", ">= 0.3.13", "< 0.6.0"
6
+ gem "pg", "~> 0.15"
@@ -0,0 +1,6 @@
1
+ gem "activesupport", "~> 5.0"
2
+ gem "activemodel", "~> 5.0"
3
+ gem "activerecord", "~> 5.0"
4
+ gem "sqlite3", "~> 1.3.6"
5
+ gem "mysql2", ">= 0.3.18", "< 0.6.0"
6
+ gem "pg", ">= 0.18", "< 2.0"
@@ -0,0 +1,6 @@
1
+ gem "activesupport", "~> 5.1"
2
+ gem "activemodel", "~> 5.1"
3
+ gem "activerecord", "~> 5.1"
4
+ gem "sqlite3", "~> 1.3", ">= 1.3.6"
5
+ gem "mysql2", ">= 0.3.18", "< 0.6.0"
6
+ gem "pg", ">= 0.18", "< 2.0"
data/gemfiles/5.2.gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ source "https://rubygems.org"
2
+
1
3
  gem "activesupport", "~> 5.2"
2
4
  gem "activemodel", "~> 5.2"
3
5
  gem "activerecord", "~> 5.2"
data/gemfiles/6.0.gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ source "https://rubygems.org"
2
+
1
3
  gem "activesupport", "~> 6.0"
2
4
  gem "activemodel", "~> 6.0"
3
5
  gem "activerecord", "~> 6.0"
data/gemfiles/6.1.gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ source "https://rubygems.org"
2
+
1
3
  gem "activesupport", "~> 6.1.0"
2
4
  gem "activemodel", "~> 6.1.0"
3
5
  gem "activerecord", "~> 6.1.0"
@@ -0,0 +1,6 @@
1
+ module ULID
2
+ module Rails
3
+ RAILS_VERSION = "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"
4
+ RAILS_4_2 = RAILS_VERSION == "4.2"
5
+ end
6
+ end
@@ -1,12 +1,21 @@
1
- require "active_model/type"
2
1
  require "ulid/rails/formatter"
3
2
  require "ulid/rails/validator"
4
3
  require "ulid/rails/errors"
4
+ require "ulid/rails/constants"
5
5
 
6
6
  module ULID
7
7
  module Rails
8
- class Type < ActiveModel::Type::Binary
9
- class Data < ActiveModel::Type::Binary::Data
8
+ case RAILS_VERSION
9
+ when "4.2"
10
+ require "active_record/type"
11
+ Binary = ActiveRecord::Type::Binary
12
+ else
13
+ require "active_model/type"
14
+ Binary = ActiveModel::Type::Binary
15
+ end
16
+
17
+ class Type < Binary
18
+ class Data < Binary::Data
10
19
  alias_method :hex, :to_s
11
20
  end
12
21
 
@@ -41,6 +50,16 @@ module ULID
41
50
  end
42
51
  end
43
52
 
53
+ if RAILS_4_2
54
+ alias_method :type_cast_for_database, :serialize
55
+ alias_method :type_cast_from_database, :deserialize
56
+
57
+ def type_cast_from_user(value)
58
+ assert_valid_value(value)
59
+ super
60
+ end
61
+ end
62
+
44
63
  private
45
64
 
46
65
  def adapter
@@ -1,5 +1,5 @@
1
1
  module ULID
2
2
  module Rails
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
data/lib/ulid/rails.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require "active_record"
2
2
  require "active_support/concern"
3
- require "active_model/type"
4
3
  require "ulid"
5
4
  require "base32/crockford"
6
5
  require "ulid/rails/version"
7
6
  require "ulid/rails/type"
8
7
  require "ulid/rails/patch"
8
+ require "ulid/rails/constants"
9
9
 
10
10
  module ULID
11
11
  module Rails
@@ -45,7 +45,11 @@ module ULID
45
45
  end
46
46
  end
47
47
 
48
- ActiveModel::Type.register(:ulid, ULID::Rails::Type)
48
+ unless RAILS_4_2
49
+ require "active_model/type"
50
+ ActiveModel::Type.register(:ulid, ULID::Rails::Type)
51
+ end
52
+
49
53
  ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Patch::Migrations
50
54
  end
51
55
  end
data/ulid-rails.gemspec CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency "ulid", "~> 1.0"
25
25
  spec.add_dependency "base32-crockford", "~> 0.1"
26
- spec.add_dependency "activesupport", ">= 5.0"
27
- spec.add_dependency "activemodel", ">= 5.0"
28
- spec.add_dependency "activerecord", ">= 5.0"
26
+ spec.add_dependency "activesupport", ">= 4.2"
27
+ spec.add_dependency "activemodel", ">= 4.2"
28
+ spec.add_dependency "activerecord", ">= 4.2"
29
29
  spec.add_development_dependency "bundler"
30
30
  spec.add_development_dependency "rake"
31
31
  spec.add_development_dependency "minitest", "~> 5.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ulid-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazunori Kajihiro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-10-25 00:00:00.000000000 Z
12
+ date: 2021-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ulid
@@ -45,42 +45,42 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '5.0'
48
+ version: '4.2'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '5.0'
55
+ version: '4.2'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: activemodel
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '5.0'
62
+ version: '4.2'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '5.0'
69
+ version: '4.2'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: activerecord
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '5.0'
76
+ version: '4.2'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '5.0'
83
+ version: '4.2'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: bundler
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -159,10 +159,14 @@ files:
159
159
  - bin/run_tests
160
160
  - bin/setup
161
161
  - docker-compose.yml
162
+ - gemfiles/4.2.gemfile
163
+ - gemfiles/5.0.gemfile
164
+ - gemfiles/5.1.gemfile
162
165
  - gemfiles/5.2.gemfile
163
166
  - gemfiles/6.0.gemfile
164
167
  - gemfiles/6.1.gemfile
165
168
  - lib/ulid/rails.rb
169
+ - lib/ulid/rails/constants.rb
166
170
  - lib/ulid/rails/errors.rb
167
171
  - lib/ulid/rails/formatter.rb
168
172
  - lib/ulid/rails/patch.rb
@@ -189,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
193
  - !ruby/object:Gem::Version
190
194
  version: '0'
191
195
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.6.3
196
+ rubygems_version: 3.2.29
194
197
  signing_key:
195
198
  specification_version: 4
196
199
  summary: ULID for rails