Rake tasks won't run inside of my sinatra app

帅比萌擦擦* 提交于 2019-12-12 04:18:25

问题


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

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' 

and I also try Rakefile.rake but both give me an error that reads "require cannot load such file." I'm using Ubuntu.

I'm not sure why sinatra can't load the rakefile, but when I run rake test in terminal that works.

Any help would be great.


回答1:


get '/' do
    system 'rake test'
end


来源:https://stackoverflow.com/questions/34098691/rake-tasks-wont-run-inside-of-my-sinatra-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!