permadeps
Ruby gem that holds permanent dependencies and configurations for Rails projects.
This gem is compatible with this Ruby on Rails DevContainer setup.
Installation
Add the gem to your Rails application's Gemfile by executing:
$ bundle add permadeps
Usage
Adding this gem to your Rails project provides you with the following gems and features:
Production Dependencies
The following gems will be automatically required:
-
ahoy_matey
: Analytics for Rails -
better_html
: Better HTML for Rails -
blazer
: Business intelligence made simple -
flamegraph
: Flamegraph profiler -
geocoder
: Geocoding solution -
good_job
: Multithreaded, Postgres-based, Active Job backend -
memory_profiler
: Memory profiling tool -
notable
: Automatic tracking for requests and background jobs -
pghero
: PostgreSQL insights -
rack-mini-profiler
: Profiler for Rack applications -
rails_performance
: Self-hosted performance monitoring -
stackprof
: Sampling call-stack profiler
Additional production dependencies (not automatically required):
-
freezolite
: Automatic string freezing -
pg_query
: PostgreSQL query parsing
Development Dependencies
-
annotaterb
: Annotate Rails models -
better_errors
: Better error page for Rails -
binding_of_caller
: Retrieve the binding of a method's caller -
brakeman
: Security vulnerability scanner -
bullet
: Help to kill N+1 queries (automatically required in development) -
bundler-audit
: Patch-level verification for Bundler -
dotenv
: Load environment variables from.env
-
erb-formatter
: ERB formatter -
erb_lint
: ERB linter -
i18n-tasks
: Manage translation and localization -
rubocop
and related gems: Ruby static code analyzer and formatter
Configuration
Rubocop
To use the rubocop
configuration provided by permadeps
, add the following to your .rubocop.yml
:
inherit_gem:
permadeps:
- rubocop.yml
Formatters
For erb-formatter
and erb_lint
to work properly in VSCode, install these extensions:
Generator
The gem provides a generator to install necessary files and configurations:
$ rails g permadeps:install
This generator will perform the following actions:
-
Copy configuration files:
-
.annotaterb.yml
: Configuration for AnnotateRb -
.better-html.yml
: Configuration for Better HTML -
.env.example
: Example environment variables file -
.erb-lint.yml
: Configuration for ERB Lint -
.rubocop.yml
: Configuration for RuboCop
-
-
Copy initializers:
-
config/initializers/better_html.rb
: Sets up Better HTML -
config/initializers/blazer.rb
: Configures Blazer -
config/initializers/rack_mini_profiler.rb
: Sets up Rack Mini Profiler -
config/initializers/rails_performance.rb
: Sets up Rails Performance
-
-
Add background jobs for PgHero:
-
app/jobs/capture_query_stats_job.rb
: Captures query statistics -
app/jobs/capture_space_stats_job.rb
: Captures space usage statistics -
app/jobs/clean_query_stats_job.rb
: Cleans up old query statistics -
app/jobs/clean_space_stats_job.rb
: Cleans up old space usage statistics
-
-
Add a rake task:
-
lib/tasks/annotate_rb.rake
: Task for running Annotate
-
-
Run generators for various gems:
-
ahoy:install
: Sets up Ahoy for analytics -
blazer:install
: Installs Blazer for business intelligence -
bullet:install
: Installs Bullet for N+1 query detection -
good_job:install
: Sets up GoodJob -
notable:requests
: Sets up Notable for request tracking -
notable:jobs
: Sets up Notable for job tracking -
pghero:query_stats
: Installs PgHero query stats -
pghero:space_stats
: Installs PgHero space stats
-
-
Set up Freezolite:
- Adds
require 'freezolite/auto'
toconfig/application.rb
for automatic string freezing
- Adds
-
Run database migrations:
- Executes
rails db:migrate
to apply all pending migrations
- Executes
After running the generator, your Rails application will be configured with all the necessary settings and files to use the gems provided by permadeps. Make sure to review the generated files and adjust them as needed for your specific project requirements.
License
The gem is available as open source under the terms of the MIT License.