Class: Mcp::Auth::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mcp::Auth::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/mcp/auth/install_generator.rb
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #copy_migrations ⇒ Object
- #copy_views ⇒ Object
- #show_post_install_message ⇒ Object
- #show_readme ⇒ Object
Instance Method Details
#copy_initializer ⇒ Object
34 35 36 |
# File 'lib/generators/mcp/auth/install_generator.rb', line 34 def copy_initializer template "initializer.rb", "config/initializers/mcp_auth.rb" end |
#copy_migrations ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/mcp/auth/install_generator.rb', line 16 def copy_migrations migration_template "create_oauth_clients.rb.erb", "db/migrate/create_mcp_auth_oauth_clients.rb", migration_version: migration_version migration_template "create_authorization_codes.rb.erb", "db/migrate/create_mcp_auth_authorization_codes.rb", migration_version: migration_version migration_template "create_access_tokens.rb.erb", "db/migrate/create_mcp_auth_access_tokens.rb", migration_version: migration_version migration_template "create_refresh_tokens.rb.erb", "db/migrate/create_mcp_auth_refresh_tokens.rb", migration_version: migration_version end |
#copy_views ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/generators/mcp/auth/install_generator.rb', line 38 def copy_views # Create the directory first empty_directory "app/views/mcp/auth" # Copy consent view template template "views/consent.html.erb", "app/views/mcp/auth/consent.html.erb" end |
#show_post_install_message ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/generators/mcp/auth/install_generator.rb', line 54 def say "\n" + "="*80 say "MCP Auth has been installed!", :green say "="*80 say "\nFiles created:" say " - db/migrate/*_create_mcp_auth_*.rb (4 migrations)" say " - config/initializers/mcp_auth.rb" say " - app/views/mcp/auth/consent.html.erb" say "\nNext steps:" say "1. Run migrations: rails db:migrate" say "2. Configure: config/initializers/mcp_auth.rb" say "3. Customize consent view: app/views/mcp/auth/consent.html.erb" say "4. Mount routes in config/routes.rb (if not already done):" say " mount Mcp::Auth::Engine => '/'" say "\nDocumentation: https://github.com/SerhiiBorozenets/mcp-auth" say "="*80 + "\n" end |
#show_readme ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/generators/mcp/auth/install_generator.rb', line 46 def show_readme if File.exist?(File.join(self.class.source_root, "README")) readme "README" end rescue Thor::Error # Skip silently end |