diff options
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | lib/gitlab_projects.rb | 7 | ||||
-rw-r--r-- | spec/gitlab_projects_spec.rb | 15 |
3 files changed, 25 insertions, 0 deletions
@@ -1,3 +1,6 @@ +v5.11.1 + - Add a 'create-hooks' command to gitlab-projects + v5.11.0 - Introduce a more-complete implementation of bin/authorized_keys (!178) diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 6700735..7da97ae 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -57,6 +57,9 @@ class GitlabProjects create_tag when 'add-project'; add_project + when 'create-hooks'; + # To avoid confusion with self.class.create_hooks + create_project_hooks when 'list-projects'; puts list_projects when 'rm-project'; @@ -182,6 +185,10 @@ class GitlabProjects system(*cmd) && self.class.create_hooks(full_path) end + def create_project_hooks + self.class.create_hooks(full_path) + end + def list_projects $logger.info 'Listing projects' Dir.chdir(repos_path) do diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index 7cf408b..7eb0593 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -55,6 +55,21 @@ describe GitlabProjects do it { File.readlink(hooks_dir).should == target_hooks_dir } end + + context 'with command-line arguments' do + before do + FileUtils.mkdir_p repo_path + argv('create-hooks', tmp_repos_path, 'hook-test.git') + gl_projects = GitlabProjects.new + gl_projects.exec + end + + after do + FileUtils.rm_f(repo_path) + end + + it { File.readlink(hooks_dir).should == target_hooks_dir } + end end describe :initialize do |