diff --git a/bridgetown-core/lib/bridgetown-core/commands/plugins.rb b/bridgetown-core/lib/bridgetown-core/commands/plugins.rb index 0e499aa8d..8135b7256 100644 --- a/bridgetown-core/lib/bridgetown-core/commands/plugins.rb +++ b/bridgetown-core/lib/bridgetown-core/commands/plugins.rb @@ -27,15 +27,16 @@ def list pm = site.plugin_manager - plugins_list += pm.class.registered_plugins.reject do |plugin| - plugin.to_s.end_with? "site_builder.rb" + plugins_list += pm.class.registered_plugins.to_a + + plugins_list.reject! do |plugin| + plugin.to_s.end_with?("site_builder.rb") || plugin.to_s == "init (Initializer)" end Bridgetown.logger.info("Registered Plugins:", plugins_list.length.to_s.yellow.bold) plugins_list.each do |plugin| plugin_desc = plugin.to_s - next if plugin_desc.ends_with?("site_builder.rb") || plugin_desc == "init (Initializer)" if plugin.is_a?(Bridgetown::Configuration::Initializer) Bridgetown.logger.info("", plugin_desc) diff --git a/bridgetown-core/test/test_plugins_command.rb b/bridgetown-core/test/test_plugins_command.rb new file mode 100644 index 000000000..3ed09bedc --- /dev/null +++ b/bridgetown-core/test/test_plugins_command.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require "helper" +require_all "bridgetown-core/commands/concerns" +require "bridgetown-core/commands/plugins" + +class TestPluginsCommand < BridgetownUnitTest + context "list registered plugins" do + setup do + fixture_site + @cmd = Bridgetown::Commands::Plugins.new + end + + should "exclude init (Initializer) from registered plugins list" do + out, err = capture_io do + @cmd.invoke(:list) + end + + assert_nil err + refute_includes "init (Initializer)", out + end + + should "exclude init (Initializer) from registered plugins count" do + out, err = capture_io do + @cmd.invoke(:list) + end + + assert_nil err + assert_includes "Registered Plugins: 3", out + end + end +end