module RorVsWild
  class Installer
    PATH = "config/rorvswild.yml"

    def self.create_rails_config(api_key)
      if File.directory?("config")
        if !File.exists?(PATH)
          File.write(PATH, template(api_key))
          puts "File #{PATH} has been created. Restart / deploy your app to start collecting data."
        else
          puts "File #{PATH} already exists."
        end
      else
        puts "There is no config directory to create #{PATH}."
      end
    end

    def self.template(api_key)
      <<YAML
production:
  api_key: #{api_key}
  # ignored_exceptions:
  #   - ActionController::RoutingError
  #   - UncommentToIgnoreAnyExceptionNameListedHere
YAML
    end
  end
end
