Skip to content

Commit

Permalink
Load gem rackup via monkey-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Sep 19, 2024
1 parent 0843a63 commit 26b4fb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions jekyll-admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
spec.required_rubygems_version = ">= 2.7.0"

spec.add_runtime_dependency "jekyll", ">= 3.7", "< 5.0"
spec.add_runtime_dependency "rackup", "~> 2.0"
spec.add_runtime_dependency "sinatra", "~> 4.0"
spec.add_runtime_dependency "sinatra-contrib", "~> 4.0"
end
6 changes: 4 additions & 2 deletions lib/jekyll/commands/serve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def start_up_webrick(opts, destination)
end

def jekyll_admin_monkey_patch
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
@server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
Jekyll::External.require_with_graceful_fail "rackup"

@server.mount "/admin", Rackup::Handler::WEBrick, JekyllAdmin::StaticServer
@server.mount "/_api", Rackup::Handler::WEBrick, JekyllAdmin::Server
Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
end
end
Expand Down

0 comments on commit 26b4fb1

Please sign in to comment.