Sha256: 0f746fc94d5b9a5158a482e9ef6636ac3340d2b6bab56180518ae960917d2ffe

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

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

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

      def copy_initializer
        template "rails_config.rb", "config/initializers/rails_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
        if 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_config_i18n-0.3.1.3 lib/generators/rails_config/install_generator.rb
rails_config_i18n-0.3.1.2 lib/generators/rails_config/install_generator.rb
rails_config_i18n-0.3.1.1 lib/generators/rails_config/install_generator.rb