From 6cd167eaac7b764bcaefe31a9144dd38992cc9ab Mon Sep 17 00:00:00 2001 From: David Martin Date: Wed, 17 Sep 2014 11:35:16 +0100 Subject: Added list-projects command & spec list-projects command usage Single quotes Use single quotes Use single quotes --- lib/gitlab_projects.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/gitlab_projects.rb') diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 58bbd28..82ae519 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -31,7 +31,7 @@ class GitlabProjects @command = ARGV.shift @project_name = ARGV.shift @repos_path = GitlabConfig.new.repos_path - @full_path = File.join(@repos_path, @project_name) + @full_path = File.join(@repos_path, @project_name) unless @project_name.nil? end def exec @@ -41,6 +41,7 @@ class GitlabProjects when 'create-tag'; create_tag when 'rm-tag'; rm_tag when 'add-project'; add_project + when 'list-projects'; puts list_projects when 'rm-project'; rm_project when 'mv-project'; mv_project when 'import-project'; import_project @@ -93,6 +94,13 @@ class GitlabProjects system(*cmd) && self.class.create_hooks(full_path) end + def list_projects + $logger.info 'Listing projects' + Dir.chdir(repos_path) do + next Dir.glob('**/*.git') + end + end + def rm_project $logger.info "Removing project #{@project_name} from <#{full_path}>." FileUtils.rm_rf(full_path) -- cgit v1.2.1