Class: Trackdown::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_mmdb_to_gitignoreObject



14
15
16
17
18
19
20
# File 'lib/generators/trackdown/install_generator.rb', line 14

def add_mmdb_to_gitignore
  if File.exist?('.gitignore')
    append_to_file '.gitignore', "\n\n# Trackdown\n*.mmdb"
  else
    create_file '.gitignore', "# Trackdown\n*.mmdb"
  end
end

#create_database_refresh_jobObject



10
11
12
# File 'lib/generators/trackdown/install_generator.rb', line 10

def create_database_refresh_job
  template 'trackdown_database_refresh_job.rb', 'app/jobs/trackdown_database_refresh_job.rb'
end

#create_initializerObject



6
7
8
# File 'lib/generators/trackdown/install_generator.rb', line 6

def create_initializer
  template 'trackdown.rb', 'config/initializers/trackdown.rb'
end

#display_post_install_messageObject



22
23
24
25
26
27
28
29
# File 'lib/generators/trackdown/install_generator.rb', line 22

def display_post_install_message
  say "\tThe `trackdown` gem has been successfully installed!", :green
  say "\nTo complete the setup:"
  say "  1. Configure your MaxMind credentials in `config/initializers/trackdown.rb`"
  say "  2. Run 'Trackdown.update_database' to get a fresh MaxMind IP database."
  say "  3. Make sure you configure your queueing system to run the TrackdownDatabaseRefreshJob regularly so the IP database is updated regularly."
  say "\nEnjoy `trackdown`!", :green
end