Sha256: 7b48255dd4e4b00bd6a027a16571fd87b844beb9fb8e1805ca964b18dad9cc9f
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true require 'rails/generators' module Runger::Generators ; end class Runger::Generators::InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) class_option :configs_path, type: :string def copy_application_config template('application_config.rb', File.join(static_config_root, 'application_config.rb')) end def add_local_files_to_gitignore if File.exist?(File.join(destination_root, '.gitignore')) append_to_file('.gitignore', "\n/config/*.local.yml\n/config/credentials/local.*\n") end end # rubocop:disable Layout/HeredocIndentation def add_setup_autoload_to_config maybe_comment_indented = default_configs_path? ? ' # ' : ' ' inject_into_file('config/application.rb', after: %r{< Rails::Application\n}) do <<-RUBY # Configure the path for configuration classes that should be used before initialization # NOTE: path should be relative to the project root (Rails.root) #{maybe_comment_indented}config.runger_config.autoload_static_config_path = "#{static_config_root}" #{maybe_comment_indented.sub(/\s+$/, '')} RUBY end end # rubocop:enable Layout/HeredocIndentation private def static_config_root options[:configs_path] || Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH end def default_configs_path? static_config_root == (Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH) end end
Version data entries
3 entries across 3 versions & 1 rubygems