Sha256: 25a81480da0bb5b4006a7ca518171626a3b4c09dd1c4b7783926edbf543a3ff1

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

module Config
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      desc "Generates a custom Rails Config initializer file."

      def self.source_root
        @_config_source_root ||= File.expand_path("../templates", __FILE__)
      end

      def copy_initializer
        template "config.rb", "config/initializers/config.rb"
      end

      def copy_settings
        template "settings.yml", "config/#{Config.file_name}.yml"
        template "settings.local.yml", "config/#{Config.file_name}.local.yml"
        directory "settings", "config/#{Config.dir_name}"
      end

      def modify_gitignore
        create_file '.gitignore' unless File.exist? '.gitignore'

        append_to_file '.gitignore' do
          "\n"                                      +
          "config/#{Config.file_name}.local.yml\n"  +
          "config/#{Config.dir_name}/*.local.yml\n" +
          "config/environments/*.local.yml\n"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
config-5.5.2 lib/generators/config/install_generator.rb
config-5.5.1 lib/generators/config/install_generator.rb
config-5.4.0 lib/generators/config/install_generator.rb
config-5.3.0 lib/generators/config/install_generator.rb
config-5.2.0 lib/generators/config/install_generator.rb