瑞克任务不会在我的sinatra应用程序中运行 [英] Rake tasks won't run inside of my sinatra app
问题描述
我有一个带有Rakefile.rake和server.rb文件的sinatra应用程序.在server.rb文件中,我有
I have a sinatra app with a Rakefile.rake and server.rb file. In the server.rb file I have
get '/' do
rake :test
end
该应用程序已加载,但在我加载localhost:4567/时崩溃,并为sinatra应用程序说了未定义的方法"rake".我尝试通过使用
the app loads up but crashes when I load localhost:4567/ and says undefined method 'rake' for sinatra application. I try and require the file by using
require '/home/user/project/Rakefile'
,我也尝试使用Rakefile.rake,但是两者都给我一个错误,显示为"require无法加载此类文件".我正在使用Ubuntu.
and I also try Rakefile.rake but both give me an error that reads "require cannot load such file." I'm using Ubuntu.
我不确定为什么sinatra无法加载rakefile,但是当我在有效的终端中运行rake test时.
I'm not sure why sinatra can't load the rakefile, but when I run rake test in terminal that works.
任何帮助都会很棒.
推荐答案
get '/' do
system 'rake test'
end
这篇关于瑞克任务不会在我的sinatra应用程序中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!