Class: Xing::Static::RackApp
- Inherits:
-
Object
- Object
- Xing::Static::RackApp
- Defined in:
- lib/xing/static/rack_app.rb
Class Method Summary collapse
- .build(root_path, backend_port) ⇒ Object
-
.log_root ⇒ Object
Should be override by client app.
- .logpath_for_env(env) ⇒ Object
Class Method Details
.build(root_path, backend_port) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/xing/static/rack_app.rb', line 18 def self.build(root_path, backend_port) backend_url = "http://localhost:#{backend_port}/" env = ENV['RAILS_ENV'] || 'development' logger = Logger.new(logpath_for_env(env)) Rack::Builder.new do use BackendUrlCookie, backend_url use GotoParam use Rack::CommonLogger, logger use Rack::Static, { :urls => [""], :root => root_path, :index => "index.html", :header_rules => { :all => {"Cache-Control" => "no-cache, max-age=0" } #no caching development assets } } run proc{} end end |
.log_root ⇒ Object
Should be override by client app. Ironically, override with exactly this definition will usually work.
10 11 12 |
# File 'lib/xing/static/rack_app.rb', line 10 def self.log_root File.("../../log", __FILE__) end |
.logpath_for_env(env) ⇒ Object
14 15 16 |
# File 'lib/xing/static/rack_app.rb', line 14 def self.logpath_for_env(env) File.join( log_root, "#{env}_static.log") end |