Class: Golem::Command::ClearRepositories

Inherits:
Base
  • Object
show all
Defined in:
lib/golem/command/clear_repositories.rb

Overview

Command for clearing repositories, suitable for cron.

Instance Method Summary collapse

Methods inherited from Base

#command, #initialize, #verbose?

Constructor Details

This class inherits a constructor from Golem::Command::Base

Instance Method Details

#runObject

Run the command. Removes every ‘*.git’ directory in Golem::Config.repository_base_path unless Access.repositories includes repository. Calls DeleteRepository.



8
9
10
11
12
13
14
15
# File 'lib/golem/command/clear_repositories.rb', line 8

def run
	repos = Golem::Access.repositories
	Dir.glob(Golem::Config.repository_base_path + '/*.git').each do |repo_path|
 repo = File.basename(repo_path)[0..-5]
 next if repos.include?(repo)
 command :delete_repository, repo
	end
end