Class: PlanMyStuff::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routevoid

This method returns an undefined value.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/plan_my_stuff/install/install_generator.rb', line 14

def add_route
  mount_line = "  mount PlanMyStuff::Engine, at: '/tickets'\n"
  route_file = 'config/routes.rb'

  if File.exist?(route_file) && File.read(route_file).include?('PlanMyStuff::Engine')
    say('Route already mounted, skipping.', :yellow)
    return
  end

  inject_into_file(route_file, mount_line, after: "Rails.application.routes.draw do\n")
end

#copy_initializervoid

This method returns an undefined value.



9
10
11
# File 'lib/generators/plan_my_stuff/install/install_generator.rb', line 9

def copy_initializer
  template('initializer.rb', 'config/initializers/plan_my_stuff.rb')
end

#show_next_stepsvoid

This method returns an undefined value.



27
28
29
30
31
32
33
34
35
# File 'lib/generators/plan_my_stuff/install/install_generator.rb', line 27

def show_next_steps
  say('')
  say('PlanMyStuff installed.', :green)
  say('')
  say('Next steps:', :yellow)
  say('  1. Add your GitHub PAT to credentials: rails credentials:edit')
  say('  2. Run `rails g plan_my_stuff:views` to copy view templates (optional)')
  say('')
end