Class: LightekVpm::Generators::InitGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/init_generator.rb,
lib/generators/lightek_vpm/init_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_gems_neededObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/generators/init_generator.rb', line 7

def add_gems_needed
        desc "Adding the gems and models needed for base work"
  # Add Bootstrap gem
  puts "Adding Bootstrap gem..."
  gem 'bootstrap', '~> 5.3.3'
  
  # Run bundle install
  puts "Running bundle install..."
  Bundler.with_clean_env { run 'bundle install' }

  # Add Devise gem
  puts "Adding Devise gem..."
  gem 'devise'
  Bundler.with_clean_env { run 'bundle install' }
  
  # Run Devise installation
  puts "Now installing Devise..."
  generate 'devise:install'
  
  # Create Devise User model
  puts "Creating User model with Devise..."
  generate 'devise User role:integer first_name:string last_name:string bio:text website:string twitter:string facebook:string instagram:string dob:date street:string city:string state:string'
  puts "Running db migration for user"
  rake 'db:migrate'
  
  
  # Add CanCanCan gem
  puts "Adding CanCanCan gem..."
  gem 'cancancan'
  Bundler.with_clean_env { run 'bundle install' }
  
  # Run CanCanCan installation (if needed)
  # Replace the following lines with CanCanCan installation commands if necessary
  
  # Add ActionText gem
  puts "Adding ActionText gem..."
  gem 'actiontext'
  Bundler.with_clean_env { run 'bundle install' }
  
  # Install Action Text
  puts "Installing Action Text..."
  generate 'action_text:install'
  rake 'db:migrate'
end