Visual environment indicators for Rack and Rails apps. Wraps non-production environments in unmistakable chrome β a striped construction frame and warning banner for staging/sandbox, a solid colored frame for development β so nobody ever mistakes a test environment for production (or puts production data in a sandbox).
- Zero assets, zero JavaScript β a Rack middleware injects a small inline
<style>+ two<div>s before</body>on HTML responses. - Click-through (
pointer-events: none) β never blocks the UI. - Off by default β production is safe unless you explicitly enable it.
bundle add caution_tapeThe Railtie installs the middleware automatically. Enable and style it per environment:
# config/environments/development.rb
CautionTape.configure do |c|
c.enabled = true
c.style = :solid
c.color = "#dc2626"
c.tag = "Dev"
end# config/environments/production.rb β same image serves prod and sandbox
CautionTape.configure do |c|
c.enabled = ENV.fetch("BASE_URL", "").include?("sandbox")
c.style = :stripes
c.banner = "Sandbox β test environment. Do not enter real data."
endCautionTape.configure do |c|
c.enabled = true
c.banner = "Staging"
end
use CautionTape::Middleware
run MyApp| Option | Default | Notes |
|---|---|---|
enabled |
false |
Nothing renders unless enabled |
style |
:stripes |
:stripes (caution stripes) or :solid |
color |
"#f5c518" |
Accent color; stripes pair it with near-black |
banner |
nil |
Warning pill pinned top-center |
tag |
nil |
Small label pill, shown when no banner is set |
border_width |
10 |
Frame thickness in px |
After checking out the repo, run bin/setup to install dependencies. Then run
rake test to run the tests. You can also run bin/console for an interactive
prompt.
Bug reports and pull requests are welcome on GitHub at https://github.com/singlefeather/caution_tape. Contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.