1

I have a gem. It can optionally be run as a command line app myapp_cli, or as an app with a local web ui myapp_web.

When working on my app, I can run bundle exec myapp_cli for the command line UI, or
I can run bundle exec rackup for the web UI.

Now I'd like bin/myapp_web to essentially be a synonym for rackup. So when someone installs my gem, they can just run myapp_cli or myapp_web.

Is there a nice way of doing that?

I can make my myapp_web look like

Rack::Handler::WEBrick.run(
      App.new,
      :Port => 9000
  )

but that doesn't give me all the goodies that rackup gives me.

1 Answer 1

1

All I had to do was browse the source.

require 'rack'
Rack::Server.start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.