Modulorails
Modulorails is the common base for the Ruby on Rails project at Modulotech.
It registers each application using it on the company's intranet, provides templates for the common configurations and defines common dependencies.
Installation
Add this line to your application's Gemfile:
gem 'modulorails'And then execute:
$ bundle install
Usage
To work the gem needs to be configured. Add an initializer config/modulorails.rb:
Modulorails.configure do |config|
config.name 'The usual name of the application'
config.main_developer 'The email of the main developer/maintainer of the application'
config.project_manager 'The email of the project manager of the application'
config.endpoint 'The url to the intranet'
config.api_key 'The API key'
endFeatures
Devcontainer Support
Modulorails automatically generates a .devcontainer/ configuration for VS Code and compatible IDEs:
-
Dockerfilefor the development container -
compose.ymlwith database, Redis, and mailcatcher services -
devcontainer.jsonfor VS Code integration
Docker Scripts
Two helper scripts are provided in bin/:
-
bin/dc- Wrapper fordocker composecommands targeting the devcontainer -
bin/dcr- Wrapper fordocker compose runwith proper TTY and Git configuration
Usage:
bin/dc up -d # Start services in background
bin/dc logs -f app # Follow app logs
bin/dcr rails console # Run Rails console in container
bin/dcr rspec # Run tests in containerClaude Code Integration
Modulorails can configure your devcontainer for efficient use with Claude Code:
- Persistent bash history across container restarts
- Claude Code configuration volume
- Firewall initialization script
Bun JS Engine Support
Modulorails detects and supports the Bun JavaScript runtime. When bun.config.js is present, the devcontainer will include appropriate JS and CSS build services.
Other Generators
-
RubocopGenerator - Configures
.rubocop.ymlwith Modulotech standards - BundlerauditGenerator - Sets up bundler-audit for security checks
- GithooksGenerator - Installs git hooks for automated checks
- HealthCheckGenerator - Configures the health_check gem
- SidekiqGenerator - Adds Sidekiq background job processing
Deprecations (will be removed in 2.0)
The following features are deprecated and will be removed in version 2.0:
Configuration options
config.staging_urlconfig.review_base_urlconfig.production_urlconfig.no_auto_update
Services
-
Modulorails::BaseService#log- UseRails.logger.debugdirectly -
Modulorails::LogsForMethodService- UseRails.logger.debugdirectly
Generators
The following generators are deprecated and will be moved to Moduloproject 3.0:
-
Modulorails::DockerGenerator(and all sub-generators) Modulorails::GitlabciGeneratorModulorails::ClaudeCodeGeneratorModulorails::ModuloprojectGeneratorModulorails::SidekiqGenerator-
Modulorails::SelfUpdateGenerator(will be removed entirely)
Development
There are tests in spec. To run tests:
- Build Docker images using
docker compose build. - You can run tests on all supported Ruby versions using
docker compose up. - Or you can run test on a specific Ruby version using one of the following commands:
- Ruby 2.5:
docker compose run ruby25 - Ruby 2.6:
docker compose run ruby26 - Ruby 2.7:
docker compose run ruby27 - Ruby 3.0:
docker compose run ruby30 - Ruby 3.1:
docker compose run ruby31
- Ruby 2.5:
Appraisal is used to test the gem against many supported Rails versions:
- Rails 5.2, 6.0 and 6.1 on Ruby 2.5 and 2.6.
- Rails 5.2, 6.0, 6.1 and 7.0 on Ruby 2.7, 3.0 and 3.1.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/moduloTech/modulorails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Modulorails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.