uuids 4.1.8 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/queries/by_uuid.rb +6 -21
- data/bin/uuids +2 -2
- data/lib/uuids/base.rb +2 -3
- data/lib/uuids/base/has_uuids.rb +1 -1
- data/lib/uuids/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/spec_helper_dev.rb +0 -3
- data/spec/{uuids → tests}/bin/uuids_spec.rb +2 -2
- data/spec/{uuids → tests}/lib/base/belongs_by_uuid_to_spec.rb +0 -0
- data/spec/{uuids → tests}/lib/base/has_uuids_spec.rb +0 -0
- data/spec/{uuids → tests}/lib/base_spec.rb +0 -0
- data/spec/{uuids → tests}/models/uuid_spec.rb +0 -0
- data/spec/{uuids → tests}/services/add_spec.rb +0 -0
- metadata +16 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e0a9cef8fe8d5f5d1d5e1d45ffc3e643206451
|
4
|
+
data.tar.gz: 310a7a7683a3f13efc9508356db7dac15212ae0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0282a25d822e67dd26a0669bcb98b8ea5fd800efdd468625e6fc2674830f06645cd7f3c41c7031eecc3794a2e72c1ce90e6af49f5789941b1c516f5b872341
|
7
|
+
data.tar.gz: 23200cb8731e33487ddf03b3d1342f823cd496639c8ee064a2114f3a83b291c7e489b13d32c8e1dddad1be110440075f1e2dc47f1525534393f19250280b3081
|
data/app/queries/by_uuid.rb
CHANGED
@@ -29,30 +29,15 @@ module Uuids
|
|
29
29
|
# result = ByUuid.select MyModel
|
30
30
|
# result == MyModel.all # => true
|
31
31
|
class ByUuid < Hexx::Scope
|
32
|
-
|
33
|
-
# @api hide
|
34
|
-
# Initializes the query object.
|
35
|
-
# @param [ActiveRecord::Base, #uuids] model The model for selecting
|
36
|
-
# records of.
|
37
|
-
# @param [Array<String>, nil] values The values to select records by.
|
38
|
-
def initialize(model, *values)
|
39
|
-
super(model)
|
40
|
-
@values = values.flatten
|
41
|
-
end
|
42
|
-
|
43
|
-
# @api hide
|
44
|
-
# Runs and returns the query
|
45
|
-
# @return [ActiveRecord::Relation] The updated scope.
|
46
|
-
def select
|
47
|
-
values.any? ? by_uuid : model.all
|
48
|
-
end
|
49
|
-
|
50
32
|
private
|
51
33
|
|
52
|
-
|
34
|
+
def update_scope
|
35
|
+
return if values == []
|
36
|
+
@scope = joins(:uuids).where(uuids_uuids: { value: values }).uniq
|
37
|
+
end
|
53
38
|
|
54
|
-
def
|
55
|
-
|
39
|
+
def values
|
40
|
+
@values ||= Array(options[:values]).flatten.compact
|
56
41
|
end
|
57
42
|
end
|
58
43
|
end
|
data/bin/uuids
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "
|
2
|
+
require "hexx-active_record"
|
3
3
|
|
4
4
|
# Initializes the 'uuids' gem inside application.
|
5
|
-
|
5
|
+
Hexx::ActiveRecord::Install.start(
|
6
6
|
[File.expand_path("../..", __FILE__), "uuids"] + ARGV[1..-1]
|
7
7
|
)
|
data/lib/uuids/base.rb
CHANGED
@@ -58,7 +58,7 @@ module Uuids
|
|
58
58
|
# class City < ActiveRecord::Base
|
59
59
|
# include Uuids::Base
|
60
60
|
#
|
61
|
-
# belongs_by_uuid_to :state
|
61
|
+
# belongs_by_uuid_to :state
|
62
62
|
# end
|
63
63
|
#
|
64
64
|
# city = City.new
|
@@ -74,8 +74,7 @@ module Uuids
|
|
74
74
|
# @param [Hash] options The options for the association.
|
75
75
|
# @option options [Class] :class The model of the attribute.
|
76
76
|
# @option options [String] :class_name The name of the attribute's model.
|
77
|
-
def belongs_by_uuid_to(name
|
78
|
-
warn "[DEPRECATION] .belongs_by_uuid_to options are deprecated" if opts
|
77
|
+
def belongs_by_uuid_to(name)
|
79
78
|
BelongsTo.add self, name
|
80
79
|
end
|
81
80
|
end
|
data/lib/uuids/base/has_uuids.rb
CHANGED
data/lib/uuids/version.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/spec_helper_dev.rb
CHANGED
@@ -30,9 +30,9 @@ describe "$ uuids", :sandbox do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe "-
|
33
|
+
describe "-d folder" do
|
34
34
|
|
35
|
-
before { run_in_sandbox "uuids install -
|
35
|
+
before { run_in_sandbox "uuids install -d folder" }
|
36
36
|
|
37
37
|
it "copies migrations to `folder/db/migrate`" do
|
38
38
|
migrations.each do |migration|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uuids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hexx-active_record
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coveralls
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '4.3'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: hexx-generators
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.2'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.2'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: inch
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,12 +241,12 @@ files:
|
|
255
241
|
- spec/support/runtime/config/database_cleaner.rb
|
256
242
|
- spec/support/runtime/config/factory_girl.rb
|
257
243
|
- spec/support/runtime/config/i18n.rb
|
258
|
-
- spec/
|
259
|
-
- spec/
|
260
|
-
- spec/
|
261
|
-
- spec/
|
262
|
-
- spec/
|
263
|
-
- spec/
|
244
|
+
- spec/tests/bin/uuids_spec.rb
|
245
|
+
- spec/tests/lib/base/belongs_by_uuid_to_spec.rb
|
246
|
+
- spec/tests/lib/base/has_uuids_spec.rb
|
247
|
+
- spec/tests/lib/base_spec.rb
|
248
|
+
- spec/tests/models/uuid_spec.rb
|
249
|
+
- spec/tests/services/add_spec.rb
|
264
250
|
homepage: https://github.com/nepalez/uuids
|
265
251
|
licenses:
|
266
252
|
- MIT
|
@@ -286,14 +272,14 @@ signing_key:
|
|
286
272
|
specification_version: 4
|
287
273
|
summary: UUIDs AR model.
|
288
274
|
test_files:
|
289
|
-
- spec/uuids/models/uuid_spec.rb
|
290
|
-
- spec/uuids/lib/base/belongs_by_uuid_to_spec.rb
|
291
|
-
- spec/uuids/lib/base/has_uuids_spec.rb
|
292
|
-
- spec/uuids/lib/base_spec.rb
|
293
|
-
- spec/uuids/services/add_spec.rb
|
294
|
-
- spec/uuids/bin/uuids_spec.rb
|
295
275
|
- spec/spec_helper_dev.rb
|
296
276
|
- spec/spec_helper.rb
|
277
|
+
- spec/tests/models/uuid_spec.rb
|
278
|
+
- spec/tests/lib/base/belongs_by_uuid_to_spec.rb
|
279
|
+
- spec/tests/lib/base/has_uuids_spec.rb
|
280
|
+
- spec/tests/lib/base_spec.rb
|
281
|
+
- spec/tests/services/add_spec.rb
|
282
|
+
- spec/tests/bin/uuids_spec.rb
|
297
283
|
- spec/dummy/config/environment.rb
|
298
284
|
- spec/dummy/config/database.yml
|
299
285
|
- spec/dummy/config/initializers/seed_loader.rb
|