Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dependency cycles #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/librarian/puppet/action/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def check_specfile
# don't fail if Puppetfile doesn't exist as we'll use the Modulefile or metadata.json
end

def sorted_manifests
lock.manifests
end

end
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/librarian/puppet/action/resolve.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'librarian/action/resolve'
require 'librarian/puppet/resolver'

module Librarian
module Puppet
Expand All @@ -15,6 +16,10 @@ def run
end
end

def resolver
Resolver.new(environment, cyclic: true)
end

end
end
end
Expand Down
14 changes: 14 additions & 0 deletions lib/librarian/puppet/lockfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ class << manifests_index
super(lines, manifests_index)
end

def compile(sources_ast)
manifests = compile_placeholder_manifests(sources_ast)
manifests = manifests.map do |name, manifest|
dependencies = manifest.dependencies.map do |d|
environment.dsl_class.dependency_type.new(d.name, d.requirement, manifests[d.name].source)
end
real = Manifest.new(manifest.source, manifest.name)
real.version = manifest.version
real.dependencies = manifest.dependencies
real
end
manifests.sort_by(&:name)
end

end

def load(string)
Expand Down
14 changes: 14 additions & 0 deletions lib/librarian/puppet/resolver.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'librarian/resolver'

module Librarian
module Puppet
class Resolver < Librarian::Resolver

def sort(manifests)
manifests = manifests.values if Hash === manifests
manifests.sort_by(&:name)
end

end
end
end