Class: Suspenders::ProfilerGenerator
Instance Method Summary
collapse
default_source_root, inherited
Methods included from Actions
#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file
Instance Method Details
#add_gem ⇒ Object
17
18
19
20
|
# 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 ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
|
# 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
|
22
23
24
25
26
27
28
29
|
# 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 ⇒ Object
31
32
33
|
# File 'lib/suspenders/generators/profiler_generator.rb', line 31
def update_readme
append_template_to_file "README.md", "partials/profiler_readme.md"
end
|