Add development server with WebDAV method support
Puma 6+ rejects non-standard HTTP methods by default, requiring
explicit configuration to allow PROPFIND and REPORT.

Assisted-by: Claude Opus 4.5 via Claude Code
change qpvnsqqwulqtkswppzqyqnmsrzrnqlul
commit c3c17402d2af244fc342348837b92f725afe34d0
author Alpha Chen <alpha@kejadlen.dev>
date
parent zmmoskqz
diff --git a/Rakefile b/Rakefile
index cc4ae53..c41175e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -4,4 +4,9 @@ require "minitest/test_task"
 
 Minitest::TestTask.create
 
+desc "Start development server"
+task :dev do
+  sh "rackup", "-o", "localhost"
+end
+
 task default: :test
diff --git a/TODO.md b/TODO.md
index aa1b9de..ed70a72 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,3 +2,4 @@
 - [ ] Disable Sentry in tests
 - [ ] Add type checking
 - [ ] Hide warnings when requiring Sentry (CGI)
+- [ ] Consolidate configuration
diff --git a/config.ru b/config.ru
index 21df719..1e73f99 100644
--- a/config.ru
+++ b/config.ru
@@ -1,5 +1,9 @@
 # frozen_string_literal: true
 
-require_relative "lib/pro_tacts/web"
+require "sentry-ruby"
+use Sentry::Rack::CaptureExceptions
+
+$LOAD_PATH.unshift File.expand_path("lib", __dir__)
+require "pro_tacts/web"
 
 run ProTacts::Web.freeze.app
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 0000000..a1dbc39
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,4 @@
+# frozen_string_literal: true
+
+# Allow WebDAV methods (PROPFIND, REPORT) in addition to standard HTTP methods
+supported_http_methods %w[GET HEAD OPTIONS PROPFIND REPORT]
diff --git a/lib/pro_tacts/web.rb b/lib/pro_tacts/web.rb
index 687e1a5..09c961f 100644
--- a/lib/pro_tacts/web.rb
+++ b/lib/pro_tacts/web.rb
@@ -1,10 +1,7 @@
 # frozen_string_literal: true
 
-require "roda"
 require "sentry-ruby"
 
-require "roda/plugins/dav_verbs"
-
 Sentry.init do |config|
   # TODO: Consolidate configuration
   config.dsn = ENV.fetch("SENTRY_DSN")
@@ -20,6 +17,10 @@ Sentry.init do |config|
   config.traces_sample_rate = 1.0
 end
 
+require "roda"
+
+require "roda/plugins/dav_verbs"
+
 module ProTacts
   class Web < Roda
     plugin :all_verbs