Sha256: 5c5459c6c98e1750f4c107239a8b4faf3ad5fcde541e9441097e506e4e7f4bbf

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

require_relative "base"

module Suspenders
  class ProfilerGenerator < Generators::Base
    def augment_default_env
      append_to_file ".sample.env", "RACK_MINI_PROFILER=0\n"
    rescue Errno::ENOENT
      create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
    rescue Thor::Error => e
      if e.message.match?(/does not appear to exist/)
        create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
      else
        raise
      end
    end

    def add_gem
      gem "rack-mini-profiler", require: false
      Bundler.with_unbundled_env { run "bundle install" }
    end

    def configure_rack_mini_profiler
      copy_file(
        "rack_mini_profiler.rb",
        "config/initializers/rack_mini_profiler.rb",
        force: false,
        skip: true
      )
    end

    def update_readme
      append_template_to_file "README.md", "partials/profiler_readme.md"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
suspenders-20230113.0 lib/suspenders/generators/profiler_generator.rb
suspenders-1.56.1 lib/suspenders/generators/profiler_generator.rb
suspenders-1.55.1 lib/suspenders/generators/profiler_generator.rb
suspenders-1.55.0 lib/suspenders/generators/profiler_generator.rb