1 |
commit: bf31401641760c2c5c7bbbf971fa73d658a0b900 |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Apr 18 17:49:33 2017 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 18 17:50:00 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf314016 |
7 |
|
8 |
dev-ruby/virtus: initial import of 1.0.5 |
9 |
|
10 |
Package-Manager: Portage-2.3.3, Repoman-2.3.1 |
11 |
|
12 |
dev-ruby/virtus/Manifest | 1 + |
13 |
dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch | 208 +++++++++++++++++++++ |
14 |
dev-ruby/virtus/metadata.xml | 11 ++ |
15 |
dev-ruby/virtus/virtus-1.0.5.ebuild | 36 ++++ |
16 |
4 files changed, 256 insertions(+) |
17 |
|
18 |
diff --git a/dev-ruby/virtus/Manifest b/dev-ruby/virtus/Manifest |
19 |
new file mode 100644 |
20 |
index 00000000000..3112e5418cf |
21 |
--- /dev/null |
22 |
+++ b/dev-ruby/virtus/Manifest |
23 |
@@ -0,0 +1 @@ |
24 |
+DIST virtus-1.0.5.gem 49152 SHA256 d3053b9ff62d3f8b7b233f7e1aa9530b73ed7e541bee2c62f2c711362287371a SHA512 468b74d6a49410bb4e59c535b9f7736cd5e4743817f19f97483247b0d259e17b069044bd5ccc787d72df972d37903eb7c9a9d6ca0c6642c550f1c84a3bc71825 WHIRLPOOL 27d48d88e109f883ac20de64821095708769d813998175e50b11e76d8b0fb6e54daa36823f3f780a91d59369911d15d2b65061f753919ea7cdcf3e85753218c0 |
25 |
|
26 |
diff --git a/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch b/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch |
27 |
new file mode 100644 |
28 |
index 00000000000..22fc1929850 |
29 |
--- /dev/null |
30 |
+++ b/dev-ruby/virtus/files/virtus-1.0.5-equalizer.patch |
31 |
@@ -0,0 +1,208 @@ |
32 |
+From 5f33f8147fc9d84e69a33758b000486ebe42c8ae Mon Sep 17 00:00:00 2001 |
33 |
+From: Sergey Novik <konnigun@×××××.com> |
34 |
+Date: Sun, 19 Jul 2015 18:11:07 +0300 |
35 |
+Subject: [PATCH 1/3] Add specs for attributes comparison (based on latest |
36 |
+ Equalizer gem working version) |
37 |
+ |
38 |
+--- |
39 |
+ spec/unit/virtus/attribute/comparison_spec.rb | 23 +++++++++++++++++++++++ |
40 |
+ 1 file changed, 23 insertions(+) |
41 |
+ create mode 100644 spec/unit/virtus/attribute/comparison_spec.rb |
42 |
+ |
43 |
+diff --git a/spec/unit/virtus/attribute/comparison_spec.rb b/spec/unit/virtus/attribute/comparison_spec.rb |
44 |
+new file mode 100644 |
45 |
+index 0000000..0b51a9c |
46 |
+--- /dev/null |
47 |
++++ b/spec/unit/virtus/attribute/comparison_spec.rb |
48 |
+@@ -0,0 +1,23 @@ |
49 |
++require 'spec_helper' |
50 |
++ |
51 |
++describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do |
52 |
++ let(:attribute) { described_class.build(String, :name => :name) } |
53 |
++ |
54 |
++ # Currently that's the way it works and it happens because default_value objects |
55 |
++ # don't have equalizer, resulting in attributes object mismatch. |
56 |
++ # This behavior (and a spec) will need a change in future. |
57 |
++ it 'returns false when attributes have same type and options' do |
58 |
++ equal_attribute = described_class.build(String, :name => :name) |
59 |
++ expect(attribute == equal_attribute).to be_falsey |
60 |
++ end |
61 |
++ |
62 |
++ it 'returns false when attributes have different type' do |
63 |
++ different_attribute = described_class.build(Integer, :name => :name) |
64 |
++ expect(attribute == different_attribute).to be_falsey |
65 |
++ end |
66 |
++ |
67 |
++ it 'returns false when attributes have different options' do |
68 |
++ different_attribute = described_class.build(Integer, :name => :name_two) |
69 |
++ expect(attribute == different_attribute).to be_falsey |
70 |
++ end |
71 |
++end |
72 |
+ |
73 |
+From 3748f6eb2cf368d6a78fb1ef50c2724648d96a9b Mon Sep 17 00:00:00 2001 |
74 |
+From: Sergey Novik <konnigun@×××××.com> |
75 |
+Date: Sun, 19 Jul 2015 18:11:24 +0300 |
76 |
+Subject: [PATCH 2/3] Use Virtus::Equalizer instead of Equalizer gem in |
77 |
+ Virtus#Attribute (behavior preserved) |
78 |
+ |
79 |
+--- |
80 |
+ lib/virtus/attribute.rb | 2 +- |
81 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
82 |
+ |
83 |
+diff --git a/lib/virtus/attribute.rb b/lib/virtus/attribute.rb |
84 |
+index 999a2ef..0654d4d 100644 |
85 |
+--- a/lib/virtus/attribute.rb |
86 |
++++ b/lib/virtus/attribute.rb |
87 |
+@@ -18,7 +18,7 @@ module Virtus |
88 |
+ class Attribute |
89 |
+ extend DescendantsTracker, Options, TypeLookup |
90 |
+ |
91 |
+- include ::Equalizer.new(:type, :options) |
92 |
++ include Equalizer.new(inspect) << :type << :options |
93 |
+ |
94 |
+ accept_options :primitive, :accessor, :default, :lazy, :strict, :required, :finalize, :nullify_blank |
95 |
+ |
96 |
+ |
97 |
+From ef57af319334a1d4f3e0860acbde7c6d6f0eb8ef Mon Sep 17 00:00:00 2001 |
98 |
+From: Sergey Novik <konnigun@×××××.com> |
99 |
+Date: Sun, 19 Jul 2015 18:26:50 +0300 |
100 |
+Subject: [PATCH 3/3] Change behavior of Attribute#== method |
101 |
+ |
102 |
+By changing Coercer#== and DefaultValue#== methods, we allow |
103 |
+Attribute#== to actually compare objects now (before, every comparison |
104 |
+would return `false` because of different instances of DefaultValue |
105 |
+model in options[:default_value] key. |
106 |
+--- |
107 |
+ lib/virtus/attribute/default_value.rb | 2 ++ |
108 |
+ lib/virtus/coercer.rb | 1 + |
109 |
+ spec/unit/virtus/attribute/comparison_spec.rb | 7 ++----- |
110 |
+ spec/unit/virtus/attribute_set/append_spec.rb | 8 ++++---- |
111 |
+ spec/unit/virtus/attribute_set/element_set_spec.rb | 22 +++++++++++++++------- |
112 |
+ spec/unit/virtus/attribute_set/merge_spec.rb | 8 +++++--- |
113 |
+ 6 files changed, 29 insertions(+), 19 deletions(-) |
114 |
+ |
115 |
+diff --git a/lib/virtus/attribute/default_value.rb b/lib/virtus/attribute/default_value.rb |
116 |
+index a2fcd31..eca7350 100644 |
117 |
+--- a/lib/virtus/attribute/default_value.rb |
118 |
++++ b/lib/virtus/attribute/default_value.rb |
119 |
+@@ -7,6 +7,8 @@ class Attribute |
120 |
+ class DefaultValue |
121 |
+ extend DescendantsTracker |
122 |
+ |
123 |
++ include Equalizer.new(inspect) << :value |
124 |
++ |
125 |
+ # Builds a default value instance |
126 |
+ # |
127 |
+ # @return [Virtus::Attribute::DefaultValue] |
128 |
+diff --git a/lib/virtus/coercer.rb b/lib/virtus/coercer.rb |
129 |
+index a06e273..676d553 100644 |
130 |
+--- a/lib/virtus/coercer.rb |
131 |
++++ b/lib/virtus/coercer.rb |
132 |
+@@ -3,6 +3,7 @@ module Virtus |
133 |
+ # Abstract coercer class |
134 |
+ # |
135 |
+ class Coercer |
136 |
++ include Equalizer.new(inspect) << :primitive << :type |
137 |
+ |
138 |
+ # @api private |
139 |
+ attr_reader :primitive, :type |
140 |
+diff --git a/spec/unit/virtus/attribute/comparison_spec.rb b/spec/unit/virtus/attribute/comparison_spec.rb |
141 |
+index 0b51a9c..796cd20 100644 |
142 |
+--- a/spec/unit/virtus/attribute/comparison_spec.rb |
143 |
++++ b/spec/unit/virtus/attribute/comparison_spec.rb |
144 |
+@@ -3,12 +3,9 @@ |
145 |
+ describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do |
146 |
+ let(:attribute) { described_class.build(String, :name => :name) } |
147 |
+ |
148 |
+- # Currently that's the way it works and it happens because default_value objects |
149 |
+- # don't have equalizer, resulting in attributes object mismatch. |
150 |
+- # This behavior (and a spec) will need a change in future. |
151 |
+- it 'returns false when attributes have same type and options' do |
152 |
++ it 'returns true when attributes have same type and options' do |
153 |
+ equal_attribute = described_class.build(String, :name => :name) |
154 |
+- expect(attribute == equal_attribute).to be_falsey |
155 |
++ expect(attribute == equal_attribute).to be_truthy |
156 |
+ end |
157 |
+ |
158 |
+ it 'returns false when attributes have different type' do |
159 |
+diff --git a/spec/unit/virtus/attribute_set/append_spec.rb b/spec/unit/virtus/attribute_set/append_spec.rb |
160 |
+index 7fbb20a..577b07e 100644 |
161 |
+--- a/spec/unit/virtus/attribute_set/append_spec.rb |
162 |
++++ b/spec/unit/virtus/attribute_set/append_spec.rb |
163 |
+@@ -38,10 +38,10 @@ |
164 |
+ |
165 |
+ it { is_expected.to equal(object) } |
166 |
+ |
167 |
+- it 'replaces the original attribute' do |
168 |
+- expect { subject }.to change { object.to_a }. |
169 |
+- from(attributes). |
170 |
+- to([ attribute ]) |
171 |
++ it "replaces the original attribute object" do |
172 |
++ expect { subject }.to change { object.to_a.map(&:__id__) }. |
173 |
++ from(attributes.map(&:__id__)). |
174 |
++ to([attribute.__id__]) |
175 |
+ end |
176 |
+ end |
177 |
+ end |
178 |
+diff --git a/spec/unit/virtus/attribute_set/element_set_spec.rb b/spec/unit/virtus/attribute_set/element_set_spec.rb |
179 |
+index 5db7e41..8d9c638 100644 |
180 |
+--- a/spec/unit/virtus/attribute_set/element_set_spec.rb |
181 |
++++ b/spec/unit/virtus/attribute_set/element_set_spec.rb |
182 |
+@@ -37,20 +37,28 @@ |
183 |
+ |
184 |
+ it { is_expected.to equal(attribute) } |
185 |
+ |
186 |
+- it 'replaces the original attribute' do |
187 |
+- expect { subject }.to change { object.to_a }.from(attributes).to([ attribute ]) |
188 |
++ it "replaces the original attribute object" do |
189 |
++ expect { subject }.to change { object.to_a.map(&:__id__) }. |
190 |
++ from(attributes.map(&:__id__)). |
191 |
++ to([attribute.__id__]) |
192 |
+ end |
193 |
+ |
194 |
+- it 'allows #[] to access the attribute with a symbol' do |
195 |
+- expect { subject }.to change { object['name'] }.from(original).to(attribute) |
196 |
++ it 'allows #[] to access the attribute with a string' do |
197 |
++ expect { subject }.to change { object['name'].__id__ }. |
198 |
++ from(original.__id__). |
199 |
++ to(attribute.__id__) |
200 |
+ end |
201 |
+ |
202 |
+- it 'allows #[] to access the attribute with a string' do |
203 |
+- expect { subject }.to change { object[:name] }.from(original).to(attribute) |
204 |
++ it 'allows #[] to access the attribute with a symbol' do |
205 |
++ expect { subject }.to change { object[:name].__id__ }. |
206 |
++ from(original.__id__). |
207 |
++ to(attribute.__id__) |
208 |
+ end |
209 |
+ |
210 |
+ it 'allows #reset to track overridden attributes' do |
211 |
+- expect { subject }.to change { object.reset.to_a }.from(attributes).to([ attribute ]) |
212 |
++ expect { subject }.to change { object.reset.to_a.map(&:__id__) }. |
213 |
++ from(attributes.map(&:__id__)). |
214 |
++ to([attribute.__id__]) |
215 |
+ end |
216 |
+ end |
217 |
+ end |
218 |
+diff --git a/spec/unit/virtus/attribute_set/merge_spec.rb b/spec/unit/virtus/attribute_set/merge_spec.rb |
219 |
+index 72dc39c..9981ece 100644 |
220 |
+--- a/spec/unit/virtus/attribute_set/merge_spec.rb |
221 |
++++ b/spec/unit/virtus/attribute_set/merge_spec.rb |
222 |
+@@ -21,12 +21,14 @@ |
223 |
+ |
224 |
+ context 'with a duplicate attribute' do |
225 |
+ let(:attributes) { [Virtus::Attribute.build(String, :name => name)] } |
226 |
+- let(:attribute) { Virtus::Attribute.build(String, :name => name) } |
227 |
++ let(:attribute) { Virtus::Attribute.build(String, :name => name) } |
228 |
+ |
229 |
+ it { is_expected.to equal(object) } |
230 |
+ |
231 |
+- it 'replaces the original attribute' do |
232 |
+- expect { subject }.to change { object.to_a }.from(attributes).to([attribute]) |
233 |
++ it "replaces the original attribute object" do |
234 |
++ expect { subject }.to change { object.to_a.map(&:__id__) }. |
235 |
++ from(attributes.map(&:__id__)). |
236 |
++ to([attribute.__id__]) |
237 |
+ end |
238 |
+ end |
239 |
+ end |
240 |
|
241 |
diff --git a/dev-ruby/virtus/metadata.xml b/dev-ruby/virtus/metadata.xml |
242 |
new file mode 100644 |
243 |
index 00000000000..41b027deb73 |
244 |
--- /dev/null |
245 |
+++ b/dev-ruby/virtus/metadata.xml |
246 |
@@ -0,0 +1,11 @@ |
247 |
+<?xml version="1.0" encoding="UTF-8"?> |
248 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
249 |
+<pkgmetadata> |
250 |
+ <maintainer type="project"> |
251 |
+ <email>ruby@g.o</email> |
252 |
+ <name>Gentoo Ruby Project</name> |
253 |
+ </maintainer> |
254 |
+ <upstream> |
255 |
+ <remote-id type="github">solnic/virtus</remote-id> |
256 |
+ </upstream> |
257 |
+</pkgmetadata> |
258 |
|
259 |
diff --git a/dev-ruby/virtus/virtus-1.0.5.ebuild b/dev-ruby/virtus/virtus-1.0.5.ebuild |
260 |
new file mode 100644 |
261 |
index 00000000000..f08cac98e9e |
262 |
--- /dev/null |
263 |
+++ b/dev-ruby/virtus/virtus-1.0.5.ebuild |
264 |
@@ -0,0 +1,36 @@ |
265 |
+# Copyright 1999-2017 Gentoo Foundation |
266 |
+# Distributed under the terms of the GNU General Public License v2 |
267 |
+ |
268 |
+EAPI=6 |
269 |
+ |
270 |
+USE_RUBY="ruby21 ruby22 ruby23" |
271 |
+ |
272 |
+RUBY_FAKEGEM_EXTRADOC="Changelog.md CONTRIBUTING.md README.md" |
273 |
+RUBY_FAKEGEM_RECIPE_TEST="rspec3" |
274 |
+RUBY_FAKEGEM_RECIPE_DOC="yard" |
275 |
+ |
276 |
+inherit ruby-fakegem |
277 |
+ |
278 |
+DESCRIPTION="Attributes on Steroids for Plain Old Ruby Objects" |
279 |
+HOMEPAGE="https://github.com/solnic/virtus https://rubygems.org/gems/virtus" |
280 |
+ |
281 |
+LICENSE="MIT" |
282 |
+SLOT="0" |
283 |
+KEYWORDS="~amd64" |
284 |
+IUSE="" |
285 |
+ |
286 |
+PATCHES=( "${FILESDIR}/${P}-equalizer.patch" ) |
287 |
+ |
288 |
+ruby_add_rdepend ">=dev-ruby/axiom-types-0.1 |
289 |
+ <dev-ruby/axiom-types-1 |
290 |
+ >=dev-ruby/coercible-1.0 |
291 |
+ <dev-ruby/coercible-2 |
292 |
+ >=dev-ruby/descendants_tracker-0.0.3 |
293 |
+ <dev-ruby/descendants_tracker-1 |
294 |
+ >=dev-ruby/equalizer-0.0.9 |
295 |
+ <dev-ruby/equalizer-1" |
296 |
+ |
297 |
+ruby_add_bdepend "test? ( |
298 |
+ dev-ruby/inflecto |
299 |
+ dev-ruby/bogus |
300 |
+)" |