Sha256: e5c2bda073a18e79c855b95e5f69412e3e07d54cc238aefd369fb3716e3f3b23

Contents?: true

Size: 969 Bytes

Versions: 5

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

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

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

      def copy_initializer
        template "confset.rb", "config/initializers/confset.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.exist? ".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

5 entries across 5 versions & 1 rubygems

Version Path
confset-1.1.0 lib/generators/confset/install_generator.rb
confset-1.0.3 lib/generators/confset/install_generator.rb
confset-1.0.2 lib/generators/confset/install_generator.rb
confset-1.0.1 lib/generators/confset/install_generator.rb
confset-1.0.0 lib/generators/confset/install_generator.rb