class Suspenders::ProfilerGenerator

Public Instance Methods

add_gem() click to toggle source
# File lib/suspenders/generators/profiler_generator.rb, line 17
def add_gem
  gem "rack-mini-profiler", require: false
  Bundler.with_unbundled_env { run "bundle install" }
end
augment_default_env() click to toggle source
# File lib/suspenders/generators/profiler_generator.rb, line 5
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
configure_rack_mini_profiler() click to toggle source
# File lib/suspenders/generators/profiler_generator.rb, line 22
def configure_rack_mini_profiler
  copy_file(
    "rack_mini_profiler.rb",
    "config/initializers/rack_mini_profiler.rb",
    force: false,
    skip: true
  )
end
update_readme() click to toggle source
# File lib/suspenders/generators/profiler_generator.rb, line 31
def update_readme
  append_template_to_file "README.md", "partials/profiler_readme.md"
end