active_record_fix_integer_limit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 87ac7433faa0ed7b9035c114563117149cf915d2ed3228bacc4a7b463bedbc98
4
+ data.tar.gz: 7f84351d1227527ddfd1e7e19be777be4e75281a41c6f0ee837668d618c10d90
5
+ SHA512:
6
+ metadata.gz: 6776b1a32281d906fb8dbb786c75069b3d1c5f1d7b859c93b9702bbd79b055fd6875b017d94bf6b33c6291a01253fb0ff8669ece9c09565147ebe2dfd1099c66
7
+ data.tar.gz: 10e779276fd944988a7aa9d630625dacd2870f3ee070395909b0065048e0253864609c951c16e9d31463362fe28177b45a6e39b7f53e651e044643f46ad9d81e
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in active_record_fix_integer_limit.gemspec.
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,150 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ active_record_fix_integer_limit (0.1.0)
5
+ activerecord (>= 5.2.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.2.1)
11
+ actionpack (= 5.2.1)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.1)
15
+ actionpack (= 5.2.1)
16
+ actionview (= 5.2.1)
17
+ activejob (= 5.2.1)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.1)
21
+ actionview (= 5.2.1)
22
+ activesupport (= 5.2.1)
23
+ rack (~> 2.0)
24
+ rack-test (>= 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.2.1)
28
+ activesupport (= 5.2.1)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.1)
34
+ activesupport (= 5.2.1)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.1)
37
+ activesupport (= 5.2.1)
38
+ activerecord (5.2.1)
39
+ activemodel (= 5.2.1)
40
+ activesupport (= 5.2.1)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.1)
43
+ actionpack (= 5.2.1)
44
+ activerecord (= 5.2.1)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.1)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
51
+ arel (9.0.0)
52
+ builder (3.2.3)
53
+ coderay (1.1.2)
54
+ concurrent-ruby (1.0.5)
55
+ crass (1.0.4)
56
+ diff-lcs (1.3)
57
+ erubi (1.7.1)
58
+ globalid (0.4.1)
59
+ activesupport (>= 4.2.0)
60
+ i18n (1.1.0)
61
+ concurrent-ruby (~> 1.0)
62
+ loofah (2.2.2)
63
+ crass (~> 1.0.2)
64
+ nokogiri (>= 1.5.9)
65
+ mail (2.7.0)
66
+ mini_mime (>= 0.1.1)
67
+ marcel (0.3.3)
68
+ mimemagic (~> 0.3.2)
69
+ method_source (0.9.0)
70
+ mimemagic (0.3.2)
71
+ mini_mime (1.0.1)
72
+ mini_portile2 (2.3.0)
73
+ minitest (5.11.3)
74
+ nio4r (2.3.1)
75
+ nokogiri (1.8.4)
76
+ mini_portile2 (~> 2.3.0)
77
+ pry (0.11.3)
78
+ coderay (~> 1.1.0)
79
+ method_source (~> 0.9.0)
80
+ rack (2.0.5)
81
+ rack-test (1.1.0)
82
+ rack (>= 1.0, < 3)
83
+ rails (5.2.1)
84
+ actioncable (= 5.2.1)
85
+ actionmailer (= 5.2.1)
86
+ actionpack (= 5.2.1)
87
+ actionview (= 5.2.1)
88
+ activejob (= 5.2.1)
89
+ activemodel (= 5.2.1)
90
+ activerecord (= 5.2.1)
91
+ activestorage (= 5.2.1)
92
+ activesupport (= 5.2.1)
93
+ bundler (>= 1.3.0)
94
+ railties (= 5.2.1)
95
+ sprockets-rails (>= 2.0.0)
96
+ rails-dom-testing (2.0.3)
97
+ activesupport (>= 4.2.0)
98
+ nokogiri (>= 1.6)
99
+ rails-html-sanitizer (1.0.4)
100
+ loofah (~> 2.2, >= 2.2.2)
101
+ railties (5.2.1)
102
+ actionpack (= 5.2.1)
103
+ activesupport (= 5.2.1)
104
+ method_source
105
+ rake (>= 0.8.7)
106
+ thor (>= 0.19.0, < 2.0)
107
+ rake (10.5.0)
108
+ rspec (3.8.0)
109
+ rspec-core (~> 3.8.0)
110
+ rspec-expectations (~> 3.8.0)
111
+ rspec-mocks (~> 3.8.0)
112
+ rspec-core (3.8.0)
113
+ rspec-support (~> 3.8.0)
114
+ rspec-expectations (3.8.1)
115
+ diff-lcs (>= 1.2.0, < 2.0)
116
+ rspec-support (~> 3.8.0)
117
+ rspec-mocks (3.8.0)
118
+ diff-lcs (>= 1.2.0, < 2.0)
119
+ rspec-support (~> 3.8.0)
120
+ rspec-support (3.8.0)
121
+ sprockets (3.7.2)
122
+ concurrent-ruby (~> 1.0)
123
+ rack (> 1, < 3)
124
+ sprockets-rails (3.2.1)
125
+ actionpack (>= 4.0)
126
+ activesupport (>= 4.0)
127
+ sprockets (>= 3.0.0)
128
+ sqlite3 (1.3.13)
129
+ thor (0.20.0)
130
+ thread_safe (0.3.6)
131
+ tzinfo (1.2.5)
132
+ thread_safe (~> 0.1)
133
+ websocket-driver (0.7.0)
134
+ websocket-extensions (>= 0.1.0)
135
+ websocket-extensions (0.1.3)
136
+
137
+ PLATFORMS
138
+ ruby
139
+
140
+ DEPENDENCIES
141
+ active_record_fix_integer_limit!
142
+ bundler (~> 1.13)
143
+ pry (~> 0.11)
144
+ rails (~> 5.2.1)
145
+ rake (~> 10.0)
146
+ rspec (~> 3.7)
147
+ sqlite3
148
+
149
+ BUNDLED WITH
150
+ 1.16.4
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright © 2018 hellekin <hellekin@cepheide.org>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # ActiveRecord::FixIntegerLimit
2
+
3
+ ActiveModel::Type::Integer uses 4 bytes, but our databases use 8. So we
4
+ explicitly pass that limit of 8 to the appropriate ActiveRecord::Type
5
+ constructor and recalculate the range. Now, e.g., [Fabricate], won't complain
6
+ anymore that:
7
+
8
+ ``` ruby
9
+ ActiveModel::RangeError:
10
+ def initialize(*)
11
+ 6367829093 is out of range for ActiveModel::Type::Integer with limit 4 bytes
12
+ ```
13
+
14
+ [Fabricate]: https://fabricationgem.org/
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'active_record_fix_integer_limit'
22
+ ```
23
+
24
+ And then execute:
25
+ ```bash
26
+ $ bundle
27
+ ```
28
+
29
+ Or install it yourself as:
30
+ ```bash
31
+ $ gem install active_record_fix_integer_limit
32
+ ```
33
+
34
+ ## Test
35
+
36
+ You can test the gem with:
37
+ ```bash
38
+ $ bundle exec rspec
39
+ ```
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on Gitlab at
44
+ https://gitlab.com/incommon.cc/active_record_fix_integer_limit.
45
+
46
+ The [Github repository] is a mirror to facilitate integration with other Rails
47
+ development, but I don't like Microsoft, and never will. They may show the face
48
+ they like, they come from enemity and, as far as I'm concerned, will remain
49
+ there.
50
+
51
+ [Github repository]: https://github.com/moners/active_record_fix_integer_limit
52
+
53
+ # Development
54
+
55
+ After checking out the repo, run `bin/setup` to install dependencies.
56
+ Run specifications with `bundle exec rake`.
57
+
58
+ To install this gem onto your local machine, run `bundle exec rake install`. To
59
+ release a new version, update the version number in `version.rb`, and then run
60
+ `bundle exec rake release`, which will create a git tag for the version, push
61
+ git commits and tags, and push the `.gem` file to
62
+ [rubygems.org](https://rubygems.org).
63
+ See `bundle exec rake -T` for more options.
64
+
65
+ ## License
66
+
67
+ The gem is free software under the same [license] terms as Rails.
68
+
69
+ [license]: ./MIT-LICENSE
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ActiveRecordFixIntegerLimit'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+ require "rspec/core/rake_task"
19
+
20
+ RSpec::Core::RakeTask.new(:spec)
21
+
22
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ $:.push File.expand_path("lib", __dir__)
4
+ require "active_record/fix_integer_limit/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "active_record_fix_integer_limit"
8
+ s.version = ActiveRecord::FixIntegerLimit::VERSION
9
+ s.authors = ["hellekin"]
10
+ s.email = ["hellekin@cepheide.org"]
11
+ s.homepage = "https://gitlab.com/hellekin/active_record_fix_integer_limit"
12
+ s.summary = "Enable ActiveRecord unsigned integers to use 8 bytes instead of 4."
13
+ s.description = "This fixes the DEFAULT_LIMIT set to 4 bytes in ActiveModel::Type:Integer."
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ s.bindir = "exe"
18
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.required_ruby_version = '>= 2.5.1'
22
+
23
+ s.add_runtime_dependency "activerecord", ">= 5.2.1"
24
+ s.add_development_dependency "bundler", "~> 1.13"
25
+ s.add_development_dependency "pry", "~> 0.11"
26
+ s.add_development_dependency "rake", "~> 10.0"
27
+ s.add_development_dependency "rails", "~> 5.2.1"
28
+ s.add_development_dependency "rspec", "~> 3.7"
29
+ s.add_development_dependency "sqlite3"
30
+ end
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,17 @@
1
+ require "active_record/type"
2
+
3
+ module ActiveRecord
4
+ module FixIntegerLimit
5
+ def initialize(*)
6
+ super
7
+ @limit ||= 8
8
+ @range = min_value...max_value
9
+ end
10
+ end
11
+
12
+ module Type
13
+ class UnsignedInteger
14
+ prepend FixIntegerLimit
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveRecord
2
+ module FixIntegerLimit
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require "active_record/fix_integer_limit"
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_record_fix_integer_limit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - hellekin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.2.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.2.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: This fixes the DEFAULT_LIMIT set to 4 bytes in ActiveModel::Type:Integer.
112
+ email:
113
+ - hellekin@cepheide.org
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - MIT-LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - active_record_fix_integer_limit.gemspec
126
+ - bin/setup
127
+ - lib/active_record/fix_integer_limit.rb
128
+ - lib/active_record/fix_integer_limit/version.rb
129
+ - lib/active_record_fix_integer_limit.rb
130
+ homepage: https://gitlab.com/hellekin/active_record_fix_integer_limit
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 2.5.1
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.7.6
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Enable ActiveRecord unsigned integers to use 8 bytes instead of 4.
154
+ test_files: []