Class: Rich::Generators::AuthlogicUserGenerator
- Inherits:
-
RichCms::Generators::Base
- Object
- Rails::Generators::Base
- RichCms::Generators::Base
- Rich::Generators::AuthlogicUserGenerator
- Includes:
- Rails::Generators::Migration, RichCms::Generators::Migration
- Defined in:
- lib/generators/rich/authlogic_user/authlogic_user_generator.rb
Instance Method Summary collapse
- #generate_migration ⇒ Object
- #generate_model ⇒ Object
- #generate_session ⇒ Object
- #migrate ⇒ Object
- #register_authentication ⇒ Object
Methods included from RichCms::Generators::Migration
Methods inherited from RichCms::Generators::Base
Instance Method Details
#generate_migration ⇒ Object
35 36 37 |
# File 'lib/generators/rich/authlogic_user/authlogic_user_generator.rb', line 35 def generate_migration migration_template "migration.rb", "db/migrate/create_#{table_name}" end |
#generate_model ⇒ Object
27 28 29 |
# File 'lib/generators/rich/authlogic_user/authlogic_user_generator.rb', line 27 def generate_model template "model.rb", "app/models/#{model_file_name}.rb" end |
#generate_session ⇒ Object
31 32 33 |
# File 'lib/generators/rich/authlogic_user/authlogic_user_generator.rb', line 31 def generate_session template "session.rb", "app/models/#{model_file_name}_session.rb" end |
#migrate ⇒ Object
39 40 41 |
# File 'lib/generators/rich/authlogic_user/authlogic_user_generator.rb', line 39 def migrate rake "db:migrate" if [:migrate] end |
#register_authentication ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/generators/rich/authlogic_user/authlogic_user_generator.rb', line 15 def register_authentication filename = "config/initializers/enrichments.rb" line = "\nRich::Cms::Engine.authenticate(:authlogic, {:class_name => \"#{model_class_name}\", :identifier => :email})" create_file filename unless File.exists?(filename) return if File.open(filename).readlines.collect(&:strip).include? line.strip File.open(filename, "a+") do |file| file << line end end |