Module: GitMedia::Clear

Defined in:
lib/git-media/clear.rb

Class Method Summary collapse

Class Method Details

.clear_local_cacheObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/git-media/clear.rb', line 11

def self.clear_local_cache
  # find files in media buffer and upload them
  all_cache = Dir.chdir(GitMedia.get_media_buffer) { Dir.glob('*') }
  unpushed_files = @push.get_unpushed(all_cache)
  pushed_files = all_cache - unpushed_files
  pushed_files.each do |sha|
    puts "removing " + sha[0, 8]
    File.unlink(File.join(GitMedia.get_media_buffer, sha))
  end
end

.run!Object



6
7
8
9
# File 'lib/git-media/clear.rb', line 6

def self.run!
  @push = GitMedia.get_push_transport
  self.clear_local_cache
end