Rackup another rack app from within Rails rake task
I need to start a sinatra app from within a Rails task. Unfortunately whenever I call system("shotgun")
or system("rackup")
I get weird conflicting errors. When I start them normally from within bash then everything runs fine.
The errors reach from shotgun is not part of the bundle
to uninitialized constant ActionController::Base (NameError)
.
Any suggestions how I could star开发者_JAVA百科t other rack apps from within a Rails app?
Solution ... the trick is to unset some shell variables:
unset BUNDLE_GEMFILE
unset RUBYOPT
unset BUNDLE_BIN_PATH
Hard to say, but since it runs from within bash, it sounds like there is a difference between the environment in which the rake task is run, and your bash environment.
Basically, figure out what in your bash environment is required in order to make things work, and replicate that in the environment in which your rake task runs.
精彩评论