From f41fddd560cd1d3fc0298c15ae29a502bc725459 Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Tue, 2 Jul 2019 18:53:51 -0400 Subject: [PATCH 1/6] Add support for custom character sets and update README to explain how to use --- README.md | 4 +++- lib/uniqueness/generator.rb | 8 +++++++- lib/uniqueness/version.rb | 2 +- spec/generator/generator_spec.rb | 3 +++ spec/uniqueness/uniqueness_spec.rb | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f455133..13c1d60 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ passing an options hash. The following keys are supported: `:length` number of characters, defaults to __32__ -`:type` type of string, can be one of: `:human`, `:auto`, defaults to __:auto__ +`:type` type of string, can be one of: `:human`, `number`, or `:auto` and defaults to __:auto__ Human type generates strings easier to read by excluding ambiguous characters like `1, 5, 8, B, o, O, I, l, s, u`. @@ -63,6 +63,8 @@ Human type generates strings easier to read by excluding ambiguous characters li `:scope` scopes, defines the `ActiveRecord` `scope` applied before calculating the `position` field value. Defaults to __[]__ +`:chars` Custom character list. If provided then `:type` will be ignored. `:chars` can be a range, an array of characters, or a string of characters. + To generate a unique-random on the fly `Uniqueness.generate` that will produce a random field for you. You can also pass some options `Uniqueness.generate(type: :human)`. diff --git a/lib/uniqueness/generator.rb b/lib/uniqueness/generator.rb index e70421e..6091c35 100644 --- a/lib/uniqueness/generator.rb +++ b/lib/uniqueness/generator.rb @@ -3,12 +3,12 @@ module Uniqueness class << self def generate(opts = {}) - options ||= {} options = uniqueness_default_options.merge(opts) dict = uniqueness_dictionary - options[:blacklist] dict -= [*(:A..:Z)].map(&:to_s) unless options[:case_sensitive] dict -= uniqueness_ambigious_dictionary if options[:type].to_sym == :human dict = uniqueness_numbers_dictionary if options[:type].to_sym == :numbers + dict = uniqueness_custom_dictionary(options[:chars]) if options[:chars].present? code = Array.new(options[:length]).map { dict[SecureRandom.random_number(dict.length)] }.join "#{options[:prefix]}#{code}#{options[:suffix]}" end @@ -26,6 +26,12 @@ def uniqueness_numbers_dictionary [*(0..9)].map(&:to_s) end + def uniqueness_custom_dictionary(chars = []) + chars = [*chars] if chars.is_a?(Range) + chars = chars.map(&:to_s) if chars.is_a?(Array) + chars + end + # Default sorting options def uniqueness_default_options { diff --git a/lib/uniqueness/version.rb b/lib/uniqueness/version.rb index d8025c9..ff4ef0e 100644 --- a/lib/uniqueness/version.rb +++ b/lib/uniqueness/version.rb @@ -1,3 +1,3 @@ module Uniqueness - VERSION = '1.1.0'.freeze + VERSION = '1.1.1'.freeze end diff --git a/spec/generator/generator_spec.rb b/spec/generator/generator_spec.rb index 6386233..31bc1e2 100644 --- a/spec/generator/generator_spec.rb +++ b/spec/generator/generator_spec.rb @@ -6,5 +6,8 @@ it { expect(Uniqueness.generate(type: :numbers)).to match(/^[0-9]+$/) } it { expect(Uniqueness.generate(prefix: 'hassan').index('hassan')).to eq 0 } it { expect(Uniqueness.generate(suffix: 'hassan')).to end_with "hassan" } + it { expect(Uniqueness.generate(chars: 'A'..'F')).to match(/^[A-F]+$/) } + it { expect(Uniqueness.generate(chars: ('A'..'F').to_a)).to match(/^[A-F]+$/) } + it { expect(Uniqueness.generate(chars: 'ABCDEF')).to match(/^[A-F]+$/) } end end diff --git a/spec/uniqueness/uniqueness_spec.rb b/spec/uniqueness/uniqueness_spec.rb index d9b2411..6ed24e9 100644 --- a/spec/uniqueness/uniqueness_spec.rb +++ b/spec/uniqueness/uniqueness_spec.rb @@ -63,7 +63,7 @@ end end - context 'intialized new object' do + context 'initialized new object' do it { expect(new_page.after_init_token).not_to be_nil } context 'length' do From b63c359cb0e8dff93230e7a6608e7247a91b8d39 Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Tue, 2 Jul 2019 18:55:14 -0400 Subject: [PATCH 2/6] Fix numbers option in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13c1d60..b6b33ba 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ passing an options hash. The following keys are supported: `:length` number of characters, defaults to __32__ -`:type` type of string, can be one of: `:human`, `number`, or `:auto` and defaults to __:auto__ +`:type` type of string, can be one of: `:human`, `:numbers`, or `:auto` and defaults to __:auto__ Human type generates strings easier to read by excluding ambiguous characters like `1, 5, 8, B, o, O, I, l, s, u`. From 7ac72b887605a97c912b3e4630a157f498a68d48 Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Wed, 3 Jul 2019 12:57:54 -0400 Subject: [PATCH 3/6] Attempt to update appraisal gemfiles --- .ruby-version | 2 +- Appraisals | 4 +- gemfiles/40.gemfile | 7 ++ gemfiles/40.gemfile.lock | 123 +++++++++++++++++++++++++++++ gemfiles/41.gemfile | 7 ++ gemfiles/41.gemfile.lock | 127 ++++++++++++++++++++++++++++++ gemfiles/42.gemfile | 7 ++ gemfiles/42.gemfile.lock | 153 +++++++++++++++++++++++++++++++++++++ gemfiles/5.0.gemfile | 1 - gemfiles/5.0.gemfile.lock | 28 +++---- gemfiles/5.1.gemfile | 1 - gemfiles/5.1.gemfile.lock | 28 +++---- gemfiles/5.2.gemfile | 1 - gemfiles/5.2.gemfile.lock | 30 ++++---- gemfiles/6.0.gemfile | 3 +- gemfiles/6.0.gemfile.lock | 157 +++++++++++++++++--------------------- 16 files changed, 541 insertions(+), 138 deletions(-) create mode 100644 gemfiles/40.gemfile create mode 100644 gemfiles/40.gemfile.lock create mode 100644 gemfiles/41.gemfile create mode 100644 gemfiles/41.gemfile.lock create mode 100644 gemfiles/42.gemfile create mode 100644 gemfiles/42.gemfile.lock diff --git a/.ruby-version b/.ruby-version index 276cbf9..aedc15b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.0 +2.5.3 diff --git a/Appraisals b/Appraisals index e02d8cd..207631a 100644 --- a/Appraisals +++ b/Appraisals @@ -2,12 +2,10 @@ appraise '40' do gem 'rails', '~> 4.0.0' end - appraise '41' do gem 'rails', '~> 4.1.0' end - appraise '42' do gem 'rails', '~> 4.2.0' end @@ -25,5 +23,5 @@ appraise '5.2' do end appraise '6.0' do - gem 'rails', '6.0.0.beta3' + gem 'rails', '6.0.0.rc1' end diff --git a/gemfiles/40.gemfile b/gemfiles/40.gemfile new file mode 100644 index 0000000..f844fec --- /dev/null +++ b/gemfiles/40.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.0.0" + +gemspec path: "../" diff --git a/gemfiles/40.gemfile.lock b/gemfiles/40.gemfile.lock new file mode 100644 index 0000000..3815d69 --- /dev/null +++ b/gemfiles/40.gemfile.lock @@ -0,0 +1,123 @@ +PATH + remote: .. + specs: + uniqueness (1.1.1) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.0.13) + actionpack (= 4.0.13) + mail (~> 2.5, >= 2.5.4) + actionpack (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + activerecord (4.0.13) + activemodel (= 4.0.13) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.13) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.4) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (4.0.2) + builder (3.1.4) + concurrent-ruby (1.1.5) + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) + diff-lcs (1.3) + docile (1.3.2) + erubis (2.7.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (2.2.0) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + minitest (4.7.5) + multi_json (1.13.1) + rack (1.5.5) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.0.13) + actionmailer (= 4.0.13) + actionpack (= 4.0.13) + activerecord (= 4.0.13) + activesupport (= 4.0.13) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.13) + sprockets-rails (~> 2.0) + railties (4.0.13) + actionpack (= 4.0.13) + activesupport (= 4.0.13) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.20.3) + thread_safe (0.3.6) + tins (1.20.3) + tzinfo (0.3.55) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.17) + coveralls + rails (~> 4.0.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/41.gemfile b/gemfiles/41.gemfile new file mode 100644 index 0000000..f4a887f --- /dev/null +++ b/gemfiles/41.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.1.0" + +gemspec path: "../" diff --git a/gemfiles/41.gemfile.lock b/gemfiles/41.gemfile.lock new file mode 100644 index 0000000..e1425f9 --- /dev/null +++ b/gemfiles/41.gemfile.lock @@ -0,0 +1,127 @@ +PATH + remote: .. + specs: + uniqueness (1.1.1) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + mail (~> 2.5, >= 2.5.4) + actionpack (4.1.16) + actionview (= 4.1.16) + activesupport (= 4.1.16) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionview (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + activerecord (4.1.16) + activemodel (= 4.1.16) + activesupport (= 4.1.16) + arel (~> 5.0.0) + activesupport (4.1.16) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (5.0.1.20140414130214) + builder (3.2.3) + concurrent-ruby (1.1.5) + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) + diff-lcs (1.3) + docile (1.3.2) + erubis (2.7.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (1.8.6) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + minitest (5.11.3) + rack (1.5.5) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.1.16) + actionmailer (= 4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + activemodel (= 4.1.16) + activerecord (= 4.1.16) + activesupport (= 4.1.16) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.16) + sprockets-rails (~> 2.0) + railties (4.1.16) + actionpack (= 4.1.16) + activesupport (= 4.1.16) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.20.3) + thread_safe (0.3.6) + tins (1.20.3) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.17) + coveralls + rails (~> 4.1.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/42.gemfile b/gemfiles/42.gemfile new file mode 100644 index 0000000..6977eb0 --- /dev/null +++ b/gemfiles/42.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.2.0" + +gemspec path: "../" diff --git a/gemfiles/42.gemfile.lock b/gemfiles/42.gemfile.lock new file mode 100644 index 0000000..4fc00d9 --- /dev/null +++ b/gemfiles/42.gemfile.lock @@ -0,0 +1,153 @@ +PATH + remote: .. + specs: + uniqueness (1.1.1) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.11.1) + actionview (= 4.2.11.1) + activesupport (= 4.2.11.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.11.1) + activesupport (= 4.2.11.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.11.1) + activesupport (= 4.2.11.1) + globalid (>= 0.3.0) + activemodel (4.2.11.1) + activesupport (= 4.2.11.1) + builder (~> 3.1) + activerecord (4.2.11.1) + activemodel (= 4.2.11.1) + activesupport (= 4.2.11.1) + arel (~> 6.0) + activesupport (4.2.11.1) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (6.0.4) + builder (3.2.3) + concurrent-ruby (1.1.5) + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) + crass (1.0.4) + diff-lcs (1.3) + docile (1.3.2) + erubis (2.7.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (2.2.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + nokogiri (1.10.3) + mini_portile2 (~> 2.4.0) + rack (1.6.11) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.11.1) + actionmailer (= 4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + activemodel (= 4.2.11.1) + activerecord (= 4.2.11.1) + activesupport (= 4.2.11.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.11.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (4.2.11.1) + actionpack (= 4.2.11.1) + activesupport (= 4.2.11.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.20.3) + thread_safe (0.3.6) + tins (1.20.3) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.17) + coveralls + rails (~> 4.2.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/5.0.gemfile b/gemfiles/5.0.gemfile index 6b40de0..10f52e7 100644 --- a/gemfiles/5.0.gemfile +++ b/gemfiles/5.0.gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" -gem "bundler", "~> 2.0" gem "rails", "~> 5.0.0" gemspec path: "../" diff --git a/gemfiles/5.0.gemfile.lock b/gemfiles/5.0.gemfile.lock index dc49fbf..e8c0f34 100644 --- a/gemfiles/5.0.gemfile.lock +++ b/gemfiles/5.0.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - uniqueness (1.1.0) + uniqueness (1.1.1) activerecord (>= 4.0.0) railties (>= 4.0.0) @@ -52,15 +52,15 @@ GEM arel (7.1.4) builder (3.2.3) concurrent-ruby (1.1.5) - coveralls (0.8.22) + coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) term-ansicolor (~> 1.3) - thor (~> 0.19.4) + thor (>= 0.19.4, < 2.0) tins (~> 1.6) crass (1.0.4) diff-lcs (1.3) - docile (1.3.1) + docile (1.3.2) erubis (2.7.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -77,7 +77,7 @@ GEM mini_portile2 (2.4.0) minitest (5.11.3) nio4r (2.3.1) - nokogiri (1.10.2) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (0.6.3) @@ -110,15 +110,15 @@ GEM rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) + rspec-core (3.8.2) rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-support (3.8.0) + rspec-support (3.8.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -134,21 +134,21 @@ GEM sqlite3 (1.3.13) term-ansicolor (1.7.1) tins (~> 1.0) - thor (0.19.4) + thor (0.20.3) thread_safe (0.3.6) - tins (1.20.2) + tins (1.20.3) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES appraisal - bundler (~> 2.0) + bundler (~> 1.17) coveralls rails (~> 5.0.0) rake (~> 12.0) @@ -157,4 +157,4 @@ DEPENDENCIES uniqueness! BUNDLED WITH - 2.0.1 + 1.17.3 diff --git a/gemfiles/5.1.gemfile b/gemfiles/5.1.gemfile index 599e01b..6100e83 100644 --- a/gemfiles/5.1.gemfile +++ b/gemfiles/5.1.gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" -gem "bundler", "~> 2.0" gem "rails", "~> 5.1.0" gemspec path: "../" diff --git a/gemfiles/5.1.gemfile.lock b/gemfiles/5.1.gemfile.lock index 4beaee1..33ae477 100644 --- a/gemfiles/5.1.gemfile.lock +++ b/gemfiles/5.1.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - uniqueness (1.1.0) + uniqueness (1.1.1) activerecord (>= 4.0.0) railties (>= 4.0.0) @@ -52,15 +52,15 @@ GEM arel (8.0.0) builder (3.2.3) concurrent-ruby (1.1.5) - coveralls (0.8.22) + coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) term-ansicolor (~> 1.3) - thor (~> 0.19.4) + thor (>= 0.19.4, < 2.0) tins (~> 1.6) crass (1.0.4) diff-lcs (1.3) - docile (1.3.1) + docile (1.3.2) erubi (1.8.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -77,7 +77,7 @@ GEM mini_portile2 (2.4.0) minitest (5.11.3) nio4r (2.3.1) - nokogiri (1.10.2) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) @@ -110,15 +110,15 @@ GEM rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) + rspec-core (3.8.2) rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-support (3.8.0) + rspec-support (3.8.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -134,21 +134,21 @@ GEM sqlite3 (1.3.13) term-ansicolor (1.7.1) tins (~> 1.0) - thor (0.19.4) + thor (0.20.3) thread_safe (0.3.6) - tins (1.20.2) + tins (1.20.3) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES appraisal - bundler (~> 2.0) + bundler (~> 1.17) coveralls rails (~> 5.1.0) rake (~> 12.0) @@ -157,4 +157,4 @@ DEPENDENCIES uniqueness! BUNDLED WITH - 2.0.1 + 1.17.3 diff --git a/gemfiles/5.2.gemfile b/gemfiles/5.2.gemfile index 31f3118..5a706dc 100644 --- a/gemfiles/5.2.gemfile +++ b/gemfiles/5.2.gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" -gem "bundler", "~> 2.0" gem "rails", "~> 5.2.0" gemspec path: "../" diff --git a/gemfiles/5.2.gemfile.lock b/gemfiles/5.2.gemfile.lock index ffcfe31..f2fa74e 100644 --- a/gemfiles/5.2.gemfile.lock +++ b/gemfiles/5.2.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - uniqueness (1.1.0) + uniqueness (1.1.1) activerecord (>= 4.0.0) railties (>= 4.0.0) @@ -56,15 +56,15 @@ GEM arel (9.0.0) builder (3.2.3) concurrent-ruby (1.1.5) - coveralls (0.8.22) + coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) term-ansicolor (~> 1.3) - thor (~> 0.19.4) + thor (>= 0.19.4, < 2.0) tins (~> 1.6) crass (1.0.4) diff-lcs (1.3) - docile (1.3.1) + docile (1.3.2) erubi (1.8.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -84,7 +84,7 @@ GEM mini_portile2 (2.4.0) minitest (5.11.3) nio4r (2.3.1) - nokogiri (1.10.2) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) @@ -118,15 +118,15 @@ GEM rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) + rspec-core (3.8.2) rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-support (3.8.0) + rspec-support (3.8.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -142,21 +142,21 @@ GEM sqlite3 (1.3.13) term-ansicolor (1.7.1) tins (~> 1.0) - thor (0.19.4) + thor (0.20.3) thread_safe (0.3.6) - tins (1.20.2) + tins (1.20.3) tzinfo (1.2.5) thread_safe (~> 0.1) - websocket-driver (0.7.0) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES appraisal - bundler (~> 2.0) + bundler (~> 1.17) coveralls rails (~> 5.2.0) rake (~> 12.0) @@ -165,4 +165,4 @@ DEPENDENCIES uniqueness! BUNDLED WITH - 2.0.1 + 1.17.3 diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index bbbbe97..6449f92 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" -gem "bundler", "~> 2.0" -gem "rails", "6.0.0.beta3" +gem "rails", "6.0.0.rc1" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile.lock b/gemfiles/6.0.gemfile.lock index 83472bf..cc09052 100644 --- a/gemfiles/6.0.gemfile.lock +++ b/gemfiles/6.0.gemfile.lock @@ -1,89 +1,86 @@ PATH remote: .. specs: - uniqueness (1.1.0) + uniqueness (1.1.1) activerecord (>= 4.0.0) railties (>= 4.0.0) GEM remote: https://rubygems.org/ specs: - actioncable (6.0.0.beta3) - actionpack (= 6.0.0.beta3) + actioncable (6.0.0.rc1) + actionpack (= 6.0.0.rc1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.0.beta3) - actionpack (= 6.0.0.beta3) - activejob (= 6.0.0.beta3) - activerecord (= 6.0.0.beta3) - activestorage (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) + actionmailbox (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) mail (>= 2.7.1) - actionmailer (6.0.0.beta3) - actionpack (= 6.0.0.beta3) - actionview (= 6.0.0.beta3) - activejob (= 6.0.0.beta3) + actionmailer (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + actionview (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.0.beta3) - actionview (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) + actionpack (6.0.0.rc1) + actionview (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actiontext (6.0.0.beta3) - actionpack (= 6.0.0.beta3) - activerecord (= 6.0.0.beta3) - activestorage (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) + actiontext (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) nokogiri (>= 1.8.5) - actionview (6.0.0.beta3) - activesupport (= 6.0.0.beta3) + actionview (6.0.0.rc1) + activesupport (= 6.0.0.rc1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (6.0.0.beta3) - activesupport (= 6.0.0.beta3) + activejob (6.0.0.rc1) + activesupport (= 6.0.0.rc1) globalid (>= 0.3.6) - activemodel (6.0.0.beta3) - activesupport (= 6.0.0.beta3) - activerecord (6.0.0.beta3) - activemodel (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) - activestorage (6.0.0.beta3) - actionpack (= 6.0.0.beta3) - activerecord (= 6.0.0.beta3) + activemodel (6.0.0.rc1) + activesupport (= 6.0.0.rc1) + activerecord (6.0.0.rc1) + activemodel (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) + activestorage (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) marcel (~> 0.3.1) - activesupport (6.0.0.beta3) + activesupport (6.0.0.rc1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 1.3, >= 1.3.1) + zeitwerk (~> 2.1, >= 2.1.4) appraisal (2.2.0) bundler rake thor (>= 0.14.0) builder (3.2.3) concurrent-ruby (1.1.5) - coveralls (0.7.1) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) crass (1.0.4) diff-lcs (1.3) - docile (1.3.1) - domain_name (0.5.20180417) - unf (>= 0.0.5, < 1.0.0) + docile (1.3.2) erubi (1.8.0) globalid (0.4.2) activesupport (>= 4.2.0) - http-cookie (1.0.3) - domain_name (~> 0.5) i18n (1.6.0) concurrent-ruby (~> 1.0) json (2.2.0) @@ -95,65 +92,56 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) - mime-types (3.2.2) - mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) mimemagic (0.3.3) mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) - multi_json (1.13.1) - netrc (0.11.0) nio4r (2.3.1) - nokogiri (1.10.2) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.0.beta3) - actioncable (= 6.0.0.beta3) - actionmailbox (= 6.0.0.beta3) - actionmailer (= 6.0.0.beta3) - actionpack (= 6.0.0.beta3) - actiontext (= 6.0.0.beta3) - actionview (= 6.0.0.beta3) - activejob (= 6.0.0.beta3) - activemodel (= 6.0.0.beta3) - activerecord (= 6.0.0.beta3) - activestorage (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) + rails (6.0.0.rc1) + actioncable (= 6.0.0.rc1) + actionmailbox (= 6.0.0.rc1) + actionmailer (= 6.0.0.rc1) + actionpack (= 6.0.0.rc1) + actiontext (= 6.0.0.rc1) + actionview (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activemodel (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) bundler (>= 1.3.0) - railties (= 6.0.0.beta3) + railties (= 6.0.0.rc1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (6.0.0.beta3) - actionpack (= 6.0.0.beta3) - activesupport (= 6.0.0.beta3) + railties (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (12.3.2) - rest-client (2.0.2) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) rspec (3.8.0) rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) + rspec-core (3.8.2) rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-support (3.8.0) + rspec-support (3.8.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -171,29 +159,26 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.2) + tins (1.20.3) tzinfo (1.2.5) thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.5) - websocket-driver (0.7.0) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) - zeitwerk (1.4.3) + websocket-extensions (0.1.4) + zeitwerk (2.1.8) PLATFORMS ruby DEPENDENCIES appraisal - bundler (~> 2.0) + bundler (~> 1.17) coveralls - rails (= 6.0.0.beta3) + rails (= 6.0.0.rc1) rake (~> 12.0) rspec sqlite3 (~> 1.3, < 1.4) uniqueness! BUNDLED WITH - 2.0.1 + 1.17.3 From 3f25f020e3285494adbe7c459af857b0c359afaa Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Tue, 22 Oct 2019 12:15:37 -0400 Subject: [PATCH 4/6] Attempt to fix build --- .editorconfig | 12 +++ .ruby-version | 2 +- Appraisals | 2 +- gemfiles/.bundle/config | 2 + gemfiles/4.0.gemfile | 8 -- gemfiles/4.0.gemfile.lock | 123 ----------------------------- gemfiles/4.1.gemfile | 5 -- gemfiles/4.1.gemfile.lock | 127 ------------------------------ gemfiles/4.2.gemfile | 7 -- gemfiles/4.2.gemfile.lock | 153 ------------------------------------ gemfiles/6.0.gemfile | 2 +- gemfiles/6.0.gemfile.lock | 158 +++++++++++++++++++------------------- lib/uniqueness/model.rb | 10 ++- 13 files changed, 103 insertions(+), 508 deletions(-) create mode 100644 .editorconfig create mode 100644 gemfiles/.bundle/config delete mode 100644 gemfiles/4.0.gemfile delete mode 100644 gemfiles/4.0.gemfile.lock delete mode 100644 gemfiles/4.1.gemfile delete mode 100644 gemfiles/4.1.gemfile.lock delete mode 100644 gemfiles/4.2.gemfile delete mode 100644 gemfiles/4.2.gemfile.lock diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c29d6ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{sh,markdown}] +indent_size = 4 \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index aedc15b..437459c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.3 +2.5.0 diff --git a/Appraisals b/Appraisals index 207631a..28b94ca 100644 --- a/Appraisals +++ b/Appraisals @@ -23,5 +23,5 @@ appraise '5.2' do end appraise '6.0' do - gem 'rails', '6.0.0.rc1' + gem 'rails', '~> 6.0.0' end diff --git a/gemfiles/.bundle/config b/gemfiles/.bundle/config new file mode 100644 index 0000000..c127f80 --- /dev/null +++ b/gemfiles/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_RETRY: "1" diff --git a/gemfiles/4.0.gemfile b/gemfiles/4.0.gemfile deleted file mode 100644 index 30087a7..0000000 --- a/gemfiles/4.0.gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 4.0.0" -gem "bundler", '~> 1.11' - -gemspec :path => "../" diff --git a/gemfiles/4.0.gemfile.lock b/gemfiles/4.0.gemfile.lock deleted file mode 100644 index 0f15d36..0000000 --- a/gemfiles/4.0.gemfile.lock +++ /dev/null @@ -1,123 +0,0 @@ -PATH - remote: .. - specs: - uniqueness (1.1.0) - activerecord (>= 4.0.0) - railties (>= 4.0.0) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.0.13) - actionpack (= 4.0.13) - mail (~> 2.5, >= 2.5.4) - actionpack (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activemodel (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - activerecord (4.0.13) - activemodel (= 4.0.13) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.13) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.4) - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (2.2.0) - bundler - rake - thor (>= 0.14.0) - arel (4.0.2) - builder (3.1.4) - concurrent-ruby (1.1.5) - coveralls (0.8.22) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (~> 0.19.4) - tins (~> 1.6) - diff-lcs (1.3) - docile (1.3.1) - erubis (2.7.0) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - json (2.2.0) - mail (2.7.1) - mini_mime (>= 0.1.1) - mini_mime (1.0.1) - minitest (4.7.5) - multi_json (1.13.1) - rack (1.5.5) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.0.13) - actionmailer (= 4.0.13) - actionpack (= 4.0.13) - activerecord (= 4.0.13) - activesupport (= 4.0.13) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.13) - sprockets-rails (~> 2.0) - railties (4.0.13) - actionpack (= 4.0.13) - activesupport (= 4.0.13) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - simplecov (0.16.1) - docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.13) - term-ansicolor (1.7.1) - tins (~> 1.0) - thor (0.19.4) - thread_safe (0.3.6) - tins (1.20.2) - tzinfo (0.3.55) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal - bundler (~> 1.11) - coveralls - rails (~> 4.0.0) - rake (~> 12.0) - rspec - sqlite3 (~> 1.3, < 1.4) - uniqueness! - -BUNDLED WITH - 1.16.6 diff --git a/gemfiles/4.1.gemfile b/gemfiles/4.1.gemfile deleted file mode 100644 index e6387a8..0000000 --- a/gemfiles/4.1.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source "https://rubygems.org" - -gem "rails", "~> 4.1.0" - -gemspec :path => "../" diff --git a/gemfiles/4.1.gemfile.lock b/gemfiles/4.1.gemfile.lock deleted file mode 100644 index 46b7d19..0000000 --- a/gemfiles/4.1.gemfile.lock +++ /dev/null @@ -1,127 +0,0 @@ -PATH - remote: .. - specs: - uniqueness (1.1.0) - activerecord (>= 4.0.0) - railties (>= 4.0.0) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.16) - actionpack (= 4.1.16) - actionview (= 4.1.16) - mail (~> 2.5, >= 2.5.4) - actionpack (4.1.16) - actionview (= 4.1.16) - activesupport (= 4.1.16) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.16) - activesupport (= 4.1.16) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.16) - activesupport (= 4.1.16) - builder (~> 3.1) - activerecord (4.1.16) - activemodel (= 4.1.16) - activesupport (= 4.1.16) - arel (~> 5.0.0) - activesupport (4.1.16) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - appraisal (2.2.0) - bundler - rake - thor (>= 0.14.0) - arel (5.0.1.20140414130214) - builder (3.2.3) - concurrent-ruby (1.1.5) - coveralls (0.8.22) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (~> 0.19.4) - tins (~> 1.6) - diff-lcs (1.3) - docile (1.3.1) - erubis (2.7.0) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - json (1.8.6) - mail (2.7.1) - mini_mime (>= 0.1.1) - mini_mime (1.0.1) - minitest (5.11.3) - rack (1.5.5) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.1.16) - actionmailer (= 4.1.16) - actionpack (= 4.1.16) - actionview (= 4.1.16) - activemodel (= 4.1.16) - activerecord (= 4.1.16) - activesupport (= 4.1.16) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.16) - sprockets-rails (~> 2.0) - railties (4.1.16) - actionpack (= 4.1.16) - activesupport (= 4.1.16) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - simplecov (0.16.1) - docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.13) - term-ansicolor (1.7.1) - tins (~> 1.0) - thor (0.19.4) - thread_safe (0.3.6) - tins (1.20.2) - tzinfo (1.2.5) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal - bundler (~> 1.17) - coveralls - rails (~> 4.1.0) - rake (~> 12.0) - rspec - sqlite3 (~> 1.3, < 1.4) - uniqueness! - -BUNDLED WITH - 1.17.3 diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile deleted file mode 100644 index cd8b45b..0000000 --- a/gemfiles/4.2.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 4.2.0" - -gemspec :path => "../" diff --git a/gemfiles/4.2.gemfile.lock b/gemfiles/4.2.gemfile.lock deleted file mode 100644 index 7fa12a8..0000000 --- a/gemfiles/4.2.gemfile.lock +++ /dev/null @@ -1,153 +0,0 @@ -PATH - remote: .. - specs: - uniqueness (1.1.0) - activerecord (>= 4.0.0) - railties (>= 4.0.0) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activesupport (4.2.11.1) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.2.0) - bundler - rake - thor (>= 0.14.0) - arel (6.0.4) - builder (3.2.3) - concurrent-ruby (1.1.5) - coveralls (0.8.22) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (~> 0.19.4) - tins (~> 1.6) - crass (1.0.4) - diff-lcs (1.3) - docile (1.3.1) - erubis (2.7.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - json (2.2.0) - loofah (2.2.3) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - mini_mime (1.0.1) - mini_portile2 (2.4.0) - minitest (5.11.3) - nokogiri (1.9.1) - mini_portile2 (~> 2.4.0) - rack (1.6.11) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - simplecov (0.16.1) - docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.13) - term-ansicolor (1.7.1) - tins (~> 1.0) - thor (0.19.4) - thread_safe (0.3.6) - tins (1.20.2) - tzinfo (1.2.5) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal - bundler (~> 1.17) - coveralls - rails (~> 4.2.0) - rake (~> 12.0) - rspec - sqlite3 (~> 1.3, < 1.4) - uniqueness! - -BUNDLED WITH - 1.17.3 diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index 6449f92..15b9b27 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "rails", "6.0.0.rc1" +gem "rails", "~> 6.0.0" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile.lock b/gemfiles/6.0.gemfile.lock index cc09052..5cdd232 100644 --- a/gemfiles/6.0.gemfile.lock +++ b/gemfiles/6.0.gemfile.lock @@ -8,61 +8,61 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.0.0.rc1) - actionpack (= 6.0.0.rc1) + actioncable (6.0.0) + actionpack (= 6.0.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionmailbox (6.0.0) + actionpack (= 6.0.0) + activejob (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) mail (>= 2.7.1) - actionmailer (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - actionview (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) + actionmailer (6.0.0) + actionpack (= 6.0.0) + actionview (= 6.0.0) + activejob (= 6.0.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.0.rc1) - actionview (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionpack (6.0.0) + actionview (= 6.0.0) + activesupport (= 6.0.0) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actiontext (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.0) + actionpack (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) nokogiri (>= 1.8.5) - actionview (6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionview (6.0.0) + activesupport (= 6.0.0) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.0) + activesupport (= 6.0.0) globalid (>= 0.3.6) - activemodel (6.0.0.rc1) - activesupport (= 6.0.0.rc1) - activerecord (6.0.0.rc1) - activemodel (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) - activestorage (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) + activemodel (6.0.0) + activesupport (= 6.0.0) + activerecord (6.0.0) + activemodel (= 6.0.0) + activesupport (= 6.0.0) + activestorage (6.0.0) + actionpack (= 6.0.0) + activejob (= 6.0.0) + activerecord (= 6.0.0) marcel (~> 0.3.1) - activesupport (6.0.0.rc1) + activesupport (6.0.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.4) + zeitwerk (~> 2.1, >= 2.1.8) appraisal (2.2.0) bundler rake @@ -75,16 +75,16 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) - erubi (1.8.0) + erubi (1.9.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -93,61 +93,61 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.3) + minitest (5.12.2) + nio4r (2.5.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.0.rc1) - actioncable (= 6.0.0.rc1) - actionmailbox (= 6.0.0.rc1) - actionmailer (= 6.0.0.rc1) - actionpack (= 6.0.0.rc1) - actiontext (= 6.0.0.rc1) - actionview (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activemodel (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails (6.0.0) + actioncable (= 6.0.0) + actionmailbox (= 6.0.0) + actionmailer (= 6.0.0) + actionpack (= 6.0.0) + actiontext (= 6.0.0) + actionview (= 6.0.0) + activejob (= 6.0.0) + activemodel (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) bundler (>= 1.3.0) - railties (= 6.0.0.rc1) + railties (= 6.0.0) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.0) + actionpack (= 6.0.0) + activesupport (= 6.0.0) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -159,13 +159,13 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) - zeitwerk (2.1.8) + zeitwerk (2.2.0) PLATFORMS ruby @@ -174,7 +174,7 @@ DEPENDENCIES appraisal bundler (~> 1.17) coveralls - rails (= 6.0.0.rc1) + rails (~> 6.0.0) rake (~> 12.0) rspec sqlite3 (~> 1.3, < 1.4) diff --git a/lib/uniqueness/model.rb b/lib/uniqueness/model.rb index e89e507..9d6a7df 100644 --- a/lib/uniqueness/model.rb +++ b/lib/uniqueness/model.rb @@ -46,17 +46,21 @@ def has_unique_field(name, options = {}) end validate :uniqueness_validation - define_method("regenerate_#{name}") { update(name => Uniqueness.generate(self.uniqueness_options[name])) } + + define_method("regenerate_#{name}") do + value = Uniqueness.generate(uniqueness_options[name]) + send("#{name}=", value) + end end end # Generates a new code based on given options def uniqueness_generate - self.uniqueness_options.each do |field, options| + uniqueness_options.each do |field, options| value = send(field) unless value.present? value = Uniqueness.generate(options) - self.send("#{field}=", value) + send("#{field}=", value) end end end From 55ae0561bc4710335161c0e82e3bff346beeede3 Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Tue, 22 Oct 2019 12:28:16 -0400 Subject: [PATCH 5/6] Revert "Attempt to fix build" This reverts commit 3f25f020e3285494adbe7c459af857b0c359afaa. --- .editorconfig | 12 --- .ruby-version | 2 +- Appraisals | 2 +- gemfiles/.bundle/config | 2 - gemfiles/4.0.gemfile | 8 ++ gemfiles/4.0.gemfile.lock | 123 +++++++++++++++++++++++++++++ gemfiles/4.1.gemfile | 5 ++ gemfiles/4.1.gemfile.lock | 127 ++++++++++++++++++++++++++++++ gemfiles/4.2.gemfile | 7 ++ gemfiles/4.2.gemfile.lock | 153 ++++++++++++++++++++++++++++++++++++ gemfiles/6.0.gemfile | 2 +- gemfiles/6.0.gemfile.lock | 158 +++++++++++++++++++------------------- lib/uniqueness/model.rb | 10 +-- 13 files changed, 508 insertions(+), 103 deletions(-) delete mode 100644 .editorconfig delete mode 100644 gemfiles/.bundle/config create mode 100644 gemfiles/4.0.gemfile create mode 100644 gemfiles/4.0.gemfile.lock create mode 100644 gemfiles/4.1.gemfile create mode 100644 gemfiles/4.1.gemfile.lock create mode 100644 gemfiles/4.2.gemfile create mode 100644 gemfiles/4.2.gemfile.lock diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index c29d6ab..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.{sh,markdown}] -indent_size = 4 \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index 437459c..aedc15b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.0 +2.5.3 diff --git a/Appraisals b/Appraisals index 28b94ca..207631a 100644 --- a/Appraisals +++ b/Appraisals @@ -23,5 +23,5 @@ appraise '5.2' do end appraise '6.0' do - gem 'rails', '~> 6.0.0' + gem 'rails', '6.0.0.rc1' end diff --git a/gemfiles/.bundle/config b/gemfiles/.bundle/config deleted file mode 100644 index c127f80..0000000 --- a/gemfiles/.bundle/config +++ /dev/null @@ -1,2 +0,0 @@ ---- -BUNDLE_RETRY: "1" diff --git a/gemfiles/4.0.gemfile b/gemfiles/4.0.gemfile new file mode 100644 index 0000000..30087a7 --- /dev/null +++ b/gemfiles/4.0.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.0.0" +gem "bundler", '~> 1.11' + +gemspec :path => "../" diff --git a/gemfiles/4.0.gemfile.lock b/gemfiles/4.0.gemfile.lock new file mode 100644 index 0000000..0f15d36 --- /dev/null +++ b/gemfiles/4.0.gemfile.lock @@ -0,0 +1,123 @@ +PATH + remote: .. + specs: + uniqueness (1.1.0) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.0.13) + actionpack (= 4.0.13) + mail (~> 2.5, >= 2.5.4) + actionpack (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + activerecord (4.0.13) + activemodel (= 4.0.13) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.13) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.4) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (4.0.2) + builder (3.1.4) + concurrent-ruby (1.1.5) + coveralls (0.8.22) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) + diff-lcs (1.3) + docile (1.3.1) + erubis (2.7.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (2.2.0) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + minitest (4.7.5) + multi_json (1.13.1) + rack (1.5.5) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.0.13) + actionmailer (= 4.0.13) + actionpack (= 4.0.13) + activerecord (= 4.0.13) + activesupport (= 4.0.13) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.13) + sprockets-rails (~> 2.0) + railties (4.0.13) + actionpack (= 4.0.13) + activesupport (= 4.0.13) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.20.2) + tzinfo (0.3.55) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.11) + coveralls + rails (~> 4.0.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.16.6 diff --git a/gemfiles/4.1.gemfile b/gemfiles/4.1.gemfile new file mode 100644 index 0000000..e6387a8 --- /dev/null +++ b/gemfiles/4.1.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem "rails", "~> 4.1.0" + +gemspec :path => "../" diff --git a/gemfiles/4.1.gemfile.lock b/gemfiles/4.1.gemfile.lock new file mode 100644 index 0000000..46b7d19 --- /dev/null +++ b/gemfiles/4.1.gemfile.lock @@ -0,0 +1,127 @@ +PATH + remote: .. + specs: + uniqueness (1.1.0) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + mail (~> 2.5, >= 2.5.4) + actionpack (4.1.16) + actionview (= 4.1.16) + activesupport (= 4.1.16) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionview (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + activerecord (4.1.16) + activemodel (= 4.1.16) + activesupport (= 4.1.16) + arel (~> 5.0.0) + activesupport (4.1.16) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (5.0.1.20140414130214) + builder (3.2.3) + concurrent-ruby (1.1.5) + coveralls (0.8.22) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) + diff-lcs (1.3) + docile (1.3.1) + erubis (2.7.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (1.8.6) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + minitest (5.11.3) + rack (1.5.5) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.1.16) + actionmailer (= 4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + activemodel (= 4.1.16) + activerecord (= 4.1.16) + activesupport (= 4.1.16) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.16) + sprockets-rails (~> 2.0) + railties (4.1.16) + actionpack (= 4.1.16) + activesupport (= 4.1.16) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.20.2) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.17) + coveralls + rails (~> 4.1.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile new file mode 100644 index 0000000..cd8b45b --- /dev/null +++ b/gemfiles/4.2.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.2.0" + +gemspec :path => "../" diff --git a/gemfiles/4.2.gemfile.lock b/gemfiles/4.2.gemfile.lock new file mode 100644 index 0000000..7fa12a8 --- /dev/null +++ b/gemfiles/4.2.gemfile.lock @@ -0,0 +1,153 @@ +PATH + remote: .. + specs: + uniqueness (1.1.0) + activerecord (>= 4.0.0) + railties (>= 4.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.11.1) + actionview (= 4.2.11.1) + activesupport (= 4.2.11.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.11.1) + activesupport (= 4.2.11.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.11.1) + activesupport (= 4.2.11.1) + globalid (>= 0.3.0) + activemodel (4.2.11.1) + activesupport (= 4.2.11.1) + builder (~> 3.1) + activerecord (4.2.11.1) + activemodel (= 4.2.11.1) + activesupport (= 4.2.11.1) + arel (~> 6.0) + activesupport (4.2.11.1) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (6.0.4) + builder (3.2.3) + concurrent-ruby (1.1.5) + coveralls (0.8.22) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) + crass (1.0.4) + diff-lcs (1.3) + docile (1.3.1) + erubis (2.7.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + json (2.2.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + nokogiri (1.9.1) + mini_portile2 (~> 2.4.0) + rack (1.6.11) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.11.1) + actionmailer (= 4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + activemodel (= 4.2.11.1) + activerecord (= 4.2.11.1) + activesupport (= 4.2.11.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.11.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (4.2.11.1) + actionpack (= 4.2.11.1) + activesupport (= 4.2.11.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + term-ansicolor (1.7.1) + tins (~> 1.0) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.20.2) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.17) + coveralls + rails (~> 4.2.0) + rake (~> 12.0) + rspec + sqlite3 (~> 1.3, < 1.4) + uniqueness! + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index 15b9b27..6449f92 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "rails", "~> 6.0.0" +gem "rails", "6.0.0.rc1" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile.lock b/gemfiles/6.0.gemfile.lock index 5cdd232..cc09052 100644 --- a/gemfiles/6.0.gemfile.lock +++ b/gemfiles/6.0.gemfile.lock @@ -8,61 +8,61 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.0.0) - actionpack (= 6.0.0) + actioncable (6.0.0.rc1) + actionpack (= 6.0.0.rc1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.0) - actionpack (= 6.0.0) - activejob (= 6.0.0) - activerecord (= 6.0.0) - activestorage (= 6.0.0) - activesupport (= 6.0.0) + actionmailbox (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) mail (>= 2.7.1) - actionmailer (6.0.0) - actionpack (= 6.0.0) - actionview (= 6.0.0) - activejob (= 6.0.0) + actionmailer (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + actionview (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.0) - actionview (= 6.0.0) - activesupport (= 6.0.0) + actionpack (6.0.0.rc1) + actionview (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.0) - actionpack (= 6.0.0) - activerecord (= 6.0.0) - activestorage (= 6.0.0) - activesupport (= 6.0.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actiontext (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) nokogiri (>= 1.8.5) - actionview (6.0.0) - activesupport (= 6.0.0) + actionview (6.0.0.rc1) + activesupport (= 6.0.0.rc1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.0) - activesupport (= 6.0.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (6.0.0.rc1) + activesupport (= 6.0.0.rc1) globalid (>= 0.3.6) - activemodel (6.0.0) - activesupport (= 6.0.0) - activerecord (6.0.0) - activemodel (= 6.0.0) - activesupport (= 6.0.0) - activestorage (6.0.0) - actionpack (= 6.0.0) - activejob (= 6.0.0) - activerecord (= 6.0.0) + activemodel (6.0.0.rc1) + activesupport (= 6.0.0.rc1) + activerecord (6.0.0.rc1) + activemodel (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) + activestorage (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) marcel (~> 0.3.1) - activesupport (6.0.0) + activesupport (6.0.0.rc1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.8) + zeitwerk (~> 2.1, >= 2.1.4) appraisal (2.2.0) bundler rake @@ -75,16 +75,16 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.5) + crass (1.0.4) diff-lcs (1.3) docile (1.3.2) - erubi (1.9.0) + erubi (1.8.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.7.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.3.1) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -93,61 +93,61 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) - mini_mime (1.0.2) + mini_mime (1.0.1) mini_portile2 (2.4.0) - minitest (5.12.2) - nio4r (2.5.2) - nokogiri (1.10.4) + minitest (5.11.3) + nio4r (2.3.1) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.0) - actioncable (= 6.0.0) - actionmailbox (= 6.0.0) - actionmailer (= 6.0.0) - actionpack (= 6.0.0) - actiontext (= 6.0.0) - actionview (= 6.0.0) - activejob (= 6.0.0) - activemodel (= 6.0.0) - activerecord (= 6.0.0) - activestorage (= 6.0.0) - activesupport (= 6.0.0) + rails (6.0.0.rc1) + actioncable (= 6.0.0.rc1) + actionmailbox (= 6.0.0.rc1) + actionmailer (= 6.0.0.rc1) + actionpack (= 6.0.0.rc1) + actiontext (= 6.0.0.rc1) + actionview (= 6.0.0.rc1) + activejob (= 6.0.0.rc1) + activemodel (= 6.0.0.rc1) + activerecord (= 6.0.0.rc1) + activestorage (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) bundler (>= 1.3.0) - railties (= 6.0.0) + railties (= 6.0.0.rc1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.0.0) - actionpack (= 6.0.0) - activesupport (= 6.0.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (6.0.0.rc1) + actionpack (= 6.0.0.rc1) + activesupport (= 6.0.0.rc1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) - rake (12.3.3) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rake (12.3.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (4.0.0) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -159,13 +159,13 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.21.1) + tins (1.20.3) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) - zeitwerk (2.2.0) + zeitwerk (2.1.8) PLATFORMS ruby @@ -174,7 +174,7 @@ DEPENDENCIES appraisal bundler (~> 1.17) coveralls - rails (~> 6.0.0) + rails (= 6.0.0.rc1) rake (~> 12.0) rspec sqlite3 (~> 1.3, < 1.4) diff --git a/lib/uniqueness/model.rb b/lib/uniqueness/model.rb index 9d6a7df..e89e507 100644 --- a/lib/uniqueness/model.rb +++ b/lib/uniqueness/model.rb @@ -46,21 +46,17 @@ def has_unique_field(name, options = {}) end validate :uniqueness_validation - - define_method("regenerate_#{name}") do - value = Uniqueness.generate(uniqueness_options[name]) - send("#{name}=", value) - end + define_method("regenerate_#{name}") { update(name => Uniqueness.generate(self.uniqueness_options[name])) } end end # Generates a new code based on given options def uniqueness_generate - uniqueness_options.each do |field, options| + self.uniqueness_options.each do |field, options| value = send(field) unless value.present? value = Uniqueness.generate(options) - send("#{field}=", value) + self.send("#{field}=", value) end end end From 9e241292d925da80ad94fa8c380389cd2180c312 Mon Sep 17 00:00:00 2001 From: Greg Pardo Date: Tue, 22 Oct 2019 12:36:30 -0400 Subject: [PATCH 6/6] Attempt to fix missing gem file for build --- .editorconfig | 12 +++ .ruby-version | 2 +- Appraisals | 2 +- gemfiles/.bundle/config | 2 + gemfiles/40.gemfile.lock | 28 +++---- gemfiles/41.gemfile.lock | 30 ++++---- gemfiles/42.gemfile.lock | 42 +++++----- gemfiles/5.0.gemfile.lock | 46 +++++------ gemfiles/5.1.gemfile.lock | 48 ++++++------ gemfiles/5.2.gemfile.lock | 48 ++++++------ gemfiles/6.0.gemfile | 2 +- gemfiles/6.0.gemfile.lock | 158 +++++++++++++++++++------------------- lib/uniqueness/model.rb | 10 ++- 13 files changed, 224 insertions(+), 206 deletions(-) create mode 100644 .editorconfig create mode 100644 gemfiles/.bundle/config diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c29d6ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{sh,markdown}] +indent_size = 4 \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index aedc15b..437459c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.3 +2.5.0 diff --git a/Appraisals b/Appraisals index 207631a..28b94ca 100644 --- a/Appraisals +++ b/Appraisals @@ -23,5 +23,5 @@ appraise '5.2' do end appraise '6.0' do - gem 'rails', '6.0.0.rc1' + gem 'rails', '~> 6.0.0' end diff --git a/gemfiles/.bundle/config b/gemfiles/.bundle/config new file mode 100644 index 0000000..c127f80 --- /dev/null +++ b/gemfiles/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_RETRY: "1" diff --git a/gemfiles/40.gemfile.lock b/gemfiles/40.gemfile.lock index 3815d69..35ab684 100644 --- a/gemfiles/40.gemfile.lock +++ b/gemfiles/40.gemfile.lock @@ -53,7 +53,7 @@ GEM json (2.2.0) mail (2.7.1) mini_mime (>= 0.1.1) - mini_mime (1.0.1) + mini_mime (1.0.2) minitest (4.7.5) multi_json (1.13.1) rack (1.5.5) @@ -72,20 +72,20 @@ GEM activesupport (= 4.0.13) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -103,7 +103,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (0.3.55) PLATFORMS diff --git a/gemfiles/41.gemfile.lock b/gemfiles/41.gemfile.lock index e1425f9..fea5a70 100644 --- a/gemfiles/41.gemfile.lock +++ b/gemfiles/41.gemfile.lock @@ -55,8 +55,8 @@ GEM json (1.8.6) mail (2.7.1) mini_mime (>= 0.1.1) - mini_mime (1.0.1) - minitest (5.11.3) + mini_mime (1.0.2) + minitest (5.12.2) rack (1.5.5) rack-test (0.6.3) rack (>= 1.0) @@ -75,20 +75,20 @@ GEM activesupport (= 4.1.16) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -106,7 +106,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) diff --git a/gemfiles/42.gemfile.lock b/gemfiles/42.gemfile.lock index 4fc00d9..d44fa01 100644 --- a/gemfiles/42.gemfile.lock +++ b/gemfiles/42.gemfile.lock @@ -55,7 +55,7 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) erubis (2.7.0) @@ -64,15 +64,15 @@ GEM i18n (0.9.5) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nokogiri (1.10.3) + minitest (5.12.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (1.6.11) rack-test (0.6.3) @@ -94,33 +94,33 @@ GEM activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (4.2.11.1) actionpack (= 4.2.11.1) activesupport (= 4.2.11.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -132,7 +132,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) diff --git a/gemfiles/5.0.gemfile.lock b/gemfiles/5.0.gemfile.lock index e8c0f34..430ec9a 100644 --- a/gemfiles/5.0.gemfile.lock +++ b/gemfiles/5.0.gemfile.lock @@ -58,26 +58,26 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) erubis (2.7.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.3) + minitest (5.12.2) + nio4r (2.5.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (0.6.3) @@ -97,34 +97,34 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.0.7.2) actionpack (= 5.0.7.2) activesupport (= 5.0.7.2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -136,7 +136,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.6.5) diff --git a/gemfiles/5.1.gemfile.lock b/gemfiles/5.1.gemfile.lock index 33ae477..6bf6cd7 100644 --- a/gemfiles/5.1.gemfile.lock +++ b/gemfiles/5.1.gemfile.lock @@ -58,26 +58,26 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) - erubi (1.8.0) + erubi (1.9.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.3) + minitest (5.12.2) + nio4r (2.5.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) @@ -97,34 +97,34 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.1.7) actionpack (= 5.1.7) activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -136,7 +136,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.6.5) diff --git a/gemfiles/5.2.gemfile.lock b/gemfiles/5.2.gemfile.lock index f2fa74e..8545e04 100644 --- a/gemfiles/5.2.gemfile.lock +++ b/gemfiles/5.2.gemfile.lock @@ -62,16 +62,16 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) - erubi (1.8.0) + erubi (1.9.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -80,11 +80,11 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.3) + minitest (5.12.2) + nio4r (2.5.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) @@ -105,34 +105,34 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.2.3) actionpack (= 5.2.3) activesupport (= 5.2.3) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -144,7 +144,7 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.7.1) diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index 6449f92..15b9b27 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "rails", "6.0.0.rc1" +gem "rails", "~> 6.0.0" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile.lock b/gemfiles/6.0.gemfile.lock index cc09052..5cdd232 100644 --- a/gemfiles/6.0.gemfile.lock +++ b/gemfiles/6.0.gemfile.lock @@ -8,61 +8,61 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.0.0.rc1) - actionpack (= 6.0.0.rc1) + actioncable (6.0.0) + actionpack (= 6.0.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionmailbox (6.0.0) + actionpack (= 6.0.0) + activejob (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) mail (>= 2.7.1) - actionmailer (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - actionview (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) + actionmailer (6.0.0) + actionpack (= 6.0.0) + actionview (= 6.0.0) + activejob (= 6.0.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.0.rc1) - actionview (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionpack (6.0.0) + actionview (= 6.0.0) + activesupport (= 6.0.0) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actiontext (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.0) + actionpack (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) nokogiri (>= 1.8.5) - actionview (6.0.0.rc1) - activesupport (= 6.0.0.rc1) + actionview (6.0.0) + activesupport (= 6.0.0) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.0) + activesupport (= 6.0.0) globalid (>= 0.3.6) - activemodel (6.0.0.rc1) - activesupport (= 6.0.0.rc1) - activerecord (6.0.0.rc1) - activemodel (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) - activestorage (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) + activemodel (6.0.0) + activesupport (= 6.0.0) + activerecord (6.0.0) + activemodel (= 6.0.0) + activesupport (= 6.0.0) + activestorage (6.0.0) + actionpack (= 6.0.0) + activejob (= 6.0.0) + activerecord (= 6.0.0) marcel (~> 0.3.1) - activesupport (6.0.0.rc1) + activesupport (6.0.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.4) + zeitwerk (~> 2.1, >= 2.1.8) appraisal (2.2.0) bundler rake @@ -75,16 +75,16 @@ GEM term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - crass (1.0.4) + crass (1.0.5) diff-lcs (1.3) docile (1.3.2) - erubi (1.8.0) + erubi (1.9.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) json (2.2.0) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -93,61 +93,61 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.3) + minitest (5.12.2) + nio4r (2.5.2) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) rack (2.0.7) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.0.rc1) - actioncable (= 6.0.0.rc1) - actionmailbox (= 6.0.0.rc1) - actionmailer (= 6.0.0.rc1) - actionpack (= 6.0.0.rc1) - actiontext (= 6.0.0.rc1) - actionview (= 6.0.0.rc1) - activejob (= 6.0.0.rc1) - activemodel (= 6.0.0.rc1) - activerecord (= 6.0.0.rc1) - activestorage (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails (6.0.0) + actioncable (= 6.0.0) + actionmailbox (= 6.0.0) + actionmailer (= 6.0.0) + actionpack (= 6.0.0) + actiontext (= 6.0.0) + actionview (= 6.0.0) + activejob (= 6.0.0) + activemodel (= 6.0.0) + activerecord (= 6.0.0) + activestorage (= 6.0.0) + activesupport (= 6.0.0) bundler (>= 1.3.0) - railties (= 6.0.0.rc1) + railties (= 6.0.0) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (6.0.0.rc1) - actionpack (= 6.0.0.rc1) - activesupport (= 6.0.0.rc1) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.0) + actionpack (= 6.0.0) + activesupport (= 6.0.0) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) - rake (12.3.2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -159,13 +159,13 @@ GEM tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) - tins (1.20.3) + tins (1.21.1) tzinfo (1.2.5) thread_safe (~> 0.1) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) - zeitwerk (2.1.8) + zeitwerk (2.2.0) PLATFORMS ruby @@ -174,7 +174,7 @@ DEPENDENCIES appraisal bundler (~> 1.17) coveralls - rails (= 6.0.0.rc1) + rails (~> 6.0.0) rake (~> 12.0) rspec sqlite3 (~> 1.3, < 1.4) diff --git a/lib/uniqueness/model.rb b/lib/uniqueness/model.rb index e89e507..9d6a7df 100644 --- a/lib/uniqueness/model.rb +++ b/lib/uniqueness/model.rb @@ -46,17 +46,21 @@ def has_unique_field(name, options = {}) end validate :uniqueness_validation - define_method("regenerate_#{name}") { update(name => Uniqueness.generate(self.uniqueness_options[name])) } + + define_method("regenerate_#{name}") do + value = Uniqueness.generate(uniqueness_options[name]) + send("#{name}=", value) + end end end # Generates a new code based on given options def uniqueness_generate - self.uniqueness_options.each do |field, options| + uniqueness_options.each do |field, options| value = send(field) unless value.present? value = Uniqueness.generate(options) - self.send("#{field}=", value) + send("#{field}=", value) end end end