git banner
GitBanner
GitBanner is a lightweight Ruby on Rails engine that displays your current Git branch, last commit hash, date, and message in a discreet banner at the bottom of your app. It works automatically, without modifying your layout, and includes a visual configuration editor.
β¨ Features
- π Shows Git commit info (hash, date, message, branch)
- π¨ Configurable banner: color, font, size, and more
- βοΈ Mountless installation β no changes to
config/routes.rbneeded - π§ͺ Visual editor at
/git_banner/editorwith live preview - π Hot-reloads config in development mode
- π« Hidden automatically in production (unless enabled)
π¦ Installation
Add the gem to your Gemfile:
gem 'git_banner', path: 'vendor/git_banner_0.3.4' # Or use from RubyGems
Then run:
bundle install
π Usage
Start your Rails server:
rails s
Visit your app and scroll to the bottom. Youβll see the Git banner injected automatically before </body>, with the current Git commit info.
π Configuration
To customize the banner, visit:
/git_banner/editor
You can configure:
- Background and text colors
- Font family and size
- Environments where the banner should appear (e.g.
development,staging) - Enable or disable in production
The settings are stored in:
config/git_banner_settings.json
Changes are applied live in development mode.
π§ How It Works
- Automatically reads
.gitinfo using pure Ruby (git rev-parse,git log, etc.) - Injects an HTML banner into the rendered body
- No layout modification required
- Lightweight and non-intrusive
π File locations
lib/git_banner/config.rbβ Handles settingslib/git_banner/git_info.rbβ Extracts git dataapp/views/git_banner/editor.erbβ Configuration formlib/git_banner/railtie.rbβ Mounts the engine and injects HTML
π§βπ» Author
Govani Sanchez OrduΓ±a
https://soyprogramador.liz.mx
π License
This project is licensed under the MIT License.