Module: Docscribe::CLI::Generate
- Defined in:
- lib/docscribe/cli/generate.rb
Overview
Generator for TagPlugin and CollectorPlugin boilerplate.
Usage:
docscribe generate tag MyPlugin
docscribe generate collector MyPlugin
docscribe generate tag MyPlugin --output lib/docscribe_plugins
docscribe generate tag MyPlugin --stdout
Constant Summary collapse
- BANNER =
"Usage: docscribe generate <type> <PluginName> [options]\n\nTypes:\n tag Generate a TagPlugin skeleton\n collector Generate a CollectorPlugin skeleton\n\nOptions:\n"- PLUGIN_TYPES =
%w[tag collector].freeze
- NEXT_STEPS_TEMPLATE =
"Next steps:\n 1. Open %<path>s and implement the plugin logic.\n %<hint>s\n\n2. Register the plugin in your docscribe_plugins.rb:\n\n require_relative '%<require_path>s'\n Docscribe::Plugin::Registry.register(%<base_name>s.new)\n\n3. Add the file to docscribe.yml:\n\n plugins:\n require:\n - ./docscribe_plugins\n"
Class Method Summary collapse
-
.run(argv) ⇒ Integer
Run the
generatesubcommand.
Class Method Details
.run(argv) ⇒ Integer
Run the generate subcommand.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/docscribe/cli/generate.rb', line 49 def run(argv) opts, parser = (argv) return 0 if opts[:help] plugin_type, class_name = extract_generate_args(argv) result = validate_generate_args(plugin_type, class_name, parser) return result if result content = render(plugin_type, class_name) dispatch_output(content, plugin_type, class_name, opts) end |