From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- dev-ruby/virtus/Manifest | 4 + dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch | 208 +++++++++++++++++++++ dev-ruby/virtus/metadata.xml | 12 ++ dev-ruby/virtus/virtus-1.0.5.ebuild | 36 ++++ 4 files changed, 260 insertions(+) create mode 100644 dev-ruby/virtus/Manifest create mode 100644 dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch create mode 100644 dev-ruby/virtus/metadata.xml create mode 100644 dev-ruby/virtus/virtus-1.0.5.ebuild (limited to 'dev-ruby/virtus') diff --git a/dev-ruby/virtus/Manifest b/dev-ruby/virtus/Manifest new file mode 100644 index 000000000000..3a728fd5c038 --- /dev/null +++ b/dev-ruby/virtus/Manifest @@ -0,0 +1,4 @@ +AUX virtus-1.0.5-equalizer.patch 8422 SHA256 b788f04d74e82b38796e71f3f80b53f7df3f796801eceafcf86d794d91cd51ec SHA512 70db78b928e1dc23df126bdd081db2664dcf75379e92d3480ad0dad951df9a91d0feaa40de570a6116a71708342d891c073b07395180d85cad50e9e3dd509020 WHIRLPOOL 0e9891a1a5968aee23cd73b03095d6fab65c6fff3d0b4ae04747a36c6f4351225904b0797cd566530197eee8b9eb8aca932002ce91c7bdc87b17bf1712ae61d2 +DIST virtus-1.0.5.gem 49152 SHA256 d3053b9ff62d3f8b7b233f7e1aa9530b73ed7e541bee2c62f2c711362287371a SHA512 468b74d6a49410bb4e59c535b9f7736cd5e4743817f19f97483247b0d259e17b069044bd5ccc787d72df972d37903eb7c9a9d6ca0c6642c550f1c84a3bc71825 WHIRLPOOL 27d48d88e109f883ac20de64821095708769d813998175e50b11e76d8b0fb6e54daa36823f3f780a91d59369911d15d2b65061f753919ea7cdcf3e85753218c0 +EBUILD virtus-1.0.5.ebuild 847 SHA256 55b94150a0dcc6a9a2aeb3068e61538adf70d2861ff9560d30b3827971da20c5 SHA512 dfff28be039371cf3d6e54ec0dab4fc1a20e6d3c61ac7e8c6a81568f5a0b1198f09a0f6f58920d8f2ead21bcbec178f7e5169e71bcf49a1eb74c59301f642ba7 WHIRLPOOL be10ff9f8be443143ca0508daebbfcba1af0502a99100c3e585ac3789969071b33a884292c816dea08810dfbdb866e04f405354d41391d379d0ba3aaf3569944 +MISC metadata.xml 389 SHA256 c5314dd8f875bd67a3d7893a0896b11398dd422a575a6c57b6fc5b3f5ee4ba98 SHA512 b8ce763b943ae56ae0ad2f49f87608d010a39f2a1bd8800572ca799d9ca28e419de8545bc5b3e813e10d0a352fb0e2253d2dd4d0ee601ecea0ec3a98e524c0e4 WHIRLPOOL 3cb781aaa5d925a0ef4796fab2324d3305797064d94b9dc1cd8fffd389c46ae00c72664a182dd124ea7b46ceae8956b63f9acf8950d11230ef502830c27a8669 diff --git a/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch b/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch new file mode 100644 index 000000000000..22fc19298505 --- /dev/null +++ b/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch @@ -0,0 +1,208 @@ +From 5f33f8147fc9d84e69a33758b000486ebe42c8ae Mon Sep 17 00:00:00 2001 +From: Sergey Novik +Date: Sun, 19 Jul 2015 18:11:07 +0300 +Subject: [PATCH 1/3] Add specs for attributes comparison (based on latest + Equalizer gem working version) + +--- + spec/unit/virtus/attribute/comparison_spec.rb | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + create mode 100644 spec/unit/virtus/attribute/comparison_spec.rb + +diff --git a/spec/unit/virtus/attribute/comparison_spec.rb b/spec/unit/virtus/attribute/comparison_spec.rb +new file mode 100644 +index 0000000..0b51a9c +--- /dev/null ++++ b/spec/unit/virtus/attribute/comparison_spec.rb +@@ -0,0 +1,23 @@ ++require 'spec_helper' ++ ++describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do ++ let(:attribute) { described_class.build(String, :name => :name) } ++ ++ # Currently that's the way it works and it happens because default_value objects ++ # don't have equalizer, resulting in attributes object mismatch. ++ # This behavior (and a spec) will need a change in future. ++ it 'returns false when attributes have same type and options' do ++ equal_attribute = described_class.build(String, :name => :name) ++ expect(attribute == equal_attribute).to be_falsey ++ end ++ ++ it 'returns false when attributes have different type' do ++ different_attribute = described_class.build(Integer, :name => :name) ++ expect(attribute == different_attribute).to be_falsey ++ end ++ ++ it 'returns false when attributes have different options' do ++ different_attribute = described_class.build(Integer, :name => :name_two) ++ expect(attribute == different_attribute).to be_falsey ++ end ++end + +From 3748f6eb2cf368d6a78fb1ef50c2724648d96a9b Mon Sep 17 00:00:00 2001 +From: Sergey Novik +Date: Sun, 19 Jul 2015 18:11:24 +0300 +Subject: [PATCH 2/3] Use Virtus::Equalizer instead of Equalizer gem in + Virtus#Attribute (behavior preserved) + +--- + lib/virtus/attribute.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/virtus/attribute.rb b/lib/virtus/attribute.rb +index 999a2ef..0654d4d 100644 +--- a/lib/virtus/attribute.rb ++++ b/lib/virtus/attribute.rb +@@ -18,7 +18,7 @@ module Virtus + class Attribute + extend DescendantsTracker, Options, TypeLookup + +- include ::Equalizer.new(:type, :options) ++ include Equalizer.new(inspect) << :type << :options + + accept_options :primitive, :accessor, :default, :lazy, :strict, :required, :finalize, :nullify_blank + + +From ef57af319334a1d4f3e0860acbde7c6d6f0eb8ef Mon Sep 17 00:00:00 2001 +From: Sergey Novik +Date: Sun, 19 Jul 2015 18:26:50 +0300 +Subject: [PATCH 3/3] Change behavior of Attribute#== method + +By changing Coercer#== and DefaultValue#== methods, we allow +Attribute#== to actually compare objects now (before, every comparison +would return `false` because of different instances of DefaultValue +model in options[:default_value] key. +--- + lib/virtus/attribute/default_value.rb | 2 ++ + lib/virtus/coercer.rb | 1 + + spec/unit/virtus/attribute/comparison_spec.rb | 7 ++----- + spec/unit/virtus/attribute_set/append_spec.rb | 8 ++++---- + spec/unit/virtus/attribute_set/element_set_spec.rb | 22 +++++++++++++++------- + spec/unit/virtus/attribute_set/merge_spec.rb | 8 +++++--- + 6 files changed, 29 insertions(+), 19 deletions(-) + +diff --git a/lib/virtus/attribute/default_value.rb b/lib/virtus/attribute/default_value.rb +index a2fcd31..eca7350 100644 +--- a/lib/virtus/attribute/default_value.rb ++++ b/lib/virtus/attribute/default_value.rb +@@ -7,6 +7,8 @@ class Attribute + class DefaultValue + extend DescendantsTracker + ++ include Equalizer.new(inspect) << :value ++ + # Builds a default value instance + # + # @return [Virtus::Attribute::DefaultValue] +diff --git a/lib/virtus/coercer.rb b/lib/virtus/coercer.rb +index a06e273..676d553 100644 +--- a/lib/virtus/coercer.rb ++++ b/lib/virtus/coercer.rb +@@ -3,6 +3,7 @@ module Virtus + # Abstract coercer class + # + class Coercer ++ include Equalizer.new(inspect) << :primitive << :type + + # @api private + attr_reader :primitive, :type +diff --git a/spec/unit/virtus/attribute/comparison_spec.rb b/spec/unit/virtus/attribute/comparison_spec.rb +index 0b51a9c..796cd20 100644 +--- a/spec/unit/virtus/attribute/comparison_spec.rb ++++ b/spec/unit/virtus/attribute/comparison_spec.rb +@@ -3,12 +3,9 @@ + describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do + let(:attribute) { described_class.build(String, :name => :name) } + +- # Currently that's the way it works and it happens because default_value objects +- # don't have equalizer, resulting in attributes object mismatch. +- # This behavior (and a spec) will need a change in future. +- it 'returns false when attributes have same type and options' do ++ it 'returns true when attributes have same type and options' do + equal_attribute = described_class.build(String, :name => :name) +- expect(attribute == equal_attribute).to be_falsey ++ expect(attribute == equal_attribute).to be_truthy + end + + it 'returns false when attributes have different type' do +diff --git a/spec/unit/virtus/attribute_set/append_spec.rb b/spec/unit/virtus/attribute_set/append_spec.rb +index 7fbb20a..577b07e 100644 +--- a/spec/unit/virtus/attribute_set/append_spec.rb ++++ b/spec/unit/virtus/attribute_set/append_spec.rb +@@ -38,10 +38,10 @@ + + it { is_expected.to equal(object) } + +- it 'replaces the original attribute' do +- expect { subject }.to change { object.to_a }. +- from(attributes). +- to([ attribute ]) ++ it "replaces the original attribute object" do ++ expect { subject }.to change { object.to_a.map(&:__id__) }. ++ from(attributes.map(&:__id__)). ++ to([attribute.__id__]) + end + end + end +diff --git a/spec/unit/virtus/attribute_set/element_set_spec.rb b/spec/unit/virtus/attribute_set/element_set_spec.rb +index 5db7e41..8d9c638 100644 +--- a/spec/unit/virtus/attribute_set/element_set_spec.rb ++++ b/spec/unit/virtus/attribute_set/element_set_spec.rb +@@ -37,20 +37,28 @@ + + it { is_expected.to equal(attribute) } + +- it 'replaces the original attribute' do +- expect { subject }.to change { object.to_a }.from(attributes).to([ attribute ]) ++ it "replaces the original attribute object" do ++ expect { subject }.to change { object.to_a.map(&:__id__) }. ++ from(attributes.map(&:__id__)). ++ to([attribute.__id__]) + end + +- it 'allows #[] to access the attribute with a symbol' do +- expect { subject }.to change { object['name'] }.from(original).to(attribute) ++ it 'allows #[] to access the attribute with a string' do ++ expect { subject }.to change { object['name'].__id__ }. ++ from(original.__id__). ++ to(attribute.__id__) + end + +- it 'allows #[] to access the attribute with a string' do +- expect { subject }.to change { object[:name] }.from(original).to(attribute) ++ it 'allows #[] to access the attribute with a symbol' do ++ expect { subject }.to change { object[:name].__id__ }. ++ from(original.__id__). ++ to(attribute.__id__) + end + + it 'allows #reset to track overridden attributes' do +- expect { subject }.to change { object.reset.to_a }.from(attributes).to([ attribute ]) ++ expect { subject }.to change { object.reset.to_a.map(&:__id__) }. ++ from(attributes.map(&:__id__)). ++ to([attribute.__id__]) + end + end + end +diff --git a/spec/unit/virtus/attribute_set/merge_spec.rb b/spec/unit/virtus/attribute_set/merge_spec.rb +index 72dc39c..9981ece 100644 +--- a/spec/unit/virtus/attribute_set/merge_spec.rb ++++ b/spec/unit/virtus/attribute_set/merge_spec.rb +@@ -21,12 +21,14 @@ + + context 'with a duplicate attribute' do + let(:attributes) { [Virtus::Attribute.build(String, :name => name)] } +- let(:attribute) { Virtus::Attribute.build(String, :name => name) } ++ let(:attribute) { Virtus::Attribute.build(String, :name => name) } + + it { is_expected.to equal(object) } + +- it 'replaces the original attribute' do +- expect { subject }.to change { object.to_a }.from(attributes).to([attribute]) ++ it "replaces the original attribute object" do ++ expect { subject }.to change { object.to_a.map(&:__id__) }. ++ from(attributes.map(&:__id__)). ++ to([attribute.__id__]) + end + end + end diff --git a/dev-ruby/virtus/metadata.xml b/dev-ruby/virtus/metadata.xml new file mode 100644 index 000000000000..fc67007cce91 --- /dev/null +++ b/dev-ruby/virtus/metadata.xml @@ -0,0 +1,12 @@ + + + + + ruby@gentoo.org + Gentoo Ruby Project + + + solnic/virtus + virtus + + diff --git a/dev-ruby/virtus/virtus-1.0.5.ebuild b/dev-ruby/virtus/virtus-1.0.5.ebuild new file mode 100644 index 000000000000..f08cac98e9eb --- /dev/null +++ b/dev-ruby/virtus/virtus-1.0.5.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +USE_RUBY="ruby21 ruby22 ruby23" + +RUBY_FAKEGEM_EXTRADOC="Changelog.md CONTRIBUTING.md README.md" +RUBY_FAKEGEM_RECIPE_TEST="rspec3" +RUBY_FAKEGEM_RECIPE_DOC="yard" + +inherit ruby-fakegem + +DESCRIPTION="Attributes on Steroids for Plain Old Ruby Objects" +HOMEPAGE="https://github.com/solnic/virtus https://rubygems.org/gems/virtus" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="" + +PATCHES=( "${FILESDIR}/${P}-equalizer.patch" ) + +ruby_add_rdepend ">=dev-ruby/axiom-types-0.1 + =dev-ruby/coercible-1.0 + =dev-ruby/descendants_tracker-0.0.3 + =dev-ruby/equalizer-0.0.9 +