diff options
Diffstat (limited to 'vendor/gems')
20 files changed, 268 insertions, 65 deletions
diff --git a/vendor/gems/attr_encrypted/README.md b/vendor/gems/attr_encrypted/README.md index 1a332a2edd5..da0631bb18e 100644 --- a/vendor/gems/attr_encrypted/README.md +++ b/vendor/gems/attr_encrypted/README.md @@ -425,7 +425,7 @@ It is recommended that you implement a strategy to insure that you do not mix th attr_encrypted :ssn, key: :encryption_key, v2_gcm_iv: is_decrypting?(:ssn) def is_decrypting?(attribute) - encrypted_attributes[attribute][:operation] == :decrypting + attr_encrypted_attributes[attribute][:operation] == :decrypting end end diff --git a/vendor/gems/attr_encrypted/lib/attr_encrypted.rb b/vendor/gems/attr_encrypted/lib/attr_encrypted.rb index 88e5f65e3c8..82a14086ade 100644 --- a/vendor/gems/attr_encrypted/lib/attr_encrypted.rb +++ b/vendor/gems/attr_encrypted/lib/attr_encrypted.rb @@ -10,7 +10,7 @@ module AttrEncrypted base.class_eval do include InstanceMethods attr_writer :attr_encrypted_options - @attr_encrypted_options, @encrypted_attributes = {}, {} + @attr_encrypted_options, @attr_encrypted_attributes = {}, {} end end @@ -160,11 +160,11 @@ module AttrEncrypted end define_method(attribute) do - instance_variable_get("@#{attribute}") || instance_variable_set("@#{attribute}", decrypt(attribute, send(encrypted_attribute_name))) + instance_variable_get("@#{attribute}") || instance_variable_set("@#{attribute}", attr_decrypt(attribute, send(encrypted_attribute_name))) end define_method("#{attribute}=") do |value| - send("#{encrypted_attribute_name}=", encrypt(attribute, value)) + send("#{encrypted_attribute_name}=", attr_encrypt(attribute, value)) instance_variable_set("@#{attribute}", value) end @@ -173,7 +173,7 @@ module AttrEncrypted value.respond_to?(:empty?) ? !value.empty? : !!value end - encrypted_attributes[attribute.to_sym] = options.merge(attribute: encrypted_attribute_name) + attr_encrypted_attributes[attribute.to_sym] = options.merge(attribute: encrypted_attribute_name) end end @@ -223,7 +223,7 @@ module AttrEncrypted # User.attr_encrypted?(:name) # false # User.attr_encrypted?(:email) # true def attr_encrypted?(attribute) - encrypted_attributes.has_key?(attribute.to_sym) + attr_encrypted_attributes.has_key?(attribute.to_sym) end # Decrypts a value for the attribute specified @@ -234,9 +234,9 @@ module AttrEncrypted # attr_encrypted :email # end # - # email = User.decrypt(:email, 'SOME_ENCRYPTED_EMAIL_STRING') - def decrypt(attribute, encrypted_value, options = {}) - options = encrypted_attributes[attribute.to_sym].merge(options) + # email = User.attr_decrypt(:email, 'SOME_ENCRYPTED_EMAIL_STRING') + def attr_decrypt(attribute, encrypted_value, options = {}) + options = attr_encrypted_attributes[attribute.to_sym].merge(options) if options[:if] && !options[:unless] && not_empty?(encrypted_value) encrypted_value = encrypted_value.unpack(options[:encode]).first if options[:encode] value = options[:encryptor].send(options[:decrypt_method], options.merge!(value: encrypted_value)) @@ -260,9 +260,9 @@ module AttrEncrypted # attr_encrypted :email # end # - # encrypted_email = User.encrypt(:email, 'test@example.com') - def encrypt(attribute, value, options = {}) - options = encrypted_attributes[attribute.to_sym].merge(options) + # encrypted_email = User.attr_encrypt(:email, 'test@example.com') + def attr_encrypt(attribute, value, options = {}) + options = attr_encrypted_attributes[attribute.to_sym].merge(options) if options[:if] && !options[:unless] && (options[:allow_empty_value] || not_empty?(value)) value = options[:marshal] ? options[:marshaler].send(options[:dump_method], value) : value.to_s encrypted_value = options[:encryptor].send(options[:encrypt_method], options.merge!(value: value)) @@ -286,9 +286,9 @@ module AttrEncrypted # attr_encrypted :email, key: 'my secret key' # end # - # User.encrypted_attributes # { email: { attribute: 'encrypted_email', key: 'my secret key' } } - def encrypted_attributes - @encrypted_attributes ||= superclass.encrypted_attributes.dup + # User.attr_encrypted_attributes # { email: { attribute: 'encrypted_email', key: 'my secret key' } } + def attr_encrypted_attributes + @attr_encrypted_attributes ||= superclass.attr_encrypted_attributes.dup end # Forwards calls to :encrypt_#{attribute} or :decrypt_#{attribute} to the corresponding encrypt or decrypt method @@ -303,7 +303,7 @@ module AttrEncrypted # User.encrypt_email('SOME_ENCRYPTED_EMAIL_STRING') def method_missing(method, *arguments, &block) if method.to_s =~ /^((en|de)crypt)_(.+)$/ && attr_encrypted?($3) - send($1, $3, *arguments) + send("attr_#{$1}", $3, *arguments) else super end @@ -324,11 +324,11 @@ module AttrEncrypted # end # # @user = User.new('some-secret-key') - # @user.decrypt(:email, 'SOME_ENCRYPTED_EMAIL_STRING') - def decrypt(attribute, encrypted_value) - encrypted_attributes[attribute.to_sym][:operation] = :decrypting - encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(encrypted_value) - self.class.decrypt(attribute, encrypted_value, evaluated_attr_encrypted_options_for(attribute)) + # @user.attr_decrypt(:email, 'SOME_ENCRYPTED_EMAIL_STRING') + def attr_decrypt(attribute, encrypted_value) + attr_encrypted_attributes[attribute.to_sym][:operation] = :decrypting + attr_encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(encrypted_value) + self.class.attr_decrypt(attribute, encrypted_value, evaluated_attr_encrypted_options_for(attribute)) end # Encrypts a value for the attribute specified using options evaluated in the current object's scope @@ -345,20 +345,20 @@ module AttrEncrypted # end # # @user = User.new('some-secret-key') - # @user.encrypt(:email, 'test@example.com') - def encrypt(attribute, value) - encrypted_attributes[attribute.to_sym][:operation] = :encrypting - encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(value) - self.class.encrypt(attribute, value, evaluated_attr_encrypted_options_for(attribute)) + # @user.attr_encrypt(:email, 'test@example.com') + def attr_encrypt(attribute, value) + attr_encrypted_attributes[attribute.to_sym][:operation] = :encrypting + attr_encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(value) + self.class.attr_encrypt(attribute, value, evaluated_attr_encrypted_options_for(attribute)) end # Copies the class level hash of encrypted attributes with virtual attribute names as keys # and their corresponding options as values to the instance # - def encrypted_attributes - @encrypted_attributes ||= begin + def attr_encrypted_attributes + @attr_encrypted_attributes ||= begin duplicated= {} - self.class.encrypted_attributes.map { |key, value| duplicated[key] = value.dup } + self.class.attr_encrypted_attributes.map { |key, value| duplicated[key] = value.dup } duplicated end end @@ -368,7 +368,7 @@ module AttrEncrypted # Returns attr_encrypted options evaluated in the current object's scope for the attribute specified def evaluated_attr_encrypted_options_for(attribute) evaluated_options = Hash.new - attributes = encrypted_attributes[attribute.to_sym] + attributes = attr_encrypted_attributes[attribute.to_sym] attribute_option_value = attributes[:attribute] [:if, :unless, :value_present, :allow_empty_value].each do |option| diff --git a/vendor/gems/attr_encrypted/lib/attr_encrypted/adapters/active_record.rb b/vendor/gems/attr_encrypted/lib/attr_encrypted/adapters/active_record.rb index ec8d0208e92..f3c71611b13 100644 --- a/vendor/gems/attr_encrypted/lib/attr_encrypted/adapters/active_record.rb +++ b/vendor/gems/attr_encrypted/lib/attr_encrypted/adapters/active_record.rb @@ -11,7 +11,7 @@ if defined?(ActiveRecord::Base) alias_method :reload_without_attr_encrypted, :reload def reload(*args, &block) result = reload_without_attr_encrypted(*args, &block) - self.class.encrypted_attributes.keys.each do |attribute_name| + self.class.attr_encrypted_attributes.keys.each do |attribute_name| instance_variable_set("@#{attribute_name}", nil) end result @@ -27,8 +27,8 @@ if defined?(ActiveRecord::Base) def perform_attribute_assignment(method, new_attributes, *args) return if new_attributes.blank? - send method, new_attributes.reject { |k, _| self.class.encrypted_attributes.key?(k.to_sym) }, *args - send method, new_attributes.reject { |k, _| !self.class.encrypted_attributes.key?(k.to_sym) }, *args + send method, new_attributes.reject { |k, _| self.class.attr_encrypted_attributes.key?(k.to_sym) }, *args + send method, new_attributes.reject { |k, _| !self.class.attr_encrypted_attributes.key?(k.to_sym) }, *args end private :perform_attribute_assignment @@ -54,7 +54,7 @@ if defined?(ActiveRecord::Base) options = attrs.extract_options! attr = attrs.pop attribute attr if ::ActiveRecord::VERSION::STRING >= "5.1.0" - options.merge! encrypted_attributes[attr] + options.merge! attr_encrypted_attributes[attr] define_method("#{attr}_was") do attribute_was(attr) @@ -125,10 +125,10 @@ if defined?(ActiveRecord::Base) if match = /^(find|scoped)_(all_by|by)_([_a-zA-Z]\w*)$/.match(method.to_s) attribute_names = match.captures.last.split('_and_') attribute_names.each_with_index do |attribute, index| - if attr_encrypted?(attribute) && encrypted_attributes[attribute.to_sym][:mode] == :single_iv_and_salt + if attr_encrypted?(attribute) && attr_encrypted_attributes[attribute.to_sym][:mode] == :single_iv_and_salt args[index] = send("encrypt_#{attribute}", args[index]) warn "DEPRECATION WARNING: This feature will be removed in the next major release." - attribute_names[index] = encrypted_attributes[attribute.to_sym][:attribute] + attribute_names[index] = attr_encrypted_attributes[attribute.to_sym][:attribute] end end method = "#{match.captures[0]}_#{match.captures[1]}_#{attribute_names.join('_and_')}".to_sym diff --git a/vendor/gems/attr_encrypted/test/active_record_test.rb b/vendor/gems/attr_encrypted/test/active_record_test.rb index 4c903bc3cd8..44705989663 100644 --- a/vendor/gems/attr_encrypted/test/active_record_test.rb +++ b/vendor/gems/attr_encrypted/test/active_record_test.rb @@ -89,7 +89,7 @@ class Account < ActiveRecord::Base attr_encrypted :password, key: :password_encryption_key def encrypting?(attr) - encrypted_attributes[attr][:operation] == :encrypting + attr_encrypted_attributes[attr][:operation] == :encrypting end def password_encryption_key @@ -289,14 +289,14 @@ class ActiveRecordTest < Minitest::Test @person = PersonWithProcMode.create(email: 'test@example.com', credentials: 'password123') # Email is :per_attribute_iv_and_salt - assert_equal @person.class.encrypted_attributes[:email][:mode].class, Proc - assert_equal @person.class.encrypted_attributes[:email][:mode].call, :per_attribute_iv_and_salt + assert_equal @person.class.attr_encrypted_attributes[:email][:mode].class, Proc + assert_equal @person.class.attr_encrypted_attributes[:email][:mode].call, :per_attribute_iv_and_salt refute_nil @person.encrypted_email_salt refute_nil @person.encrypted_email_iv # Credentials is :single_iv_and_salt - assert_equal @person.class.encrypted_attributes[:credentials][:mode].class, Proc - assert_equal @person.class.encrypted_attributes[:credentials][:mode].call, :single_iv_and_salt + assert_equal @person.class.attr_encrypted_attributes[:credentials][:mode].class, Proc + assert_equal @person.class.attr_encrypted_attributes[:credentials][:mode].call, :single_iv_and_salt assert_nil @person.encrypted_credentials_salt assert_nil @person.encrypted_credentials_iv end diff --git a/vendor/gems/attr_encrypted/test/attr_encrypted_test.rb b/vendor/gems/attr_encrypted/test/attr_encrypted_test.rb index 84cb130aa50..a57bd773b92 100644 --- a/vendor/gems/attr_encrypted/test/attr_encrypted_test.rb +++ b/vendor/gems/attr_encrypted/test/attr_encrypted_test.rb @@ -82,12 +82,12 @@ class AttrEncryptedTest < Minitest::Test @iv = SecureRandom.random_bytes(12) end - def test_should_store_email_in_encrypted_attributes - assert User.encrypted_attributes.include?(:email) + def test_should_store_email_in_attr_encrypted_attributes + assert User.attr_encrypted_attributes.include?(:email) end - def test_should_not_store_salt_in_encrypted_attributes - refute User.encrypted_attributes.include?(:salt) + def test_should_not_store_salt_in_attr_encrypted_attributes + refute User.attr_encrypted_attributes.include?(:salt) end def test_attr_encrypted_should_return_true_for_email @@ -95,7 +95,7 @@ class AttrEncryptedTest < Minitest::Test end def test_attr_encrypted_should_not_use_the_same_attribute_name_for_two_attributes_in_the_same_line - refute_equal User.encrypted_attributes[:email][:attribute], User.encrypted_attributes[:without_encoding][:attribute] + refute_equal User.attr_encrypted_attributes[:email][:attribute], User.attr_encrypted_attributes[:without_encoding][:attribute] end def test_attr_encrypted_should_return_false_for_salt @@ -154,7 +154,7 @@ class AttrEncryptedTest < Minitest::Test def test_should_decrypt_email_when_reading @user = User.new assert_nil @user.email - options = @user.encrypted_attributes[:email] + options = @user.attr_encrypted_attributes[:email] iv = @user.send(:generate_iv, options[:algorithm]) encoded_iv = [iv].pack(options[:encode_iv]) salt = SecureRandom.random_bytes @@ -222,8 +222,8 @@ class AttrEncryptedTest < Minitest::Test assert_equal encrypted, @user.crypted_password_test end - def test_should_inherit_encrypted_attributes - assert_equal [User.encrypted_attributes.keys, :testing].flatten.collect { |key| key.to_s }.sort, Admin.encrypted_attributes.keys.collect { |key| key.to_s }.sort + def test_should_inherit_attr_encrypted_attributes + assert_equal [User.attr_encrypted_attributes.keys, :testing].flatten.collect { |key| key.to_s }.sort, Admin.attr_encrypted_attributes.keys.collect { |key| key.to_s }.sort end def test_should_inherit_attr_encrypted_options @@ -233,7 +233,7 @@ class AttrEncryptedTest < Minitest::Test def test_should_not_inherit_unrelated_attributes assert SomeOtherClass.attr_encrypted_options.empty? - assert SomeOtherClass.encrypted_attributes.empty? + assert SomeOtherClass.attr_encrypted_attributes.empty? end def test_should_evaluate_a_symbol_option @@ -304,7 +304,7 @@ class AttrEncryptedTest < Minitest::Test end def test_should_work_with_aliased_attr_encryptor - assert User.encrypted_attributes.include?(:aliased) + assert User.attr_encrypted_attributes.include?(:aliased) end def test_should_always_reset_options @@ -381,12 +381,12 @@ class AttrEncryptedTest < Minitest::Test @user2 = User.new @user2.email = 'test@example.com' - assert_equal 'test@example.com', @user1.decrypt(:email, @user1.encrypted_email) + assert_equal 'test@example.com', @user1.attr_decrypt(:email, @user1.encrypted_email) end def test_should_specify_the_default_algorithm - assert YetAnotherClass.encrypted_attributes[:email][:algorithm] - assert_equal YetAnotherClass.encrypted_attributes[:email][:algorithm], 'aes-256-gcm' + assert YetAnotherClass.attr_encrypted_attributes[:email][:algorithm] + assert_equal YetAnotherClass.attr_encrypted_attributes[:email][:algorithm], 'aes-256-gcm' end def test_should_not_encode_iv_when_encode_iv_is_false @@ -475,8 +475,8 @@ class AttrEncryptedTest < Minitest::Test another_user = User.new - assert_equal :encrypting, user.encrypted_attributes[:ssn][:operation] - assert_nil another_user.encrypted_attributes[:ssn][:operation] + assert_equal :encrypting, user.attr_encrypted_attributes[:ssn][:operation] + assert_nil another_user.attr_encrypted_attributes[:ssn][:operation] end def test_should_not_by_default_generate_key_when_attribute_is_empty diff --git a/vendor/gems/attr_encrypted/test/legacy_attr_encrypted_test.rb b/vendor/gems/attr_encrypted/test/legacy_attr_encrypted_test.rb index 875086d2351..608a81970bb 100644 --- a/vendor/gems/attr_encrypted/test/legacy_attr_encrypted_test.rb +++ b/vendor/gems/attr_encrypted/test/legacy_attr_encrypted_test.rb @@ -57,12 +57,12 @@ end class LegacyAttrEncryptedTest < Minitest::Test - def test_should_store_email_in_encrypted_attributes - assert LegacyUser.encrypted_attributes.include?(:email) + def test_should_store_email_in_attr_encrypted_attributes + assert LegacyUser.attr_encrypted_attributes.include?(:email) end - def test_should_not_store_salt_in_encrypted_attributes - assert !LegacyUser.encrypted_attributes.include?(:salt) + def test_should_not_store_salt_in_attr_encrypted_attributes + assert !LegacyUser.attr_encrypted_attributes.include?(:salt) end def test_attr_encrypted_should_return_true_for_email @@ -70,7 +70,7 @@ class LegacyAttrEncryptedTest < Minitest::Test end def test_attr_encrypted_should_not_use_the_same_attribute_name_for_two_attributes_in_the_same_line - refute_equal LegacyUser.encrypted_attributes[:email][:attribute], LegacyUser.encrypted_attributes[:without_encoding][:attribute] + refute_equal LegacyUser.attr_encrypted_attributes[:email][:attribute], LegacyUser.attr_encrypted_attributes[:without_encoding][:attribute] end def test_attr_encrypted_should_return_false_for_salt @@ -200,8 +200,8 @@ class LegacyAttrEncryptedTest < Minitest::Test assert_equal Encryptor.encrypt(:value => 'testing', :key => 'LegacyUser', insecure_mode: true, algorithm: 'aes-256-cbc'), @user.crypted_password_test end - def test_should_inherit_encrypted_attributes - assert_equal [LegacyUser.encrypted_attributes.keys, :testing].flatten.collect { |key| key.to_s }.sort, LegacyAdmin.encrypted_attributes.keys.collect { |key| key.to_s }.sort + def test_should_inherit_attr_encrypted_attributes + assert_equal [LegacyUser.attr_encrypted_attributes.keys, :testing].flatten.collect { |key| key.to_s }.sort, LegacyAdmin.attr_encrypted_attributes.keys.collect { |key| key.to_s }.sort end def test_should_inherit_attr_encrypted_options @@ -211,7 +211,7 @@ class LegacyAttrEncryptedTest < Minitest::Test def test_should_not_inherit_unrelated_attributes assert LegacySomeOtherClass.attr_encrypted_options.empty? - assert LegacySomeOtherClass.encrypted_attributes.empty? + assert LegacySomeOtherClass.attr_encrypted_attributes.empty? end def test_should_evaluate_a_symbol_option @@ -268,7 +268,7 @@ class LegacyAttrEncryptedTest < Minitest::Test end def test_should_work_with_aliased_attr_encryptor - assert LegacyUser.encrypted_attributes.include?(:aliased) + assert LegacyUser.attr_encrypted_attributes.include?(:aliased) end def test_should_always_reset_options diff --git a/vendor/gems/gitlab_active_record/.gitignore b/vendor/gems/gitlab_active_record/.gitignore new file mode 100644 index 00000000000..b04a8c840df --- /dev/null +++ b/vendor/gems/gitlab_active_record/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/vendor/gems/gitlab_active_record/.gitlab-ci.yml b/vendor/gems/gitlab_active_record/.gitlab-ci.yml new file mode 100644 index 00000000000..a1e883119e8 --- /dev/null +++ b/vendor/gems/gitlab_active_record/.gitlab-ci.yml @@ -0,0 +1,28 @@ +workflow: + rules: + - if: $CI_MERGE_REQUEST_ID + +.rspec: + cache: + key: gitlab_active_record-ruby + paths: + - vendor/gems/gitlab_active_record/vendor/ruby + before_script: + - cd vendor/gems/gitlab_active_record + - ruby -v # Print out ruby version for debugging + - gem install bundler --no-document # Bundler is not installed with the image + - bundle config set --local path 'vendor' # Install dependencies into ./vendor/ruby + - bundle config set with 'development' + - bundle config set --local frozen 'true' # Disallow Gemfile.lock changes on CI + - bundle config # Show bundler configuration + - bundle install -j $(nproc) + script: + - bundle exec rspec + +rspec-2.7: + image: "ruby:2.7" + extends: .rspec + +rspec-3.0: + image: "ruby:3.0" + extends: .rspec diff --git a/vendor/gems/gitlab_active_record/.rspec b/vendor/gems/gitlab_active_record/.rspec new file mode 100644 index 00000000000..34c5164d9b5 --- /dev/null +++ b/vendor/gems/gitlab_active_record/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/vendor/gems/gitlab_active_record/Gemfile b/vendor/gems/gitlab_active_record/Gemfile new file mode 100644 index 00000000000..e694fe26c66 --- /dev/null +++ b/vendor/gems/gitlab_active_record/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in gitlab_active_record.gemspec +gemspec diff --git a/vendor/gems/gitlab_active_record/Gemfile.lock b/vendor/gems/gitlab_active_record/Gemfile.lock new file mode 100644 index 00000000000..93aecbc7276 --- /dev/null +++ b/vendor/gems/gitlab_active_record/Gemfile.lock @@ -0,0 +1,54 @@ +PATH + remote: . + specs: + gitlab_active_record (0.1.0) + activerecord (~> 6.1) + activesupport (~> 6.1) + +GEM + remote: https://rubygems.org/ + specs: + activemodel (6.1.7) + activesupport (= 6.1.7) + activerecord (6.1.7) + activemodel (= 6.1.7) + activesupport (= 6.1.7) + activesupport (6.1.7) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + concurrent-ruby (1.1.10) + diff-lcs (1.5.0) + i18n (1.12.0) + concurrent-ruby (~> 1.0) + minitest (5.16.3) + rake (13.0.6) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-mocks (3.11.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-support (3.11.0) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) + zeitwerk (2.6.6) + +PLATFORMS + ruby + +DEPENDENCIES + gitlab_active_record! + rake (~> 13.0) + rspec (~> 3.0) + +BUNDLED WITH + 2.3.26 diff --git a/vendor/gems/gitlab_active_record/LICENSE b/vendor/gems/gitlab_active_record/LICENSE new file mode 100644 index 00000000000..aafb7f79450 --- /dev/null +++ b/vendor/gems/gitlab_active_record/LICENSE @@ -0,0 +1,7 @@ +Copyright 2022 GitLab B.V. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/gems/gitlab_active_record/Rakefile b/vendor/gems/gitlab_active_record/Rakefile new file mode 100644 index 00000000000..b6ae734104e --- /dev/null +++ b/vendor/gems/gitlab_active_record/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/vendor/gems/gitlab_active_record/bin/console b/vendor/gems/gitlab_active_record/bin/console new file mode 100755 index 00000000000..a436c04dd66 --- /dev/null +++ b/vendor/gems/gitlab_active_record/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "gitlab_active_record" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start(__FILE__) diff --git a/vendor/gems/gitlab_active_record/bin/setup b/vendor/gems/gitlab_active_record/bin/setup new file mode 100755 index 00000000000..dce67d860af --- /dev/null +++ b/vendor/gems/gitlab_active_record/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/vendor/gems/gitlab_active_record/gitlab_active_record.gemspec b/vendor/gems/gitlab_active_record/gitlab_active_record.gemspec new file mode 100644 index 00000000000..17e7d8f40d6 --- /dev/null +++ b/vendor/gems/gitlab_active_record/gitlab_active_record.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative "lib/gitlab_active_record/version" + +Gem::Specification.new do |spec| + spec.name = "gitlab_active_record" + spec.version = GitlabActiveRecord::VERSION + spec.authors = ["GitLab"] + spec.email = [""] + + spec.summary = "ActiveRecord patches for CI partitioning" + spec.description = "ActiveRecord patches for CI partitioning" + spec.homepage = "https://gitlab.com/gitlab-org/gitlab" + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-org/gitlab" + + spec.files = Dir.glob("lib/**/*") + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_dependency 'activerecord', '~> 6.1' + spec.add_dependency 'activesupport', '~> 6.1' + + spec.add_development_dependency 'rake', '~> 13.0' + spec.add_development_dependency 'rspec', '~> 3.0' +end diff --git a/vendor/gems/gitlab_active_record/lib/gitlab_active_record.rb b/vendor/gems/gitlab_active_record/lib/gitlab_active_record.rb new file mode 100644 index 00000000000..2ac8c71939f --- /dev/null +++ b/vendor/gems/gitlab_active_record/lib/gitlab_active_record.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require_relative "gitlab_active_record/version" + +module GitlabActiveRecord + class Error < StandardError; end +end diff --git a/vendor/gems/gitlab_active_record/lib/gitlab_active_record/version.rb b/vendor/gems/gitlab_active_record/lib/gitlab_active_record/version.rb new file mode 100644 index 00000000000..d274361efd7 --- /dev/null +++ b/vendor/gems/gitlab_active_record/lib/gitlab_active_record/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module GitlabActiveRecord + VERSION = "0.1.0" +end diff --git a/vendor/gems/gitlab_active_record/spec/gitlab_active_record_spec.rb b/vendor/gems/gitlab_active_record/spec/gitlab_active_record_spec.rb new file mode 100644 index 00000000000..d9263a08dfd --- /dev/null +++ b/vendor/gems/gitlab_active_record/spec/gitlab_active_record_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +RSpec.describe GitlabActiveRecord do + it "has a version number" do + expect(GitlabActiveRecord::VERSION).not_to be nil + end +end diff --git a/vendor/gems/gitlab_active_record/spec/spec_helper.rb b/vendor/gems/gitlab_active_record/spec/spec_helper.rb new file mode 100644 index 00000000000..3cfabb45b1a --- /dev/null +++ b/vendor/gems/gitlab_active_record/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "gitlab_active_record" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end |