Class: JwtAuthCognito::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/jwt_auth_cognito/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_env_exampleObject



18
19
20
21
22
23
24
25
26
# File 'lib/generators/jwt_auth_cognito/install_generator.rb', line 18

def create_env_example
  if File.exist?('.env.example')
    append_to_file '.env.example', env_variables
    say "✓ Variables de entorno agregadas a .env.example", :green
  else
    create_file '.env.example', env_variables
    say "✓ Archivo .env.example creado con variables de entorno", :green
  end
end

#create_initializerObject



12
13
14
15
16
# File 'lib/generators/jwt_auth_cognito/install_generator.rb', line 12

def create_initializer
  say "Creando archivo de configuración jwt_auth_cognito..."
  template 'jwt_auth_cognito.rb.erb', 'config/initializers/jwt_auth_cognito.rb'
  say "✓ Archivo de configuración creado en config/initializers/jwt_auth_cognito.rb", :green
end

#show_next_stepsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/generators/jwt_auth_cognito/install_generator.rb', line 28

def show_next_steps
  say "\n" + "="*60, :blue
  say "🎉 ¡Configuración de jwt_auth_cognito completada!", :green
  say "="*60, :blue
  say "\n📋 PRÓXIMOS PASOS:", :yellow
  say "\n1. Configura las variables de entorno:", :cyan
  say "   - Copia .env.example a .env (si usas dotenv)"
  say "   - Configura las variables de AWS Cognito y Redis"
  
  say "\n2. Variables de entorno requeridas:", :cyan
  say "   COGNITO_USER_POOL_ID=us-east-1_abcdef123"
  say "   COGNITO_REGION=us-east-1"
  say "   COGNITO_CLIENT_ID=tu-client-id"
  
  say "\n3. Variables de entorno opcionales:", :cyan
  say "   COGNITO_CLIENT_SECRET=tu-client-secret (para mayor seguridad)"
  say "   REDIS_TLS=true (para Redis con TLS)"
  say "   REDIS_CA_CERT_PATH=/ruta/a/certificados"
  
  say "\n4. Reinicia tu aplicación Rails", :cyan
  
  say "\n📖 Documentación completa:", :yellow
  say "   Revisa el README.md de la gema para ejemplos de uso"
  say "\n" + "="*60, :blue
end