Skip to content

Commit

Permalink
Merge pull request #1400 from jhoblitt/feature/support-exclusion
Browse files Browse the repository at this point in the history
allow librarian exclusion declaration as a noop
  • Loading branch information
justinstoller authored Dec 2, 2024
2 parents 3f06dc6 + 2868662 commit a316bd4
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

- Add Ruby 3.3 to CI [#1403](https://github.com/puppetlabs/r10k/pull/1403)
- Require Ruby 3.1 [#1402](https://github.com/puppetlabs/r10k/pull/1402)
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 a316bd4

Please sign in to comment.