Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

marco-polo

> 编程语言
Open source

MarcoPolo shows your app name and environment in your console prompt so you don't accidentally break production

168 stars0 likes1 views
WebsiteGitHub

About

MarcoPolo shows your app name and environment in your console prompt so you don't accidentally break production

marco-polo

MarcoPolo shows your app name and environment in your console prompt so you don't accidentally break production

Officially supporting IRB (standard rails console) and pry (via pry-rails gem).

Installation

In your Gemfile: gem "marco-polo"
$ bundle install

Note: if you're using pry, make sure to list marco-polo AFTER pry-rails in your gemfile!

Usage

There's nothing to do! Just install the gem and bask in your newfound console security.

Before marco-polo:

~/Sites/myapp$ rails c
>

~/Sites/myapp$ heroku run console -a myapp
>

After marco-polo:

~/Sites/myapp$ rails c
myapp(dev)>

~/Sites/myapp$ heroku run console -a myapp
myapp(prod)>

Customize app name by ENV

You can customize app name by MARCO_POLO_APP_NAME environment variable. In order to customize app name, define this environment variable then run your application.

$ MARCO_POLO_APP_NAME=app_name rails c

If your application is running on Heroku, set this environment variable by heroku config:set command.

$ heroku config:set MARCO_POLO_APP_NAME=app_name

Secret Feature (IRB only): custom .irbrc

The central mechanism of marco-polo is adding a require flag to the rails command that's starting IRB, using it to require a file that changes the prompt. It will also let you load your own irbrc, to set up any console tools you like! And since this file is required after your app is required, you can use all your app objects inside it.

For example, one of my projects uses the sentient_user gem to help assign actors to all our papertrail events. Papertrail works great in my app code, but I always forget to set User.current when I'm in the console. Solution? Prompt myself to "log in" when my console loads.

print "Who are you? "
email = gets.chomp.downcase
user = User.find_by_email(email)
user.make_current
PaperTrail.whodunnit = user

This code lives in a file called .irbrc.rb in my project root and is automatically loaded into my console by marco-polo.

Self Promotion

If you like MarcoPolo, help spread the word! Tell your friends, or at the very least star the repo on github.

For more console goodness, check out http://github.com/arches/table_print

Issues· 4 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言