← archive

5 reasons for adding a post-installation message to your gem

November 30, 2013

Wondering whether you should add a post-installation message to your gem? Here's a list situations in which doing so is desirable:

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

No, seriously - don't do it!

but having fun is important

Yes, I know. Maybe this seems a little harsh, we are a Ruby programmers after all. We are fun and interesting, still kids in our hearts and we are so different from those stuffy statically typed language programmers. They are those grumpy ones, not having fun at all, doing everything by the book.

Why can't we have a little fun, tell people something nice when they're installing things so that they are reminded to have fun? After all, you should love what you do - it should still be fun to you.

Well, yes - please have fun, but please remember that if you're going to have fun with post-installation messages, you're also going to exploit the functionality that was given to you by the community to tell people important stuff they should be aware off.

What happens if a gem developer decides to add a post-installation messages with ASCII art, for example? Yes, every developer out there will be aware of the presence of that gem in her project. It will stand out among other bunch.

What happens if every gem developer decides to do so? Perhaps STDOUT overflow would be a right naming for it.

workarounds for gems that currently have post-installation messages

You can still avoid having any post-installation messages. Bundler has a flag for it

bundle install --quiet

Although, Linux people (like me) will of course wonder why is that flag even present, when you can just ditch it to the black hole

bundle install > /dev/null

dangers of workarounds and conclusion

This will of course mean, that you will not see any of the critical warnings that might be present and were added by gem authors that cared enough to add it there.

Why would anyone put warnings there? Well, when people can't use anything else (like normal deprecation warnings), they'll still fallback to this method.

An example of this would be when a gem changes its name, like how sqlite3-ruby did:

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3.
Rather than installing sqlite3-ruby, you should install sqlite3.
Please update your dependencies accordingly.

Useful, right?

What about:

When you HTTParty, you must party hard!

Must you party --hard? I don't think so. I didn't and I'm still here.

@shime_sh Hrvoje Šimić
0 kudos
I write every day, but I no longer publish everything. Join my sporadic newsletter to never miss an article.

Unsubscribe anytime. By submitting, you agree to our privacy policy.