diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-03 20:43:25 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-03 20:43:25 +0200 |
commit | e620575dcdfa3214229d5e660016e6410117729f (patch) | |
tree | 7feb657b070e2290240eb32ada29ede3d3f74d35 /lib/gitlab_shell.rb | |
parent | bb9863e87055daf8347de65847c4a0a82ab0dfa8 (diff) | |
download | gitlab-shell-e620575dcdfa3214229d5e660016e6410117729f.tar.gz |
working git upload
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r-- | lib/gitlab_shell.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb new file mode 100644 index 0000000..4d4d240 --- /dev/null +++ b/lib/gitlab_shell.rb @@ -0,0 +1,31 @@ +require 'open3' +class GitlabShell + attr_accessor :username, :repo_name, :git_cmd + + def initialize + @username = ARGV.shift + @origin_cmd = ENV['SSH_ORIGINAL_COMMAND'] + end + + def exec + if @origin_cmd + parse_cmd + + return system("git-upload-pack /home/gip/repositories/#{@repo_name}") + else + puts "Welcome #{@username}!" + end + end + + protected + + def parse_cmd + args = @origin_cmd.split(' ') + @git_cmd = args.shift + @repo_name = args.shift + end + + def git_cmds + %w(git-upload-pack git-receive-pack git-upload-archive) + end +end |