summaryrefslogtreecommitdiff
path: root/lib/system_check/app/database_config_exists_check.rb
blob: af1bdcd9ba25e900ddb89bf342c4bb1410eb817c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module SystemCheck
  module App
    class DatabaseConfigExistsCheck < SystemCheck::BaseCheck
      set_name _('Database config exists?')

      def check?
        database_config_file = Rails.root.join('config', 'database.yml')

        File.exist?(database_config_file)
      end

      def show_error
        try_fixing_it(
          'Copy config/database.yml.<your db> to config/database.yml',
          'Check that the information in config/database.yml is correct'
        )
        for_more_information(
          'doc/install/databases.md',
          'http://guides.rubyonrails.org/getting_started.html#configuring-a-database'
        )
        fix_and_rerun
      end
    end
  end
end