Commit 1b2068eaa91e5002d01a220c65da21dad8ccb071

Authored by Dmitriy Zaporozhets
1 parent 09831488

Gem updates & githost logger

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