Commit 1b2068eaa91e5002d01a220c65da21dad8ccb071

Authored by Dmitriy Zaporozhets
1 parent 09831488

Gem updates & githost logger

* Grit gem updated
* gitolite-client updated
* logger added
* few fixes
@@ -11,8 +11,8 @@ gem "kaminari" @@ -11,8 +11,8 @@ gem "kaminari"
11 gem "haml", "3.1.4" 11 gem "haml", "3.1.4"
12 gem "haml-rails" 12 gem "haml-rails"
13 gem "jquery-rails" 13 gem "jquery-rails"
14 -gem "grit", :git => "https://github.com/gitlabhq/grit.git"  
15 -gem "gitolite", :git => "https://github.com/gitlabhq/gitolite-client.git" 14 +gem "grit", :git => "https://github.com/gitlabhq/grit.git", :ref => "810e3c11787e9d84c5925a7edc3264db0f04bb49"
  15 +gem "gitolite", :git => "https://github.com/gitlabhq/gitolite-client.git", :ref => "9b715ca8bab6529f6c92204a25f84d12f25a6eb0"
16 gem "carrierwave" 16 gem "carrierwave"
17 gem "six" 17 gem "six"
18 gem "therubyracer" 18 gem "therubyracer"
@@ -6,17 +6,19 @@ GIT @@ -6,17 +6,19 @@ GIT
6 6
7 GIT 7 GIT
8 remote: https://github.com/gitlabhq/gitolite-client.git 8 remote: https://github.com/gitlabhq/gitolite-client.git
9 - revision: 36dabd226caa40ff052677719adaacbfe667b36c 9 + revision: 9b715ca8bab6529f6c92204a25f84d12f25a6eb0
  10 + ref: 9b715ca8bab6529f6c92204a25f84d12f25a6eb0
10 specs: 11 specs:
11 - gitolite (0.0.3.alpha)  
12 - grit (~> 2.4.1) 12 + gitolite (0.0.4.alpha)
  13 + grit (>= 2.4.1)
13 hashery (~> 1.4.0) 14 hashery (~> 1.4.0)
14 15
15 GIT 16 GIT
16 remote: https://github.com/gitlabhq/grit.git 17 remote: https://github.com/gitlabhq/grit.git
17 - revision: 3fc864f3c637e06e2fa7a81f6b48a5df58a9bc5b 18 + revision: 810e3c11787e9d84c5925a7edc3264db0f04bb49
  19 + ref: 810e3c11787e9d84c5925a7edc3264db0f04bb49
18 specs: 20 specs:
19 - grit (2.4.1) 21 + grit (2.5.0)
20 diff-lcs (~> 1.1) 22 diff-lcs (~> 1.1)
21 mime-types (~> 1.15) 23 mime-types (~> 1.15)
22 posix-spawn (~> 0.3.6) 24 posix-spawn (~> 0.3.6)
app/controllers/commits_controller.rb
@@ -15,6 +15,7 @@ class CommitsController < ApplicationController @@ -15,6 +15,7 @@ class CommitsController < ApplicationController
15 def index 15 def index
16 @repo = project.repo 16 @repo = project.repo
17 @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) 17 @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
  18 +
18 @commits = @project.commits(@ref, params[:path], @limit, @offset) 19 @commits = @project.commits(@ref, params[:path], @limit, @offset)
19 20
20 respond_to do |format| 21 respond_to do |format|
app/helpers/application_helper.rb
@@ -2,6 +2,7 @@ require 'digest/md5' @@ -2,6 +2,7 @@ require 'digest/md5'
2 module ApplicationHelper 2 module ApplicationHelper
3 3
4 def gravatar_icon(user_email = '', size = 40) 4 def gravatar_icon(user_email = '', size = 40)
  5 + return unless user_email
5 gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" 6 gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com"
6 user_email.strip! 7 user_email.strip!
7 "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon" 8 "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon"
app/models/commit.rb
@@ -73,7 +73,7 @@ class Commit @@ -73,7 +73,7 @@ class Commit
73 repo.commits(ref, limit, offset) 73 repo.commits(ref, limit, offset)
74 else 74 else
75 repo.commits(ref) 75 repo.commits(ref)
76 - end.map{ |c| Commit.new(c) } 76 + end.map{ |c| Commit.new(c) }
77 end 77 end
78 78
79 def commits_between(repo, from, to) 79 def commits_between(repo, from, to)
lib/gitlabhq/encode.rb
@@ -3,6 +3,8 @@ module Gitlabhq @@ -3,6 +3,8 @@ module Gitlabhq
3 extend self 3 extend self
4 4
5 def utf8 message 5 def utf8 message
  6 + return nil unless message
  7 +
6 hash = CharlockHolmes::EncodingDetector.detect(message) rescue {} 8 hash = CharlockHolmes::EncodingDetector.detect(message) rescue {}
7 if hash[:encoding] 9 if hash[:encoding]
8 CharlockHolmes::Converter.convert(message, hash[:encoding], 'UTF-8') 10 CharlockHolmes::Converter.convert(message, hash[:encoding], 'UTF-8')
lib/gitlabhq/gitolite.rb
@@ -46,6 +46,7 @@ module Gitlabhq @@ -46,6 +46,7 @@ module Gitlabhq
46 end 46 end
47 end 47 end
48 rescue Exception => ex 48 rescue Exception => ex
  49 + Gitlabhq::Logger.error(ex.message)
49 raise Gitolite::AccessDenied.new("gitolite timeout") 50 raise Gitolite::AccessDenied.new("gitolite timeout")
50 end 51 end
51 52
lib/gitlabhq/logger.rb 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +module Gitlabhq
  2 + class Logger
  3 + def self.error(message)
  4 + @@logger ||= ::Logger.new(File.join(Rails.root, "log/githost.log"))
  5 + @@logger.error(message)
  6 + end
  7 + end
  8 +end