Sha256: 4b4d91c3d7fa3f92e8990eed41825d6c6316e4d3a427da186d8a8effe989ee1e

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

module Rsg
  # The application builder allows you to override elements of the application
  # generator without being forced to reverse the operations of the default
  # generator.
  #
  # This allows you to override entire operations, like the creation of the
  # Gemfile, README, or JavaScript files, without needing to know exactly
  # what those operations do so you can create another template action.
  #
  # For Rails 6.1, you can check out https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/generators/rails/app/app_generator.rb#L44
  class AppBuilder < ::Rails::AppBuilder
    def master_key
      gsub_file "config/application.rb",
        /^(\s*)(config\.load_defaults[^\n]+)\n$/,
        "\\1\\2\n\n\\1# We don't use Rails encrypted secrets\n"\
        "\\1config.require_master_key = false\n" \
        "\\1config.active_support.use_authenticated_message_encryption = false\n"
    end

    ###########################################################################
    # Simple template overwrites
    ###########################################################################

    def readme
      template "README.md.erb", "README.md"
    end

    ###########################################################################
    # Things to skip since we don't care about them
    ###########################################################################

    def ruby_version
      # NOOP since we have the ruby version in Gemfile
    end

    def credentials
      # NOOP since we store env vars / secrets elsewhere
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsg-0.0.1 lib/rsg/generators/app/app_builder.rb