inventory_refresh 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3393dbd829d48263fc51a06fa2c659045239142f4f325a2c894296eb640045d
4
- data.tar.gz: eea18674f3145f38ead40f221d62cb158e66174860509c4bc669713a1b7f2bb7
3
+ metadata.gz: 3230d7d712cf1e8ca4c20f070dae17686b8f879b34a4eb7cd59eafa00705ee44
4
+ data.tar.gz: 1242373300c55514fc0f3795826712babda1cc5d14983d0273c63e1214515ea9
5
5
  SHA512:
6
- metadata.gz: eb24a4daf33a937c914536dd93ad192aaf5a81fb7528888b3d22f12a46c2180634efa7d992a2f810a5c0479f341991080e9d54e115e8e5e7c58b5cc80a917e47
7
- data.tar.gz: 9a0d525bd2df33aa7892d75968c95ac41afcd0a974f5376025e94f2d328097b652e93acc57bba43ed5451c26dd39f8180f6c9429d16ed49a4c09fdb50ada21b1
6
+ metadata.gz: f1e9aaccce8ca7179137b24eeba2f8bacc2d7c0401891ff6fbdbf03d99786c4bcfa65cb5bf81b461a7edfe5a62de8b21ee00ab8007e326c6afcf8debc685a616
7
+ data.tar.gz: fbf7e26bdb0d42e50253fdb9f70734a299c5f30df3fa64b6a05d68f2c80e6a8e1c06dbec902a1a3845e860cf86dd6add8931cf9ef809055534b327b370a2f375
@@ -48,6 +48,7 @@ jobs:
48
48
  with:
49
49
  ruby-version: ${{ matrix.ruby-version }}
50
50
  bundler-cache: true
51
+ timeout-minutes: 30
51
52
  - name: Prepare tests
52
53
  run: bundle exec rake spec:setup
53
54
  - name: Run tests
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.0] - 2022-09-06
9
+ ### Added
10
+ - Add timeout-minutes to setup-ruby job (#110)
11
+ - Add ruby3 compliant parameters for lazy_find (#112)
12
+ - Handle two hash arguments to lazy_find (#114)
13
+
14
+ ### Removed
15
+ - **BREAKING** Remove deprecated find_by/lazy_find_by methods
16
+
17
+ ## [1.1.0] - 2022-05-03
18
+ ### Changed
19
+ - Ruby 3 keyword arguments (#109)
20
+
21
+ ### Added
22
+ - Cron for GitHub Actions (#108)
23
+
8
24
  ## [1.0.0] - 2022-02-09
9
25
  ### Changed
10
26
  - Run rubocop -A (#102)
@@ -3,6 +3,7 @@ require "inventory_refresh/inventory_collection/index/type/local_db"
3
3
  require "inventory_refresh/inventory_collection/index/type/skeletal"
4
4
  require "inventory_refresh/logging"
5
5
  require "active_support/core_ext/module/delegation"
6
+ require "active_support/deprecation"
6
7
 
7
8
  module InventoryRefresh
8
9
  class InventoryCollection
@@ -77,7 +78,6 @@ module InventoryRefresh
77
78
  end
78
79
 
79
80
  def find(reference, ref: primary_index_ref)
80
- # TODO(lsmola) lazy_find will support only hash, then we can remove the _by variant
81
81
  # TODO(lsmola) this method should return lazy too, the rest of the finders should be deprecated
82
82
  return if reference.nil?
83
83
 
@@ -95,22 +95,25 @@ module InventoryRefresh
95
95
  end
96
96
  end
97
97
 
98
- def find_by(manager_uuid_hash, ref: primary_index_ref)
99
- # TODO(lsmola) deprecate this, it's enough to have find method
100
- find(manager_uuid_hash, :ref => ref)
101
- end
98
+ def lazy_find(manager_uuid = nil, opts = {}, ref: primary_index_ref, key: nil, default: nil, transform_nested_lazy_finds: false, **manager_uuid_hash)
99
+ # TODO(lsmola) also, it should be enough to have only 1 find method, everything can be lazy, until we try to
100
+ # access the data
102
101
 
103
- def lazy_find_by(manager_uuid_hash, ref: primary_index_ref, key: nil, default: nil)
104
- # TODO(lsmola) deprecate this, it's enough to have lazy_find method
102
+ ref = opts[:ref] if opts.key?(:ref)
103
+ key = opts[:key] if opts.key?(:key)
104
+ default = opts[:default] if opts.key?(:default)
105
+ transform_nested_lazy_finds = opts[:transform_nested_lazy_finds] if opts.key?(:transform_nested_lazy_finds)
105
106
 
106
- lazy_find(manager_uuid_hash, :ref => ref, :key => key, :default => default)
107
- end
107
+ manager_uuid_hash.update(opts.except(:ref, :key, :default, :transform_nested_lazy_finds))
108
108
 
109
- def lazy_find(manager_uuid, ref: primary_index_ref, key: nil, default: nil, transform_nested_lazy_finds: false)
110
- # TODO(lsmola) also, it should be enough to have only 1 find method, everything can be lazy, until we try to
111
- # access the data
112
- # TODO(lsmola) lazy_find will support only hash, then we can remove the _by variant
113
- return if manager_uuid.nil?
109
+ # Skip if no manager_uuid is provided
110
+ return if manager_uuid.nil? && manager_uuid_hash.blank?
111
+
112
+ raise ArgumentError, "only one of manager_uuid or manager_uuid_hash must be passed" unless !!manager_uuid ^ !!manager_uuid_hash.present?
113
+
114
+ ActiveSupport::Deprecation.warn("Passing a hash for options is deprecated and will be removed in an upcoming release.") if opts.present?
115
+
116
+ manager_uuid ||= manager_uuid_hash
114
117
 
115
118
  assert_index(manager_uuid, ref)
116
119
 
@@ -1,3 +1,3 @@
1
1
  module InventoryRefresh
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inventory_refresh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-03 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -163,7 +163,7 @@ dependencies:
163
163
  - !ruby/object:Gem::Version
164
164
  version: 0.21.2
165
165
  description: Topological Inventory Persister
166
- email:
166
+ email:
167
167
  executables: []
168
168
  extensions: []
169
169
  extra_rdoc_files: []
@@ -238,7 +238,7 @@ licenses:
238
238
  - Apache-2.0
239
239
  metadata:
240
240
  rubygems_mfa_required: 'true'
241
- post_install_message:
241
+ post_install_message:
242
242
  rdoc_options: []
243
243
  require_paths:
244
244
  - lib
@@ -253,8 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  - !ruby/object:Gem::Version
254
254
  version: '0'
255
255
  requirements: []
256
- rubygems_version: 3.3.5
257
- signing_key:
256
+ rubygems_version: 3.3.15
257
+ signing_key:
258
258
  specification_version: 4
259
259
  summary: Topological Inventory Persister
260
260
  test_files: []