Sha256: 48696c36abbaf6e6b73ac03c9c4483333d0985217cfcea1ead8863ab0d436d8a

Contents?: true

Size: 935 Bytes

Versions: 28

Compression:

Stored size: 935 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/settings.yml"
        template "settings.local.yml", "config/settings.local.yml"
        directory "settings", "config/settings"
      end

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

        append_to_file '.gitignore' do
          "\n"                                +
          "config/settings.local.yml\n"       +
          "config/settings/*.local.yml\n"     +
          "config/environments/*.local.yml\n"
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
config-1.2.1 lib/generators/config/install_generator.rb
config-1.2.0 lib/generators/config/install_generator.rb
config-1.1.1 lib/generators/config/install_generator.rb
config-1.1.0 lib/generators/config/install_generator.rb
config-1.0.0 lib/generators/config/install_generator.rb
config-1.0.0.beta3 lib/generators/config/install_generator.rb
config-1.0.0.beta2 lib/generators/config/install_generator.rb
config-1.0.0.beta1 lib/generators/config/install_generator.rb