inventory_refresh 1.1.0 → 2.1.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: ba062c3d0e3f8355def18ece2eab7ad2c9ee6e2eb98420473f4101d2d2945a65
4
+ data.tar.gz: c3fcc1bfc13384de18fc20db6a315f8a9fa8c205153de9b21b7877a9a8e02929
5
5
  SHA512:
6
- metadata.gz: eb24a4daf33a937c914536dd93ad192aaf5a81fb7528888b3d22f12a46c2180634efa7d992a2f810a5c0479f341991080e9d54e115e8e5e7c58b5cc80a917e47
7
- data.tar.gz: 9a0d525bd2df33aa7892d75968c95ac41afcd0a974f5376025e94f2d328097b652e93acc57bba43ed5451c26dd39f8180f6c9429d16ed49a4c09fdb50ada21b1
6
+ metadata.gz: ae6d904a94d75f73699a614f8b3e5dd83f4c53e39874eda2df37c900856da26b16b5d0bdf93917b495de2aef599ab08ad6959c935413a1caa223a114a01c9d11
7
+ data.tar.gz: 784a2b2c2e154bcf6b827a6a51ce7a09d6533dedefea0457313d0efe325284621a5a3a7988393c6b6cb5652909f5c3756269d98dfea0437cfe666e6a858462b6
@@ -14,13 +14,13 @@ jobs:
14
14
  ruby-version:
15
15
  - '2.7'
16
16
  - '3.0'
17
+ - '3.1'
17
18
  rails-version:
18
19
  # rails 6.1 supports ruby >= 2.5
20
+ # rails 7.0 supports ruby >= 2.7
19
21
  - '6.1'
22
+ - '7.0'
20
23
  include:
21
- # rails 5.2 (EOL 6/22) supports ruby < 2.7 (2.6 EOL 3/22)
22
- - ruby-version: '2.5'
23
- rails-version: '5.2'
24
24
  # rails 6.0 (security EOL 6/23?) supports ruby < 2.8 (2.7 EOL 3/23?;)
25
25
  - ruby-version: '2.6'
26
26
  rails-version: '6.0'
@@ -28,7 +28,7 @@ jobs:
28
28
  rails-version: '6.0'
29
29
  services:
30
30
  postgres:
31
- image: manageiq/postgresql:10
31
+ image: manageiq/postgresql:13
32
32
  env:
33
33
  POSTGRESQL_USER: root
34
34
  POSTGRESQL_PASSWORD: smartvm
@@ -42,12 +42,13 @@ jobs:
42
42
  PGPASSWORD: smartvm
43
43
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
44
44
  steps:
45
- - uses: actions/checkout@v2
45
+ - uses: actions/checkout@v4
46
46
  - name: Set up Ruby
47
47
  uses: ruby/setup-ruby@v1
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
@@ -55,4 +56,4 @@ jobs:
55
56
  - name: Report code coverage
56
57
  if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '2.7' && matrix.rails-version == '6.1' }}
57
58
  continue-on-error: true
58
- uses: paambaati/codeclimate-action@v3.0.0
59
+ uses: paambaati/codeclimate-action@v5
data/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.1.0] - 2024-02-08
9
+ ### Changed
10
+ - Update GitHub Actions versions ([#117](https://github.com/ManageIQ/inventory_refresh/pull/117))
11
+ - Update actions/checkout version to v4 ([#118](https://github.com/ManageIQ/inventory_refresh/pull/118))
12
+ - Allow rails 7 gems in gemspec ([#119](https://github.com/ManageIQ/inventory_refresh/pull/119))
13
+
14
+ ## [2.0.0] - 2022-09-06
15
+ ### Added
16
+ - Add timeout-minutes to setup-ruby job (#110)
17
+ - Add ruby3 compliant parameters for lazy_find (#112)
18
+ - Handle two hash arguments to lazy_find (#114)
19
+
20
+ ### Removed
21
+ - **BREAKING** Remove deprecated find_by/lazy_find_by methods
22
+
23
+ ## [1.1.0] - 2022-05-03
24
+ ### Changed
25
+ - Ruby 3 keyword arguments (#109)
26
+
27
+ ### Added
28
+ - Cron for GitHub Actions (#108)
29
+
8
30
  ## [1.0.0] - 2022-02-09
9
31
  ### Changed
10
32
  - Run rubocop -A (#102)
data/Rakefile CHANGED
@@ -20,7 +20,12 @@ namespace :spec do
20
20
 
21
21
  def connection_spec
22
22
  require 'yaml'
23
- @connection_spec ||= YAML.load_file(File.join(__dir__, %w[config database.yml]))
23
+ @connection_spec ||=
24
+ if YAML.respond_to?(:safe_load)
25
+ YAML.safe_load(File.read(File.join(__dir__, %w[config database.yml])), :aliases => true)
26
+ else
27
+ YAML.load_file(File.join(__dir__, %w[config database.yml]))
28
+ end
24
29
  end
25
30
 
26
31
  def test_database_name
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
  spec.metadata['rubygems_mfa_required'] = 'true'
24
24
 
25
- spec.add_dependency "activerecord", ">=5.0", "< 7.0"
25
+ spec.add_dependency "activerecord", ">=5.0", "<7.1"
26
26
  spec.add_dependency "more_core_extensions", ">=3.5", "< 5"
27
27
  spec.add_dependency "pg", "> 0"
28
28
 
@@ -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.1.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.1.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: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.0'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.0'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: more_core_extensions
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -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.4.20
257
+ signing_key:
258
258
  specification_version: 4
259
259
  summary: Topological Inventory Persister
260
260
  test_files: []