简体   繁体   English

从Rails抽佣任务中整理另一个机架应用

[英]Rackup another rack app from within Rails rake task

I need to start a sinatra app from within a Rails task. 我需要从Rails任务中启动sinatra应用程序。 Unfortunately whenever I call system("shotgun") or system("rackup") I get weird conflicting errors. 不幸的是,每当我调用system("shotgun")system("rackup") ,都会收到奇怪的冲突错误。 When I start them normally from within bash then everything runs fine. 当我从bash中正常启动它们时,一切运行正常。

The errors reach from shotgun is not part of the bundle to uninitialized constant ActionController::Base (NameError) . shotgun is not part of the bundle到达的错误shotgun is not part of the bundleuninitialized constant ActionController::Base (NameError)

Any suggestions how I could start other rack apps from within a Rails app? 关于如何从Rails应用程序中启动其他机架应用程序的任何建议?

Solution ... the trick is to unset some shell variables: 解决方案...诀窍是取消设置一些shell变量:

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. 很难说,但是由于它是从bash内部运行的,因此听起来好像在运行rake任务的环境与您的bash环境之间存在差异。

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. 基本上,弄清楚bash环境中需要什么才能使工作正常进行,并在运行rake任务的环境中进行复制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM