Skip to content

Commit

Permalink
Merge pull request #109 from abhaynikam/refactor-rack-mini-profiler-gem
Browse files Browse the repository at this point in the history
Refactor the rack-mini-profiler gem
  • Loading branch information
abhaynikam authored May 16, 2024
2 parents e3fc12d + 5c8b1ed commit 30ab42c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
boring_generators (0.12.0)
boring_generators (0.13.0)
railties

GEM
Expand Down Expand Up @@ -143,4 +143,4 @@ DEPENDENCIES
sqlite3 (~> 1.4)

BUNDLED WITH
2.1.4
2.2.33
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,36 @@
module Boring
module RackMiniProfiler
class InstallGenerator < Rails::Generators::Base
desc 'Adds rack mini profiler to the application'
desc 'Adds rack-mini-profiler to the application'

def add_rack_mini_profiler_gem
say 'Adding rack mini profiler gem', :green
say 'Adding rack-mini-profiler gem', :green
gem_definition = "gem 'rack-mini-profiler', require: false\n"
rack_mini_profiler_gems_content = <<~RUBY
\n
\t# Profiler for your Rails application
\tgem 'rack-mini-profiler', require: false
RUBY

gem 'rack-mini-profiler', require: false
insert_into_file "Gemfile", rack_mini_profiler_gems_content, after: /group :development do\n/

Bundler.with_unbundled_env do
run 'bundle install'
end
bundle_install
end

def configure_rack_mini_profiler
say 'Configuring rack mini profiler', :green
run_with_bundler 'bundle exec rails g rack_mini_profiler:install'
end

private

def bundle_install
run_with_bundler 'bundle install'
end

def run_with_bundler(command)
Bundler.with_unbundled_env do
run 'bundle exec rails g rack_mini_profiler:install'
run command
end
end
end
Expand Down

0 comments on commit 30ab42c

Please sign in to comment.