Class: VelirIdentityEngine::Generators::InstallGenerator

Inherits:
Diesel::Generators::InstallBase
  • Object
show all
Defined in:
lib/generators/velir_identity_engine/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#installObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/velir_identity_engine/install/install_generator.rb', line 6

def install
  template "velir_identity_engine.rb", "config/initializers/velir_identity_engine.rb"

  inject_into_class "app/controllers/application_controller.rb", ApplicationController do
    "  include VelirIdentityEngine::Authentication\n"
  end

  user_model = "app/models/user.rb"
  if File.exists? user_model
    inject_into_class user_model, User do
      "include VelirIdentityEngine::User\n"
    end
  else
    template "user.rb", user_model
  end
  
  readme "README"
end