Class: Esp::CLI::Docs
- Inherits:
-
Thor
- Object
- Thor
- Esp::CLI::Docs
- Includes:
- Support
- Defined in:
- lib/esp/cli/docs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
9 |
# File 'lib/esp/cli/docs.rb', line 9 def self.exit_on_failure? = true |
Instance Method Details
#build ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/esp/cli/docs.rb', line 16 def build out_dir = File.([:out], Esp::ROOT) result = Esp::DocsGenerator.build(output_dir: out_dir) relative = ->(p) { p.sub("#{Esp::ROOT}/", '') } payload = { output_dir: relative.call(out_dir), commands_md: relative.call(result[:commands]), api_index_md: relative.call(result[:api_index]), api_module_md: result[:api_modules].map(&relative) } respond(payload) do say t('docs.wrote', path: relative.call(result[:commands])) say t('docs.wrote', path: relative.call(result[:api_index])) result[:api_modules].each { |p| say t('docs.wrote', path: relative.call(p)) } end end |
#introspect ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/esp/cli/docs.rb', line 34 def introspect payload = { version: Esp::VERSION, commands: Esp::Introspection.command_tree, modules: Esp::Introspection.module_docs } $stdout.puts(JSON.generate(payload)) end |