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 +4 -4
- data/.github/workflows/test.yml +10 -2
- data/.gitignore +1 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/gemfiles/4.2.gemfile +6 -0
- data/gemfiles/5.0.gemfile +6 -0
- data/gemfiles/5.1.gemfile +6 -0
- data/gemfiles/5.2.gemfile +2 -0
- data/gemfiles/6.0.gemfile +2 -0
- data/gemfiles/6.1.gemfile +2 -0
- data/lib/ulid/rails/constants.rb +6 -0
- data/lib/ulid/rails/type.rb +22 -3
- data/lib/ulid/rails/version.rb +1 -1
- data/lib/ulid/rails.rb +6 -2
- data/ulid-rails.gemspec +3 -3
- metadata +13 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 286faae595c37c666671a84b8eeeb070497b585dd58cde500e96f8b9939e61e8
|
4
|
+
data.tar.gz: 8463132209c6706611a889e16ddfcf91d24173e88ec47cba9da743df8ccdc12f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84e1c464698d32480e5d27a9d91d13565478e5c3aebc2f8e4fd9c58bf07774eee5b65df3dc2cf4326bfcca7790ab2698ebc51d63cba7b82458707e72959b149
|
7
|
+
data.tar.gz: c687adcd8d9b8abee8c85c3bd4ce30dd5393883b7993366ca85c502b748cb668dd150ff5977153b8f90278d36fecbc8f02b07aa3d88a138031f78da0a5376120
|
data/.github/workflows/test.yml
CHANGED
@@ -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
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
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).
|
data/gemfiles/5.2.gemfile
CHANGED
data/gemfiles/6.0.gemfile
CHANGED
data/gemfiles/6.1.gemfile
CHANGED
data/lib/ulid/rails/type.rb
CHANGED
@@ -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
|
-
|
9
|
-
|
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
|
data/lib/ulid/rails/version.rb
CHANGED
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
|
-
|
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", ">=
|
27
|
-
spec.add_dependency "activemodel", ">=
|
28
|
-
spec.add_dependency "activerecord", ">=
|
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.
|
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-
|
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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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
|
-
|
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
|