summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-11 00:07:40 +0300
committergitlabhq <m@gitlabhq.com>2011-10-11 00:07:40 +0300
commit162c4b044ee0890e774c30b19d17c0c5988c82d3 (patch)
tree9188264269727e9eca5ad0a2c352b2797e1c472a
parent25c9cbff89878482b1b9a8fa853fc2c426751178 (diff)
downloadgitlab-ce-162c4b044ee0890e774c30b19d17c0c5988c82d3.tar.gz
issue #94
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock14
-rw-r--r--lib/gitosis.rb24
3 files changed, 24 insertions, 16 deletions
diff --git a/Gemfile b/Gemfile
index bf64a37a3f9..31103bac861 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,7 +8,7 @@ gem 'stamp'
gem 'will_paginate', '~> 3.0'
gem 'haml-rails'
gem 'jquery-rails'
-gem 'grit'
+gem 'grit', :git => 'git://github.com/mojombo/grit.git'
gem "carrierwave"
gem 'six'
gem 'therubyracer'
diff --git a/Gemfile.lock b/Gemfile.lock
index dd97bd671d6..5a737549c4f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -14,6 +14,15 @@ GIT
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
remote: git://github.com/randx/albino.git
revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1
specs:
@@ -98,9 +107,6 @@ GEM
i18n (~> 0.4)
ffi (1.0.9)
git (1.2.5)
- grit (2.4.1)
- diff-lcs (~> 1.1)
- mime-types (~> 1.15)
haml (3.1.3)
haml-rails (0.3.4)
actionpack (~> 3.0)
@@ -247,7 +253,7 @@ DEPENDENCIES
devise (= 1.4.7)
faker
git
- grit
+ grit!
haml-rails
inifile
jquery-rails
diff --git a/lib/gitosis.rb b/lib/gitosis.rb
index e84eb891ab6..54d885011a1 100644
--- a/lib/gitosis.rb
+++ b/lib/gitosis.rb
@@ -1,11 +1,13 @@
require 'inifile'
require 'timeout'
+require 'fileutils'
+
class Gitosis
class AccessDenied < StandardError; end
def pull
# 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
@@ -17,27 +19,27 @@ class Gitosis
@repo.commit_all "Gitlab"
@repo.push
- `rm -Rf #{@local_dir}`
+ #FileUtils.rm_rf(@local_dir)
end
def configure
- status = Timeout::timeout(5) {
- File.open(File.join(Dir.tmpdir,"gitme-gitosis.lock"), "w+") do |f|
- f.flock(File::LOCK_EX)
+ status = Timeout::timeout(5) do
+ File.open(File.join(Dir.tmpdir,"gitlabhq-gitosis.lock"), "w+") do |f|
+ f.flock(File::LOCK_EX)
- pull
- yield(self)
- push
+ pull
+ yield(self)
+ push
- f.flock(File::LOCK_UN)
+ f.flock(File::LOCK_UN)
end
- }
+ end
rescue Exception => ex
raise Gitosis::AccessDenied.new("gitosis timeout")
end
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'))