Class: LdapAuthGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LdapAuthGenerator
- Defined in:
- lib/generators/ldap_auth/ldap_auth_generator.rb
Instance Method Summary collapse
- #add_before_filter ⇒ Object
- #add_routes ⇒ Object
- #create_controller ⇒ Object
- #create_initializer ⇒ Object
- #create_views ⇒ Object
- #instructions ⇒ Object
Instance Method Details
#add_before_filter ⇒ Object
11 12 13 14 15 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 11 def add_before_filter inject_into_class "app/controllers/application_controller.rb", ApplicationController do " before_filter :require_ldap_auth, :except => [:ldap_login, :persist_ldap_login, :ldap_logout]\n" end end |
#add_routes ⇒ Object
17 18 19 20 21 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 17 def add_routes route "get '/ldap_login' => 'LdapLogins#ldap_login', :as => :ldap_login" route "post '/ldap_login' => 'LdapLogins#persist_ldap_login', :as => :persist_ldap_login" route "post '/ldap_logout' => 'LdapLogins#ldap_logout', :as => :ldap_logout" end |
#create_controller ⇒ Object
23 24 25 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 23 def create_controller copy_file "ldap_logins_controller.rb", "app/controllers/ldap_logins_controller.rb" end |
#create_initializer ⇒ Object
6 7 8 9 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 6 def create_initializer LdapRails.configure :host => ldap_host template "ldap_auth.rb.erb", "config/initializers/ldap_auth.rb" end |
#create_views ⇒ Object
27 28 29 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 27 def create_views copy_file "ldap_login.html.erb", "app/views/ldap_logins/ldap_login.html.erb" end |
#instructions ⇒ Object
31 32 33 |
# File 'lib/generators/ldap_auth/ldap_auth_generator.rb', line 31 def instructions readme "README" end |