Commit 6c66c374 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

issue #94

parent 02ce7489
...@@ -8,7 +8,7 @@ gem 'stamp' ...@@ -8,7 +8,7 @@ gem 'stamp'
gem 'will_paginate', '~> 3.0' gem 'will_paginate', '~> 3.0'
gem 'haml-rails' gem 'haml-rails'
gem 'jquery-rails' gem 'jquery-rails'
gem 'grit' gem 'grit', :git => 'git://github.com/mojombo/grit.git'
gem "carrierwave" gem "carrierwave"
gem 'six' gem 'six'
gem 'therubyracer' gem 'therubyracer'
......
...@@ -13,6 +13,15 @@ GIT ...@@ -13,6 +13,15 @@ GIT
activerecord (~> 3.1.0.rc4) activerecord (~> 3.1.0.rc4)
activesupport (~> 3.1.0.rc4) activesupport (~> 3.1.0.rc4)
GIT
remote: git://github.com/mojombo/grit.git
revision: ff015074ef35bd94cba943f9c0f98e161ab5851c
specs:
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
GIT GIT
remote: git://github.com/randx/albino.git remote: git://github.com/randx/albino.git
revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1 revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1
...@@ -98,9 +107,6 @@ GEM ...@@ -98,9 +107,6 @@ GEM
i18n (~> 0.4) i18n (~> 0.4)
ffi (1.0.9) ffi (1.0.9)
git (1.2.5) git (1.2.5)
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
haml (3.1.3) haml (3.1.3)
haml-rails (0.3.4) haml-rails (0.3.4)
actionpack (~> 3.0) actionpack (~> 3.0)
...@@ -247,7 +253,7 @@ DEPENDENCIES ...@@ -247,7 +253,7 @@ DEPENDENCIES
devise (= 1.4.7) devise (= 1.4.7)
faker faker
git git
grit grit!
haml-rails haml-rails
inifile inifile
jquery-rails jquery-rails
......
require 'inifile' require 'inifile'
require 'timeout' require 'timeout'
require 'fileutils'
class Gitosis class Gitosis
class AccessDenied < StandardError; end class AccessDenied < StandardError; end
def pull def pull
# create tmp dir # create tmp dir
@local_dir = File.join(Dir.tmpdir,"gitme-gitosis-#{Time.now.to_i}") @local_dir = File.join(Dir.tmpdir,"gitlabhq-gitosis-#{Time.now.to_i}")
Dir.mkdir @local_dir Dir.mkdir @local_dir
...@@ -17,12 +19,12 @@ class Gitosis ...@@ -17,12 +19,12 @@ class Gitosis
@repo.commit_all "Gitlab" @repo.commit_all "Gitlab"
@repo.push @repo.push
`rm -Rf #{@local_dir}` #FileUtils.rm_rf(@local_dir)
end end
def configure def configure
status = Timeout::timeout(5) { status = Timeout::timeout(5) do
File.open(File.join(Dir.tmpdir,"gitme-gitosis.lock"), "w+") do |f| File.open(File.join(Dir.tmpdir,"gitlabhq-gitosis.lock"), "w+") do |f|
f.flock(File::LOCK_EX) f.flock(File::LOCK_EX)
pull pull
...@@ -31,13 +33,13 @@ class Gitosis ...@@ -31,13 +33,13 @@ class Gitosis
f.flock(File::LOCK_UN) f.flock(File::LOCK_UN)
end end
} end
rescue Exception => ex rescue Exception => ex
raise Gitosis::AccessDenied.new("gitosis timeout") raise Gitosis::AccessDenied.new("gitosis timeout")
end end
def destroy_project(project) def destroy_project(project)
`rm -Rf #{project.path_to_repo}` #FileUtils.rm_rf(project.path_to_repo)
conf = IniFile.new(File.join(@local_dir,'gitosis','gitosis.conf')) conf = IniFile.new(File.join(@local_dir,'gitosis','gitosis.conf'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment