Skip to content

Commit

Permalink
allow librarian exclusion declaration as a noop
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed Sep 9, 2024
1 parent c8ec669 commit 2868662
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CHANGELOG

Unreleased
----------
- allow librarian exclusion declaration as a noop

4.1.0
-----
Expand Down
4 changes: 4 additions & 0 deletions lib/r10k/module_loader/puppetfile/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def moduledir(location)
@librarian.set_moduledir(location)
end

def exclusion(name)
# noop
end

def method_missing(method, *args)
raise NoMethodError, _("unrecognized declaration '%{method}'") % {method: method}
end
Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/unit/puppetfile/exclusion/Puppetfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
forge 'https://forgeapi.puppetlabs.com'

mod 'puppetlabs/stdlib', '9.6.0'
exclusion 'emacs' # yuck
8 changes: 8 additions & 0 deletions spec/unit/module_loader/puppetfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ def expect_wrapped_error(error, pf_path, error_type)
end
end

describe 'exclusion declaration' do
it 'is ignored and does not raise an exception' do
@path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'exclusion')
puppetfile = R10K::ModuleLoader::Puppetfile.new(basedir: @path)
puppetfile.load!
end
end

it 'rejects Puppetfiles with duplicate module names' do
@path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'duplicate-module-error')
pf_path = File.join(@path, 'Puppetfile')
Expand Down

0 comments on commit 2868662

Please sign in to comment.