whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: prep for site wide assets
Date Mon, 08 May 2017 20:30:38 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  38f863d   prep for site wide assets
38f863d is described below

commit 38f863d9b290bcfd400f1facb2970456559848d3
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon May 8 16:29:57 2017 -0400

    prep for site wide assets
---
 lib/whimsy/asf/rack.rb | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/whimsy/asf/rack.rb b/lib/whimsy/asf/rack.rb
index 106e1ab..7da0771 100644
--- a/lib/whimsy/asf/rack.rb
+++ b/lib/whimsy/asf/rack.rb
@@ -173,6 +173,25 @@ module ASF
     end
   end
 
+  # compute document root for the site
+  class DocumentRoot
+    def initialize(app)
+      @app = app
+    end
+
+    def call(env)
+      unless ENV['DOCUMENT_ROOT']
+        base = Dir.pwd
+        if base.end_with? ENV['PASSENGER_BASE_URI']
+          base = base[0...-ENV['PASSENGER_BASE_URI'].length]
+        end
+        ENV['DOCUMENT_ROOT'] = base
+      end
+
+      return @app.call(env)
+    end
+  end
+
   # Apache httpd on whimsy-vm is behind a proxy that converts https
   # requests into http requests.  Update the environment variables to
   # match.

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message