semantic_puppet 1.0.3 → 1.1.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
  SHA256:
3
- metadata.gz: f3c25c681bbdc25c5314544df8ef06c0ddbd3757af6a5de7fd7b4999bce88c17
4
- data.tar.gz: e930096e61ccc839c6ccdf11a1b93e34db1446cc12f3c1bce5b352a307aced4b
3
+ metadata.gz: eea2dc5798bc6407fce6be5c6b5eccac1c6ed181c95e8ee3bcf28f35b42d99a9
4
+ data.tar.gz: 7c28901b6e803c210a14164945fb81a2525f66d536dcffc472c7392b00217bd6
5
5
  SHA512:
6
- metadata.gz: 13fed0e5b789b80a9ed8cb2f1f739d9f77e5d5ebe72a73acd53466c969513f165508c1bd7ce62bfea05cd0f19369f5041992c9e0cf86f17cae3199ec32739fb1
7
- data.tar.gz: e6b4d574369a2f8b82fda07e2ba1847d8bece8665f191e92027121a07d81d01c2bd8e6bb273a71eef435c39e86baa75ab204590c3910061f737d14ef81cf5aa4
6
+ metadata.gz: 93345ca72b239f08ce44b76fa2019831681f5e23c83bb5287191d2e754fc8dd451a76559803200970b778be8b03a91e5ca73c6114d651392036372e3c7c65a1a
7
+ data.tar.gz: 1b0c0670a773a76bc13c1cae7ab782f8b71ac984d480e8e22c45588d1eb40f507e8d91d898d80ddd7e78d4422f5a671b4c2555a7b4f93543eed6e2f8340a271c
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: Mend Monitor
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ mend_monitor:
9
+ if: ${{ github.repository_owner == 'puppetlabs' }}
10
+ runs-on: ubuntu-latest
11
+ name: Mend Monitor
12
+ steps:
13
+ - name: Checkout current PR
14
+ uses: actions/checkout@v3
15
+ - name: Setup Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.7
19
+ - name: Create lock
20
+ run: bundle lock
21
+ - uses: actions/setup-java@v3
22
+ with:
23
+ distribution: 'temurin'
24
+ java-version: '17'
25
+ - name: Download Mend
26
+ run: curl -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
27
+ - name: Run Mend
28
+ run: java -jar wss-unified-agent.jar
29
+ env:
30
+ WS_APIKEY: ${{ secrets.MEND_API_KEY }}
31
+ WS_WSS_URL: https://saas-eu.whitesourcesoftware.com/agent
32
+ WS_USERKEY: ${{ secrets.MEND_TOKEN }}
33
+ WS_PRODUCTNAME: Puppet Agent
34
+ WS_PROJECTNAME: ${{ github.event.repository.name }}
35
+
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: RSpec test
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ jobs:
11
+ rspec_tests:
12
+ name: ${{ matrix.cfg.os }}(ruby ${{ matrix.cfg.ruby }})
13
+ strategy:
14
+ matrix:
15
+ cfg:
16
+ - {os: ubuntu-20.04, ruby: '2.7'}
17
+ - {os: ubuntu-20.04, ruby: '3.0'}
18
+ - {os: ubuntu-20.04, ruby: '3.2'}
19
+ - {os: ubuntu-20.04, ruby: 'jruby-9.4.2'}
20
+ - {os: windows-2019, ruby: '2.7'}
21
+ - {os: windows-2019, ruby: '3.0'}
22
+ - {os: windows-2019, ruby: '3.2'}
23
+
24
+ runs-on: ${{ matrix.cfg.os }}
25
+ steps:
26
+ - name: Checkout current PR
27
+ uses: actions/checkout@v3
28
+
29
+ - name: Install ruby version ${{ matrix.cfg.ruby }}
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.cfg.ruby }}
33
+
34
+ - name: Update rubygems and install gems
35
+ run: |
36
+ gem update --system --silent --no-document
37
+ bundle config set without packaging
38
+ bundle install --jobs 4 --retry 3
39
+
40
+ - run: bundle exec rake spec
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## 1.1.0 - 2023-04-10
6
+ - Fix unsatisfiable if resolve() fails ([ekohl](https://github.com/ekohl))
7
+ - Move from travis/appveyor to GitHub actions ([AriaXLi](https://github.com/AriaXLi))
8
+ - Add Ruby 3.2 testing ([mhashizume](https://github.com/mhashizume))
9
+
10
+ ## 1.0.4 - 2021-06-08
11
+ - Remove dependency on SortedSet
12
+ - Add Ruby 3.0 to Travis and AppVeyor
13
+
5
14
  ## 1.0.3 - 2021-01-12
6
15
  - List failed module install dependencies
7
16
  - Add Ruby 2.7 to Travis and AppVeyor
data/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @puppetlabs/forge-team @puppetlabs/platform-core
1
+ * @puppetlabs/phoenix
data/README.md CHANGED
@@ -19,8 +19,7 @@ This library is used by a number of Puppet Labs projects, including
19
19
  Requirements
20
20
  ------------
21
21
 
22
- Semantic_puppet will work on several ruby versions, including 1.9.3,
23
- 2.0.0, 2.1.9 and 2.4.1. Please see the exact matrix in `.travis.yml`.
22
+ semantic_puppet will work on Ruby version 2.7 and greater.
24
23
 
25
24
  No gem/library requirements.
26
25
 
@@ -33,10 +33,10 @@ module SemanticPuppet
33
33
  end
34
34
 
35
35
  # @api internal
36
- # @return [{ String => SortedSet<GraphNode> }] the satisfactory
36
+ # @return [{ String => Array<GraphNode> }] the satisfactory
37
37
  # dependency nodes
38
38
  def dependencies
39
- @_dependencies ||= Hash.new { |h, k| h[k] = SortedSet.new }
39
+ @_dependencies ||= Hash.new { |h, k| h[k] = Array.new }
40
40
  end
41
41
 
42
42
  # Adds the given dependency name to the list of dependencies.
@@ -99,11 +99,17 @@ module SemanticPuppet
99
99
  end
100
100
 
101
101
  def << (nodes)
102
- Array(nodes).each do |node|
103
- next unless dependencies.key?(node.name)
104
- if satisfies_dependency?(node)
105
- dependencies[node.name] << node
102
+ Array(nodes).group_by(&:name).each_pair do |name, nodes|
103
+ changed = false
104
+ next unless dependencies.key?(name)
105
+
106
+ nodes.each do |node|
107
+ if satisfies_dependency?(node)
108
+ dependencies[name] << node
109
+ changed = true
110
+ end
106
111
  end
112
+ dependencies[name].sort! if changed
107
113
  end
108
114
 
109
115
  return self
@@ -73,7 +73,7 @@ module SemanticPuppet
73
73
  # @param graph [Graph] the root of a dependency graph
74
74
  # @return [Array<ModuleRelease>] the list of releases to act on
75
75
  def resolve(graph)
76
- @module_dependencies, @satisfieds = nil
76
+ @module_dependencies = @satisfieds = nil
77
77
 
78
78
  catch :next do
79
79
  return walk(graph, graph.dependencies.dup)
@@ -120,6 +120,8 @@ module SemanticPuppet
120
120
  name = dependencies.keys.sort.first
121
121
  deps = dependencies.delete(name)
122
122
 
123
+ @module_dependencies |= [name]
124
+
123
125
  # ... (and stepping over it if we've seen it before) ...
124
126
  unless (deps & considering).empty?
125
127
  return walk(graph, dependencies, *considering)
@@ -127,8 +129,6 @@ module SemanticPuppet
127
129
 
128
130
  # ... we'll iterate through the list of possible versions in order.
129
131
  preferred_releases(deps).reverse_each do |dep|
130
- @module_dependencies |= [name]
131
-
132
132
  # We should skip any releases that violate any module's constraints.
133
133
  unless [graph, *considering].all? { |x| x.satisfies_constraints?(dep) }
134
134
  next
@@ -1,3 +1,3 @@
1
1
  module SemanticPuppet
2
- VERSION = '1.0.3'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  # Dependencies
23
- s.required_ruby_version = '>= 1.9.3'
23
+ s.required_ruby_version = '>= 2.7.0'
24
24
 
25
25
  s.add_development_dependency "json", "~> 1.8.3" if RUBY_VERSION < '2.0'
26
26
  s.add_development_dependency "rake"
@@ -68,6 +68,16 @@ describe SemanticPuppet::Dependency::GraphNode do
68
68
  subject << bar3
69
69
  expect(Array(subject.dependencies['bar'])).to be_empty
70
70
  end
71
+
72
+ it 'sorts once the dependencies for a specific node' do
73
+ expect(subject.dependencies['bar']).to receive(:sort!).once
74
+ subject << [bar1, bar2]
75
+ end
76
+
77
+ it 'sorts the dependencies for each addition to the same node' do
78
+ expect(subject.dependencies['bar']).to receive(:sort!).twice
79
+ subject << bar1 << bar2
80
+ end
71
81
  end
72
82
 
73
83
  describe '#satisfied' do
@@ -42,7 +42,10 @@ describe SemanticPuppet::Dependency do
42
42
  context 'with one source' do
43
43
  let(:source) { double('Source', :priority => 0) }
44
44
 
45
- before { SemanticPuppet::Dependency.add_source(source) }
45
+ before do
46
+ SemanticPuppet::Dependency.clear_sources
47
+ SemanticPuppet::Dependency.add_source(source)
48
+ end
46
49
 
47
50
  it 'queries the source for release information' do
48
51
  expect(source).to receive(:fetch).with('module_name').and_return([])
@@ -90,8 +93,8 @@ describe SemanticPuppet::Dependency do
90
93
  )
91
94
 
92
95
  result = SemanticPuppet::Dependency.query('foo' => '1.0.0', 'bar' => '1.0.0')
93
- expect(result.dependencies['foo']).to eql SortedSet.new([ foo ])
94
- expect(result.dependencies['bar']).to eql SortedSet.new([ bar ])
96
+ expect(result.dependencies['foo']).to eql [foo]
97
+ expect(result.dependencies['bar']).to eql [bar]
95
98
  end
96
99
 
97
100
  it 'populates all returned ModuleReleases with related dependencies' do
@@ -102,9 +105,9 @@ describe SemanticPuppet::Dependency do
102
105
  )
103
106
 
104
107
  result = SemanticPuppet::Dependency.query('foo' => '1.0.0')
105
- expect(result.dependencies['foo']).to eql SortedSet.new([ foo ])
106
- expect(foo.dependencies['bar']).to eql SortedSet.new([ bar ])
107
- expect(bar.dependencies['baz']).to eql SortedSet.new([ baz ])
108
+ expect(result.dependencies['foo']).to eql [foo]
109
+ expect(foo.dependencies['bar']).to eql [bar]
110
+ expect(bar.dependencies['baz']).to eql [baz]
108
111
  end
109
112
  end
110
113
 
@@ -244,6 +247,16 @@ describe SemanticPuppet::Dependency do
244
247
  expect { foo('1.1.0') }.to raise_exception with_message
245
248
  expect { foo('1.1.0') }.to raise_exception /\bfoo\b/
246
249
  end
250
+
251
+ it 'sets unsatisfiable' do
252
+ add_source_modules('foo', %w[ 1.1.0 ], 'bar' => '1.x')
253
+ add_source_modules('bar', %w[ 0.0.1 0.1.0-a 0.1.0 ])
254
+
255
+ with_message = /Could not find satisfying releases/
256
+ expect { foo('1.1.0') }.to raise_exception with_message
257
+
258
+ expect(SemanticPuppet::Dependency.unsatisfiable).to eq('foo')
259
+ end
247
260
  end
248
261
  end
249
262
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -102,9 +102,10 @@ executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
+ - ".github/workflows/mend.yaml"
106
+ - ".github/workflows/rspec_tests.yaml"
105
107
  - ".gitignore"
106
108
  - ".rubocop.yml"
107
- - ".travis.yml"
108
109
  - ".yardopts"
109
110
  - CHANGELOG.md
110
111
  - CODEOWNERS
@@ -112,7 +113,6 @@ files:
112
113
  - LICENSE
113
114
  - README.md
114
115
  - Rakefile
115
- - appveyor.yml
116
116
  - lib/semantic_puppet.rb
117
117
  - lib/semantic_puppet/dependency.rb
118
118
  - lib/semantic_puppet/dependency/graph.rb
@@ -145,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - ">="
147
147
  - !ruby/object:Gem::Version
148
- version: 1.9.3
148
+ version: 2.7.0
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubygems_version: 3.0.8
155
+ rubygems_version: 3.0.9
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Useful tools for working with Semantic Versions.
data/.travis.yml DELETED
@@ -1,28 +0,0 @@
1
- ---
2
- language: ruby
3
-
4
- cache: bundler
5
-
6
- before_install:
7
- - bundle -v
8
- - rm Gemfile.lock || true
9
- - gem update --system
10
- - gem update bundler
11
- - gem --version
12
- - bundle -v
13
-
14
- script: "bundle exec rspec --color --format documentation spec/unit"
15
-
16
- notifications:
17
- email: false
18
-
19
- sudo: false
20
-
21
- rvm:
22
- - "2.5.8"
23
- - "2.6.6"
24
- - "2.7.2"
25
- - "jruby-19mode"
26
-
27
- jdk:
28
- - openjdk8
data/appveyor.yml DELETED
@@ -1,19 +0,0 @@
1
- version: 1.0.1.{build}
2
- clone_depth: 10
3
- image: Visual Studio 2019
4
- environment:
5
- matrix:
6
- - RUBY_VERSION: 25-x64
7
- - RUBY_VERSION: 26-x64
8
- - RUBY_VERSION: 27-x64
9
- matrix:
10
- fast_finish: true
11
- install:
12
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
13
- - bundle install --jobs 4 --retry 2
14
- build: off
15
- test_script:
16
- - ruby -v
17
- - gem -v
18
- - bundle -v
19
- - bundle exec rspec --format documentation --color spec/unit