Class: RailsForge::Wizard
- Inherits:
-
Object
- Object
- RailsForge::Wizard
- Defined in:
- lib/railsforge/wizard.rb
Overview
Wizard class provides interactive project setup
Constant Summary collapse
- PROJECT_TYPES =
Project types available
{ "saas" => { name: "SaaS Application", description: "Full-featured SaaS with auth, admin, payments", features: %w[authentication admin background_jobs] }, "blog" => { name: "Blog", description: "Content blog with articles and comments", features: %w[authentication comments] }, "api" => { name: "API Only", description: "RESTful API with JWT authentication", features: %w[jwt_auth background_jobs] }, "admin_app" => { name: "Admin Dashboard", description: "Admin panel with CRUD operations", features: %w[authentication admin] }, "standard" => { name: "Standard Rails", description: "Basic Rails application", features: [] } }.freeze
Instance Method Summary collapse
-
#execute ⇒ Object
Execute the wizard choices.
-
#initialize ⇒ Wizard
constructor
Initialize wizard.
-
#run ⇒ Hash
Run the interactive wizard.
Constructor Details
#initialize ⇒ Wizard
Initialize wizard
39 40 41 42 43 44 45 46 47 |
# File 'lib/railsforge/wizard.rb', line 39 def initialize = { project_name: nil, project_type: nil, features: [], generators: [], analyze_after: false } end |
Instance Method Details
#execute ⇒ Object
Execute the wizard choices
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/railsforge/wizard.rb', line 80 def execute return unless [:project_name] puts "" puts "Creating Rails app: #{@options[:project_name]}" puts "" # Build options for RailsForge::Generator = { profile: [:project_type] } # Add features [:auth] = "devise" if [:features].include?("authentication") [:admin] = "activeadmin" if [:features].include?("admin") [:jobs] = "sidekiq" if [:features].include?("background_jobs") begin # Create the Rails app result = RailsForge::Generator.create_app([:project_name], ) puts result puts "" # Run selected generators run_generators if [:generators].any? # Run analysis if requested run_analysis if [:analyze_after] puts "" puts "✓ Project created successfully!" rescue => e puts "Error: #{e.message}" end end |
#run ⇒ Hash
Run the interactive wizard
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/railsforge/wizard.rb', line 51 def run puts "" puts "=" * 60 puts "RailsForge Project Wizard" puts "=" * 60 puts "" # Step 1: Project name ask_project_name # Step 2: Project type ask_project_type # Step 3: Features ask_features # Step 4: Generators ask_generators # Step 5: Analysis ask_analysis # Summary show_summary end |