diff options
author | David Martin <david.martin@feedhenry.com> | 2014-09-17 11:35:16 +0100 |
---|---|---|
committer | David Martin <david.martin@feedhenry.com> | 2014-10-15 10:28:12 +0100 |
commit | 6cd167eaac7b764bcaefe31a9144dd38992cc9ab (patch) | |
tree | 9528e100c69d4e2142edfaaa44701a693546ee4d /lib/gitlab_projects.rb | |
parent | 7e74d0547255a9cf60f00b9d9133aa8b2c546507 (diff) | |
download | gitlab-shell-6cd167eaac7b764bcaefe31a9144dd38992cc9ab.tar.gz |
Added list-projects command & spec
list-projects command usage
Single quotes
Use single quotes
Use single quotes
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r-- | lib/gitlab_projects.rb | 10 |
1 files changed, 9 insertions, 1 deletions
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) |