Skip to content

Commit

Permalink
fix dist.ini handling of named sections
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Sep 14, 2024
1 parent f07d200 commit 2b8d36b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser/distini.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const parseDistINI = async (content) => {

for (const { section, comment, key, value } of parse(await content)) {
if (section) {
const [, plugin, name] = section.match(/^([^\/]*)(?:\/(.*))?$/);
const [, plugin, name] = section.match(/^([^\/]*?)\s*(?:\/\s*(.*))?$/);

const pack = expandConfigPackageName(plugin);

currentSettings = {};
Expand Down
24 changes: 24 additions & 0 deletions test/action.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,28 @@ describe('GitHub action', function () {
'prereqsJSON': '{"CPAN::Meta":">=2.120900"}',
});
});

it('works with dist.ini', async function () {
const { outputs } = await main({
sources: joinPath(__dirname, 'corpus', 'dist.ini'),
phases: 'author',
relationships: 'requires',
features: '',
exclude: '^inc::',
});
expect(outputs.prereqs).to.be.equal(`
Dist::Zilla~5.0
Dist::Zilla::Plugin::GatherFile
Dist::Zilla::Plugin::Git::GatherDir~5
Dist::Zilla::Plugin::PodWeaver
Dist::Zilla::Plugin::Substitute~3
Dist::Zilla::PluginBundle::Basic~6
Dist::Zilla::PluginBundle::ConfigSlicer
Dist::Zilla::PluginBundle::Filter~2
Dist::Zilla::PluginBundle::Git::VersionManager
Pod::Weaver::Plugin::StopWords
Pod::Weaver::Section::Contributors
Software::License::Perl_5
`.trimStart().replace(/^ */mg, ''));
});
});
3 changes: 3 additions & 0 deletions test/corpus/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ filename = .perlcriticrc
[@ConfigSlicer]
-bundle = @Basic
-remove = Manifest

[Substitute / NamedPlugin]
:version = 3

0 comments on commit 2b8d36b

Please sign in to comment.