Class: Ibrain::Auth::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_pathsObject



11
12
13
14
15
# File 'lib/generators/ibrain/auth/install/install_generator.rb', line 11

def self.source_paths
  paths = superclass.source_paths
  paths << File.expand_path('templates', __dir__)
  paths.flatten
end

Instance Method Details

#add_filesObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/ibrain/auth/install/install_generator.rb', line 17

def add_files
  template 'config/initializers/devise.rb.tt', 'config/initializers/devise.rb', { skip: true }
  template 'config/initializers/ibrain_auth.rb.tt', 'config/initializers/ibrain_auth.rb', { skip: true }
  template 'config/initializers/ibrain_jwt.rb.tt', 'config/initializers/ibrain_jwt.rb', { skip: true }

  if options[:with_social]
    template 'config/initializers/omniauth.rb.tt', 'config/initializers/omniauth.rb', { skip: true }
  end

  if options[:with_ridgepole]
    template 'db/schemas/users_schema.erb', 'db/schemas/users.schema', { skip: true }
  else
    template 'db/schemas/users_migrate.erb', "db/migrate/#{Time.current.to_i}_add_users.rb", { skip: true }
  end
end