Class: Kiqr::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#override_app_filesObject



12
13
14
# File 'lib/generators/kiqr/install/install_generator.rb', line 12

def override_app_files
  directory "rails", Rails.root, force: true
end

#welcome_messageObject



8
9
10
# File 'lib/generators/kiqr/install/install_generator.rb', line 8

def welcome_message
  say "Installing KIQR..", :green
end

#write_kiqr_routes_to_routes_fileObject



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
# File 'lib/generators/kiqr/install/install_generator.rb', line 16

def write_kiqr_routes_to_routes_file
  routes_addition = <<~EOS
  root "public#landing_page"

    # => KIQR core routes
    # These routes are required for the KIQR core to function properly.
    # Refer to the KIQR documentation for more information on how
    # to customize these routes or override controllers.
    kiqr_routes

    # Routes inside this block will be prefixed with /team/<team_id> if
    # the user is signed in to a team account. Otherwise, they won't be prefixed at all.
    #
    # Example:
    # /team/:team_id/dashboard <- if user is signed in to a team account
    # /dashboard <- if user is browsing the app without a team account
    #
    account_scope do
      get "dashboard", to: "dashboard#show"
    end
  EOS

  gsub_file File.expand_path("config/routes.rb", Rails.root), /\# root "posts#index"/ do
    routes_addition.strip
  end
end