Commit e93f1603f53f5d62798cd246222b32ea43729314
1 parent
b19a04f5
Exists in
master
and in
4 other branches
transition to gem git
Showing
3 changed files
with
7 additions
and
13 deletions
Show diff stats
Gemfile
| @@ -14,12 +14,11 @@ gem 'six' | @@ -14,12 +14,11 @@ gem 'six' | ||
| 14 | gem 'therubyracer' | 14 | gem 'therubyracer' |
| 15 | gem 'faker' | 15 | gem 'faker' |
| 16 | gem 'seed-fu', :branch => 'rails-3-1', :git => 'git://github.com/mbleigh/seed-fu.git' | 16 | gem 'seed-fu', :branch => 'rails-3-1', :git => 'git://github.com/mbleigh/seed-fu.git' |
| 17 | -gem "lockfile" | ||
| 18 | gem "inifile" | 17 | gem "inifile" |
| 19 | -gem "net-ssh" | ||
| 20 | gem "albino", :git => "git://github.com/randx/albino.git" | 18 | gem "albino", :git => "git://github.com/randx/albino.git" |
| 21 | gem "kaminari" | 19 | gem "kaminari" |
| 22 | gem "thin" | 20 | gem "thin" |
| 21 | +gem "git" | ||
| 23 | 22 | ||
| 24 | group :assets do | 23 | group :assets do |
| 25 | gem 'sass-rails', " ~> 3.1.0" | 24 | gem 'sass-rails', " ~> 3.1.0" |
Gemfile.lock
| @@ -97,6 +97,7 @@ GEM | @@ -97,6 +97,7 @@ GEM | ||
| 97 | faker (0.9.5) | 97 | faker (0.9.5) |
| 98 | i18n (~> 0.4) | 98 | i18n (~> 0.4) |
| 99 | ffi (1.0.9) | 99 | ffi (1.0.9) |
| 100 | + git (1.2.5) | ||
| 100 | grit (2.4.1) | 101 | grit (2.4.1) |
| 101 | diff-lcs (~> 1.1) | 102 | diff-lcs (~> 1.1) |
| 102 | mime-types (~> 1.15) | 103 | mime-types (~> 1.15) |
| @@ -121,14 +122,12 @@ GEM | @@ -121,14 +122,12 @@ GEM | ||
| 121 | libv8 (3.3.10.2) | 122 | libv8 (3.3.10.2) |
| 122 | linecache19 (0.5.12) | 123 | linecache19 (0.5.12) |
| 123 | ruby_core_source (>= 0.1.4) | 124 | ruby_core_source (>= 0.1.4) |
| 124 | - lockfile (1.4.3) | ||
| 125 | mail (2.3.0) | 125 | mail (2.3.0) |
| 126 | i18n (>= 0.4.0) | 126 | i18n (>= 0.4.0) |
| 127 | mime-types (~> 1.16) | 127 | mime-types (~> 1.16) |
| 128 | treetop (~> 1.4.8) | 128 | treetop (~> 1.4.8) |
| 129 | mime-types (1.16) | 129 | mime-types (1.16) |
| 130 | multi_json (1.0.3) | 130 | multi_json (1.0.3) |
| 131 | - net-ssh (2.2.1) | ||
| 132 | nokogiri (1.5.0) | 131 | nokogiri (1.5.0) |
| 133 | orm_adapter (0.0.5) | 132 | orm_adapter (0.0.5) |
| 134 | polyglot (0.3.2) | 133 | polyglot (0.3.2) |
| @@ -247,14 +246,13 @@ DEPENDENCIES | @@ -247,14 +246,13 @@ DEPENDENCIES | ||
| 247 | database_cleaner | 246 | database_cleaner |
| 248 | devise (= 1.4.7) | 247 | devise (= 1.4.7) |
| 249 | faker | 248 | faker |
| 249 | + git | ||
| 250 | grit | 250 | grit |
| 251 | haml-rails | 251 | haml-rails |
| 252 | inifile | 252 | inifile |
| 253 | jquery-rails | 253 | jquery-rails |
| 254 | kaminari | 254 | kaminari |
| 255 | launchy | 255 | launchy |
| 256 | - lockfile | ||
| 257 | - net-ssh | ||
| 258 | rails (= 3.1.0) | 256 | rails (= 3.1.0) |
| 259 | rails-footnotes (>= 3.7.5.rc4) | 257 | rails-footnotes (>= 3.7.5.rc4) |
| 260 | rspec-rails | 258 | rspec-rails |
lib/gitosis.rb
| 1 | -require 'lockfile' | ||
| 2 | require 'inifile' | 1 | require 'inifile' |
| 3 | -require 'net/ssh' | ||
| 4 | 2 | ||
| 5 | class Gitosis | 3 | class Gitosis |
| 6 | 4 | ||
| @@ -11,14 +9,13 @@ class Gitosis | @@ -11,14 +9,13 @@ class Gitosis | ||
| 11 | Dir.mkdir @local_dir | 9 | Dir.mkdir @local_dir |
| 12 | 10 | ||
| 13 | # clone repo | 11 | # clone repo |
| 14 | - `git clone #{GITOSIS['admin_uri']} #{@local_dir}/gitosis` | 12 | + @repo = Git.clone(GITOSIS['admin_uri'], "#{@local_dir}/gitosis") |
| 15 | end | 13 | end |
| 16 | 14 | ||
| 17 | def push | 15 | def push |
| 18 | - # add, commit, push, and remove local tmp dir | ||
| 19 | - `cd #{File.join(@local_dir,'gitosis')} ; git add keydir/* gitosis.conf` | ||
| 20 | - `cd #{File.join(@local_dir,'gitosis')} ; git commit -a -m 'updated by Gitlab Gitosis'` | ||
| 21 | - `cd #{File.join(@local_dir,'gitosis')} ; git push` | 16 | + @repo.add('.') |
| 17 | + @repo.commit_all "Gitlab" | ||
| 18 | + @repo.push | ||
| 22 | 19 | ||
| 23 | # remove local copy | 20 | # remove local copy |
| 24 | `rm -Rf #{@local_dir}` | 21 | `rm -Rf #{@local_dir}` |