semantic_puppet 1.0.3 → 1.0.4

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: e37126b8cf6e3af3f6fb7f7e98ab38223bfd3466edd4eb1bbd99b20f5f4e22f6
4
+ data.tar.gz: 3f200910bfea3ee0d551670d3e35f943e3a64e82e3bcf5e280aec8ce29e292a3
5
5
  SHA512:
6
- metadata.gz: 13fed0e5b789b80a9ed8cb2f1f739d9f77e5d5ebe72a73acd53466c969513f165508c1bd7ce62bfea05cd0f19369f5041992c9e0cf86f17cae3199ec32739fb1
7
- data.tar.gz: e6b4d574369a2f8b82fda07e2ba1847d8bece8665f191e92027121a07d81d01c2bd8e6bb273a71eef435c39e86baa75ab204590c3910061f737d14ef81cf5aa4
6
+ metadata.gz: 16b7f38f0211f02448d3f5bbcd2a880265a8980471cb40d389beb79f85baac2cff960e3a014ab3cf01b74b2b2047e19f7b7a74f6ecb97dc1d9c5230ffd0b2265
7
+ data.tar.gz: b58ccbd2a4cd948cc53201f9f9bc263e2d3d8b4a91f242849292a16867b156e610822c8adf5485b6b97f265a631963c802dec7e68f2483bd0566781b77848f30
data/.travis.yml CHANGED
@@ -22,6 +22,7 @@ rvm:
22
22
  - "2.5.8"
23
23
  - "2.6.6"
24
24
  - "2.7.2"
25
+ - "3.0.0"
25
26
  - "jruby-19mode"
26
27
 
27
28
  jdk:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
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.0.4 - 2021-06-08
6
+ - Remove dependency on SortedSet
7
+ - Add Ruby 3.0 to Travis and AppVeyor
8
+
5
9
  ## 1.0.3 - 2021-01-12
6
10
  - List failed module install dependencies
7
11
  - Add Ruby 2.7 to Travis and AppVeyor
data/appveyor.yml CHANGED
@@ -6,6 +6,7 @@ environment:
6
6
  - RUBY_VERSION: 25-x64
7
7
  - RUBY_VERSION: 26-x64
8
8
  - RUBY_VERSION: 27-x64
9
+ - RUBY_VERSION: 30-x64
9
10
  matrix:
10
11
  fast_finish: true
11
12
  install:
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SemanticPuppet
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -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
 
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.0.4
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: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake