Class: Docit::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Docit::Generators::InstallGenerator
- Defined in:
- lib/generators/docit/install/install_generator.rb
Defined Under Namespace
Classes: ShellOutput
Constant Summary collapse
- PROVIDER_OPTIONS =
{ "1" => "openai", "2" => "anthropic", "3" => "groq" }.freeze
Instance Method Summary collapse
Instance Method Details
#ask_doc_mode ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/docit/install/install_generator.rb', line 25 def ask_doc_mode say "" say "How would you like to set up your API documentation?", :green say " 1. AI automatic docs (generate docs using AI)" say " 2. Manual docs (create scaffolded placeholders to fill in)" say " 3. Skip for now, I'll do it myself (just set up the engine and initializer)" say "" @doc_mode = ask_choice("Enter choice (1-3):", %w[1 2 3]) end |
#copy_initializer ⇒ Object
17 18 19 |
# File 'lib/generators/docit/install/install_generator.rb', line 17 def copy_initializer template "initializer.rb", "config/initializers/docit.rb" end |
#mount_engine ⇒ Object
21 22 23 |
# File 'lib/generators/docit/install/install_generator.rb', line 21 def mount_engine route 'mount Docit::Engine => "/api-docs"' end |
#setup_docs ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/docit/install/install_generator.rb', line 36 def setup_docs case @doc_mode when "1" run_ai_setup when "2" run_manual_scaffold else print_skip_instructions end end |