OSDN Git Service

transition to gem git
authorValera Sizov <vsv2711@gmail.com>
Sat, 8 Oct 2011 22:15:24 +0000 (15:15 -0700)
committerValera Sizov <vsv2711@gmail.com>
Sat, 8 Oct 2011 22:33:36 +0000 (15:33 -0700)
Gemfile
Gemfile.lock
lib/gitosis.rb

diff --git a/Gemfile b/Gemfile
index 466ab32..bf64a37 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -14,12 +14,11 @@ gem 'six'
 gem 'therubyracer'
 gem 'faker'
 gem 'seed-fu', :branch => 'rails-3-1', :git => 'git://github.com/mbleigh/seed-fu.git'
-gem "lockfile"
 gem "inifile"
-gem "net-ssh"
 gem "albino", :git => "git://github.com/randx/albino.git"
 gem "kaminari"
 gem "thin"
+gem "git"
 
 group :assets do
   gem 'sass-rails', "  ~> 3.1.0"
index e15f712..dd97bd6 100644 (file)
@@ -97,6 +97,7 @@ GEM
     faker (0.9.5)
       i18n (~> 0.4)
     ffi (1.0.9)
+    git (1.2.5)
     grit (2.4.1)
       diff-lcs (~> 1.1)
       mime-types (~> 1.15)
@@ -121,14 +122,12 @@ GEM
     libv8 (3.3.10.2)
     linecache19 (0.5.12)
       ruby_core_source (>= 0.1.4)
-    lockfile (1.4.3)
     mail (2.3.0)
       i18n (>= 0.4.0)
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
     mime-types (1.16)
     multi_json (1.0.3)
-    net-ssh (2.2.1)
     nokogiri (1.5.0)
     orm_adapter (0.0.5)
     polyglot (0.3.2)
@@ -247,14 +246,13 @@ DEPENDENCIES
   database_cleaner
   devise (= 1.4.7)
   faker
+  git
   grit
   haml-rails
   inifile
   jquery-rails
   kaminari
   launchy
-  lockfile
-  net-ssh
   rails (= 3.1.0)
   rails-footnotes (>= 3.7.5.rc4)
   rspec-rails
index d19fb23..d099782 100644 (file)
@@ -1,6 +1,4 @@
-require 'lockfile'
 require 'inifile'
-require 'net/ssh'
 
 class Gitosis
 
@@ -11,14 +9,13 @@ class Gitosis
     Dir.mkdir @local_dir
 
     # clone repo
-    `git clone #{GITOSIS['admin_uri']} #{@local_dir}/gitosis`
+    @repo = Git.clone(GITOSIS['admin_uri'], "#{@local_dir}/gitosis")
   end
 
   def push
-    # add, commit, push, and remove local tmp dir
-    `cd #{File.join(@local_dir,'gitosis')} ; git add keydir/* gitosis.conf`
-    `cd #{File.join(@local_dir,'gitosis')} ; git commit -a -m 'updated by Gitlab Gitosis'`
-    `cd #{File.join(@local_dir,'gitosis')} ; git push`
+    @repo.add('.')
+    @repo.commit_all "Gitlab"
+    @repo.push
 
     # remove local copy
     `rm -Rf #{@local_dir}`