lib/nanoc/cli/commands/show-plugins.rb in nanoc-3.7.4 vs lib/nanoc/cli/commands/show-plugins.rb in nanoc-3.7.5
- old
+ new
@@ -7,13 +7,11 @@
Show a list of available plugins, including filters, data sources and VCSes.
If the current directory contains a nanoc web site, the plugins defined in this site will be shown as well.
EOS
module Nanoc::CLI::Commands
-
class ShowPlugins < ::Nanoc::CLI::CommandRunner
-
def run
# Check arguments
if arguments.size != 0
raise Nanoc::Errors::GenericTrivial, "usage: #{command.usage}"
end
@@ -33,12 +31,12 @@
end
max_identifiers_length = plugin_with_longest_identifiers[:identifiers].join(', ').size
PLUGIN_CLASS_ORDER.each do |superclass|
plugins_with_this_superclass = {
- :builtin => plugins_builtin.select { |p| p[:superclass] == superclass },
- :custom => plugins_custom.select { |p| p[:superclass] == superclass }
+ builtin: plugins_builtin.select { |p| p[:superclass] == superclass },
+ custom: plugins_custom.select { |p| p[:superclass] == superclass }
}
# Print kind
kind = name_for_plugin_class(superclass)
puts "#{kind}:"
@@ -57,11 +55,11 @@
end
# Print plugins
relevant_plugins.sort_by { |k| k[:identifiers].join(', ') }.each do |plugin|
# Display
- puts sprintf(
+ puts format(
" %-#{max_identifiers_length}s (%s)",
plugin[:identifiers].join(', '),
plugin[:class].to_s.sub(/^::/, '')
)
end
@@ -88,11 +86,9 @@
} unless defined? PLUGIN_CLASSES
def name_for_plugin_class(klass)
PLUGIN_CLASSES[klass]
end
-
end
-
end
runner Nanoc::CLI::Commands::ShowPlugins