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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13e36a1b5f35a339e4111da9623e53eec0009ebe
4
- data.tar.gz: 629d838eb2a302cdb12cc45f247b81105eb5ee07
3
+ metadata.gz: 72e0a9cef8fe8d5f5d1d5e1d45ffc3e643206451
4
+ data.tar.gz: 310a7a7683a3f13efc9508356db7dac15212ae0f
5
5
  SHA512:
6
- metadata.gz: e04939b2fc5a1266dfecdd1e9d6cfd7ad07e42c7a0eb8e7e3d594598be53f37ead9424278f9f90cf1c4032a9c5236d26fe5b8e15af4cfc7bc30f0d086c6ae1f0
7
- data.tar.gz: 45fc2caa49c7352dac77163c7757310cf56476b08933335575fafb11841ec01c8f21112d3452a089fdd43bf00682fd2832c262776318c1cd2c5b8a1883c35ff2
6
+ metadata.gz: af0282a25d822e67dd26a0669bcb98b8ea5fd800efdd468625e6fc2674830f06645cd7f3c41c7031eecc3794a2e72c1ce90e6af49f5789941b1c516f5b872341
7
+ data.tar.gz: 23200cb8731e33487ddf03b3d1342f823cd496639c8ee064a2114f3a83b291c7e489b13d32c8e1dddad1be110440075f1e2dc47f1525534393f19250280b3081
@@ -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
- attr_reader :values
34
+ def update_scope
35
+ return if values == []
36
+ @scope = joins(:uuids).where(uuids_uuids: { value: values }).uniq
37
+ end
53
38
 
54
- def by_uuid
55
- model.joins(:uuids).where(uuids_uuids: { value: values }).uniq
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 "active_record_install"
2
+ require "hexx-active_record"
3
3
 
4
4
  # Initializes the 'uuids' gem inside application.
5
- ActiveRecordInstall::Generator.start(
5
+ Hexx::ActiveRecord::Install.start(
6
6
  [File.expand_path("../..", __FILE__), "uuids"] + ARGV[1..-1]
7
7
  )
@@ -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, class: 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, opts = nil)
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
@@ -33,7 +33,7 @@ module Uuids
33
33
  # records by.
34
34
  # @return [ActiveRecord::Relation] scope.
35
35
  def by_uuid(*values)
36
- Queries::ByUuid.select(self, *values)
36
+ Queries::ByUuid.select(self, values: values)
37
37
  end
38
38
 
39
39
  private
@@ -1,5 +1,5 @@
1
1
  module Uuids
2
2
 
3
3
  # Current release.
4
- VERSION = "4.1.8"
4
+ VERSION = "5.0.0"
5
5
  end
Binary file
@@ -4,9 +4,6 @@
4
4
  require "coveralls"
5
5
  Coveralls.wear! "rails"
6
6
 
7
- # Loads generators
8
- require "active_record_install"
9
-
10
7
  # Loads support files
11
8
  spec = File.expand_path "..", __FILE__
12
9
  Dir[
@@ -30,9 +30,9 @@ describe "$ uuids", :sandbox do
30
30
  end
31
31
  end
32
32
 
33
- describe "-f folder" do
33
+ describe "-d folder" do
34
34
 
35
- before { run_in_sandbox "uuids install -f folder" }
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
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.1.8
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-01 00:00:00.000000000 Z
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: '5.0'
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: '5.0'
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/uuids/bin/uuids_spec.rb
259
- - spec/uuids/lib/base/belongs_by_uuid_to_spec.rb
260
- - spec/uuids/lib/base/has_uuids_spec.rb
261
- - spec/uuids/lib/base_spec.rb
262
- - spec/uuids/models/uuid_spec.rb
263
- - spec/uuids/services/add_spec.rb
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