diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-05 15:55:28 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-05 15:55:28 +0200 |
commit | 43a55494f15084fe4c6ed5f9e7703a7bb092af86 (patch) | |
tree | 3478175de330bbd90b0557e2db2aa09bbc5fb0a0 | |
parent | e7a4d233c47743acfc788767c93fd7153269be31 (diff) | |
download | gitlab-shell-43a55494f15084fe4c6ed5f9e7703a7bb092af86.tar.gz |
add check bin
-rwxr-xr-x | bin/check | 31 | ||||
-rwxr-xr-x | bin/install | 1 | ||||
-rw-r--r-- | config.yml.example | 7 | ||||
-rw-r--r-- | lib/gitlab_net.rb | 4 |
4 files changed, 43 insertions, 0 deletions
diff --git a/bin/check b/bin/check new file mode 100755 index 0000000..e0c34ee --- /dev/null +++ b/bin/check @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +require_relative '../lib/gitlab_init' +require_relative '../lib/gitlab_net' + +# +# GitLab shell check task +# + +print "Check GitLab API access: " +resp = GitlabNet.new.check +if resp.code == "200" + print 'OK' +else + puts "FAILED. code: #{resp.code}" +end + +puts "\nCheck directories and files: " + +config = GitlabConfig.new +dirs = [config.repos_path, config.auth_file] + +dirs.each do |dir| + print "\t#{dir}: " + if File.exists?(dir) + print 'OK' + else + puts "FAILED" + end + puts "\n" +end diff --git a/bin/install b/bin/install index c9f5be3..f6b0974 100755 --- a/bin/install +++ b/bin/install @@ -9,6 +9,7 @@ require_relative '../lib/gitlab_init' commands = [ "mkdir -p /home/git/repositories", "mkdir -p /home/git/.ssh", + "touch /home/git/.ssh/authorized_keys", "chmod -R ug+rwX,o-rwx /home/git/repositories/", "find /home/git/repositories -type d -print0 | xargs -0 chmod g+s" ] diff --git a/config.yml.example b/config.yml.example index 01dcb68..c4fb088 100644 --- a/config.yml.example +++ b/config.yml.example @@ -1,4 +1,11 @@ +# GitLab user. git by default user: git + +# Url to gitlab instance. Used for api calls gitlab_url: "http://localhost/" + +# Repositories path repos_path: "/home/git/repositories" + +# File used as authorized_keys for gitlab user auth_file: "/home/git/.ssh/authorized_keys" diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index 745394a..93e9803 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -22,6 +22,10 @@ class GitlabNet JSON.parse(resp.body) end + def check + get("#{host}/check") + end + protected def host |