Add rubocop to our build. (#5004)

This commit is contained in:
Guo Xiang Tan
2017-07-28 10:20:09 +09:00
committed by GitHub
parent ff4e295c4f
commit 5012d46cbd
871 changed files with 5480 additions and 6056 deletions

View File

@ -5,19 +5,19 @@ module Middleware
# due to the files not being present locally. This middleware, only enabled in development
# mode, will replace those with an appropriate image.
class MissingAvatars
def initialize(app, settings={})
def initialize(app, settings = {})
@app = app
end
def call(env)
if (env['REQUEST_PATH'] =~ /^\/uploads\/default\/avatars/)
path = "#{Rails.root}/public#{env['REQUEST_PATH']}"
unless File.exist?(path)
unless File.exist?(path)
default_image = "#{Rails.root}/public/images/d-logo-sketch-small.png"
return [ 200, { 'Content-Type' => 'image/png' }, [ File.read(default_image)] ]
end
end
status, headers, response = @app.call(env)
[status, headers, response]
end