lib/zhong/web.rb in zhong-0.1.7 vs lib/zhong/web.rb in zhong-0.1.8
- old
+ new
@@ -8,23 +8,25 @@
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"]
+ # :nocov:
use Rack::Auth::Basic, "Sorry." do |username, password|
username == ENV["ZHONG_WEB_USERNAME"] and password == ENV["ZHONG_WEB_PASSWORD"]
end
+ # :nocov:
end
if ENV["RACK_ENV"] == "development"
+ # :nocov:
before do
STDERR.puts "[params] #{params}" unless params.empty?
end
+ # :nocov:
end
- # :nocov:
set :root, File.expand_path(File.dirname(__FILE__) + "/../../web")
set :public_folder, proc { "#{root}/assets" }
set :views, proc { "#{root}/views" }
@@ -69,14 +71,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
+ # :nocov:
def each(&block)
hash = self.to_hash
hash.each(&block)
end
+ # :nocov:
end
- # :nocov:
end