Search code examples
rubyubuntusinatrarakerequire

Rake tasks won't run inside of my sinatra app


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.


Solution

  • get '/' do
        system 'rake test'
    end