0

I would like to intercept my gem installation process and receive some user input. How do I do that? I'm using ruby 1.9.3 and bundler for my gem development and hosting it on rubygems.org.

Alternatively, is there a way to pass arguments?

nieve
  • 4,601
  • 3
  • 20
  • 26
  • 4
    This seems like a bad idea; many people (esp. sysadmins) prefer non-interactive installations. – maerics Jun 28 '13 at 21:02
  • 3
    I agree with maerics. A possible alternative is to show a post installation message with further instructions for the user. How you show such a message is described in this post: http://stackoverflow.com/questions/6543001/is-there-a-way-to-print-a-message-after-a-user-installs-a-ruby-gem – mario Jun 28 '13 at 21:06
  • Thanks for the prompt reply- I've updated the question. – nieve Jun 28 '13 at 21:08
  • 1
    Maybe check for environment variables instead? Always best to pick sane defaults so that a "hands-off" install still works. – maerics Jun 28 '13 at 21:30
  • unfortunately most ruby gem installations have their stdout redirected to a file, so you may not be able to prompt anyway... – rogerdpack Jun 28 '13 at 21:36
  • @maerics yes, I thought of having a default value for most installs- not just hands off ones. Unfortunately env variables won't be sufficient. Is it possible? If so how? – nieve Jun 28 '13 at 22:37
  • use post installation configuration program. Display a message in the end of the installation and ask the user to run a program that does configuration. Thats many gems do. – SwiftMango Jun 29 '13 at 19:24

2 Answers2

1

Normally to pass "arguments" you would require the use of environment variables. Things like ruby-oci8 need these to compile for Oracle database use.

Adam
  • 772
  • 3
  • 10
0

Seems like the only way of achieving this is by adding a post installation message and then having in your bin a cmd along the line of config-mygem to achieve the same thing. Not exactly what I was looking for, but better than nothing.

nieve
  • 4,601
  • 3
  • 20
  • 26