diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-05 10:28:19 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-05 10:28:19 +0200 |
commit | 58347e5321e42a1ea66663f96454dbb8632a0017 (patch) | |
tree | 3bbe572ac808345c4ab73b3a20a7f12b725f61cf | |
parent | 2b01b84f8d0cf469bdd3b031b1658db6fd8c0f52 (diff) | |
download | gitlab-shell-58347e5321e42a1ea66663f96454dbb8632a0017.tar.gz |
gitlab-init
-rwxr-xr-x | bin/gitlab-keys | 4 | ||||
-rwxr-xr-x | bin/gitlab-projects | 5 | ||||
-rwxr-xr-x | bin/gitlab-shell | 6 | ||||
-rwxr-xr-x | bin/install | 3 | ||||
-rw-r--r-- | lib/gitlab_init.rb | 2 | ||||
-rw-r--r-- | spec/gitlab_keys_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
7 files changed, 18 insertions, 6 deletions
diff --git a/bin/gitlab-keys b/bin/gitlab-keys index dc3876b..e6780ca 100755 --- a/bin/gitlab-keys +++ b/bin/gitlab-keys @@ -1,5 +1,7 @@ #!/usr/bin/env ruby +require_relative '../lib/gitlab_init' + # # GitLab Keys shell. Add/remove keys from ~/.ssh/authorized_keys # @@ -8,7 +10,7 @@ # # /bin/gitlab-keys rm-key dzaporozhets "ssh-rsa AAAAx321..." # -ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "..") + require File.join(ROOT_PATH, 'lib', 'gitlab_keys') GitlabKeys.new.exec diff --git a/bin/gitlab-projects b/bin/gitlab-projects index 223c69f..f34706f 100755 --- a/bin/gitlab-projects +++ b/bin/gitlab-projects @@ -1,13 +1,16 @@ #!/usr/bin/env ruby + +require_relative '../lib/gitlab_init' + # # GitLab Projects shell. Add/remove projects from /home/git/repositories # # Ex. # /bin/gitlab-projects add-project gitlab/gitlab-ci.git # +# /bin/gitlab-projects rm-project gitlab/gitlab-ci.git # -ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "..") require File.join(ROOT_PATH, 'lib', 'gitlab_projects') GitlabProjects.new.exec diff --git a/bin/gitlab-shell b/bin/gitlab-shell index 0c3b654..4b3dc16 100755 --- a/bin/gitlab-shell +++ b/bin/gitlab-shell @@ -4,10 +4,14 @@ unless ENV['SSH_CONNECTION'] puts "Only ssh allowed" exit end + +require_relative '../lib/gitlab_init' + +# # # GitLab shell, invoked from ~/.ssh/authorized_keys # -ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "..") +# require File.join(ROOT_PATH, 'lib', 'gitlab_shell') GitlabShell.new.exec diff --git a/bin/install b/bin/install index 000a265..c9f5be3 100755 --- a/bin/install +++ b/bin/install @@ -1,9 +1,10 @@ #!/usr/bin/env ruby +require_relative '../lib/gitlab_init' + # # GitLab shell, invoked from ~/.ssh/authorized_keys # -ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "..") commands = [ "mkdir -p /home/git/repositories", diff --git a/lib/gitlab_init.rb b/lib/gitlab_init.rb new file mode 100644 index 0000000..706a2a1 --- /dev/null +++ b/lib/gitlab_init.rb @@ -0,0 +1,2 @@ +ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..")) + diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb index 620b7b9..9d3df34 100644 --- a/spec/gitlab_keys_spec.rb +++ b/spec/gitlab_keys_spec.rb @@ -20,7 +20,7 @@ describe GitlabKeys do end it "should receive valid cmd" do - valid_cmd = "echo 'command=\"/home/git/gitlab-shell/spec/../bin/gitlab-shell dzaporozhets\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaDAxx2E' >> /home/git/.ssh/authorized_keys" + valid_cmd = "echo 'command=\"#{ROOT_PATH}/bin/gitlab-shell dzaporozhets\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaDAxx2E' >> /home/git/.ssh/authorized_keys" @gl_keys.should_receive(:system).with(valid_cmd) @gl_keys.send :add_key end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 23b518a..d42cf9e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1 @@ -ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "..") +ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..")) |