lib/zhong/web.rb in zhong-0.1.6 vs lib/zhong/web.rb in zhong-0.1.7

- old
+ new

@@ -8,10 +8,11 @@ module Zhong class Web < Sinatra::Base enable :sessions use ::Rack::Protection, use: :authenticity_token unless ENV["RACK_ENV"] == "test" + # :nocov: if ENV["ZHONG_WEB_USERNAME"] && ENV["ZHONG_WEB_PASSWORD"] use Rack::Auth::Basic, "Sorry." do |username, password| username == ENV["ZHONG_WEB_USERNAME"] and password == ENV["ZHONG_WEB_PASSWORD"] end end @@ -19,10 +20,11 @@ if ENV["RACK_ENV"] == "development" before do STDERR.puts "[params] #{params}" unless params.empty? end end + # :nocov: set :root, File.expand_path(File.dirname(__FILE__) + "/../../web") set :public_folder, proc { "#{root}/assets" } set :views, proc { "#{root}/views" } @@ -67,12 +69,14 @@ if defined?(::ActionDispatch::Request::Session) && !::ActionDispatch::Request::Session.respond_to?(:each) # mperham/sidekiq#2460 # Rack apps can't reuse the Rails session store without # this monkeypatch + # :nocov: class ActionDispatch::Request::Session def each(&block) hash = self.to_hash hash.each(&block) end end + # :nocov: end