lib/github_snapshot/repository.rb in github_snapshot-0.1.2 vs lib/github_snapshot/repository.rb in github_snapshot-0.1.3
- old
+ new
@@ -11,11 +11,11 @@
attr_reader :name, :folder, :wiki_folder, :ssh_url, :wiki_ssh_url,
:canonical_name, :pushed_at, :gh_has_wiki, :organization
def initialize(repo, organization)
@name = repo['name']
- @folder = "#{@name}-#{GithubSnapshot.time_now}.git"
+ @folder = "#{@name}-GST-#{GithubSnapshot.time_now}.git"
@wiki_folder = @folder.gsub('.git', '.wiki.git')
@ssh_url = repo['ssh_url']
@wiki_ssh_url = @ssh_url.gsub('.git', '.wiki.git')
@canonical_name = "#{organization.name}/#{@name}"
@pushed_at = repo['pushed_at']
@@ -78,16 +78,16 @@
GithubSnapshot.exec "rm -rf #{wiki_folder}"
end
def prune_old_backups
GithubSnapshot.logger.info "#{canonical_name} - pruning old backups"
- file_regex = "#{name}*"
+ file_regex = "#{name}-GST-*"
zipped_bkps = FileList[file_regex].exclude(/wiki/)
zipped_bkps.sort[0..-(GithubSnapshot.releases_to_keep + 1)].each do |file|
File.delete file
end if zipped_bkps.length > GithubSnapshot.releases_to_keep
- wiki_regex = "#{name}*wiki*"
+ wiki_regex = "#{name}-GST-*wiki*"
zipped_wikis = FileList[wiki_regex]
zipped_wikis.sort[0..-(GithubSnapshot.releases_to_keep + 1)].each do |file|
File.delete file
end if zipped_wikis.length > GithubSnapshot.releases_to_keep
end