Question
I want to be able to debug my Sinatra website hosted by Thin on my local machine, and I want to be able to initiate this by using rake.
I'm not able to accept answers suggesting the use of different technologies (e.g. Windows, Rails, Java) or other servers (e.g. unicorn, passenger, puma); however, if what I'm asking for is impossible, then I will accept that answer.
What I've tried
My current Rakefile contains a task :start which starts the Thin server, but when it hits the breakpoint no output is displayed on my terminal. If I start Thin directly from the terminal, then I see the (rdb:1) prompt when it hits the breakpoint as expected. In either case, the Thin server is correctly running the site (confirmed by commenting out the breakpoint).
Gemfile
source :rubygems
gem 'sinatra'
gem 'thin'
gem 'debugger-pry'
Rakefile
task :start do
conf = File.expand_path('config.ru', File.dirname(__FILE__))
`thin -e development -R #{conf} --debug start`
end
config.ru
require File.expand_path('app', File.dirname(__FILE__))
run ModularExample::App.new
app.rb
require 'sinatra'
require 'debugger/pry'
module ModularExample
class App < Sinatra::Base
get '/' do
debugger
"Hello, world"
end
end
end