Class: BundleDepot::PackingDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- BundleDepot::PackingDecorator
- Defined in:
- lib/bundle_depot/cache.rb
Instance Method Summary collapse
- #cached?(file) ⇒ Boolean
- #fetch(file, dest_dir) ⇒ Object
- #packed_file(file) ⇒ Object
- #store(file) ⇒ Object
Instance Method Details
#cached?(file) ⇒ Boolean
91 92 93 |
# File 'lib/bundle_depot/cache.rb', line 91 def cached?(file) super(packed_file(file)) end |
#fetch(file, dest_dir) ⇒ Object
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/bundle_depot/cache.rb', line 111 def fetch(file, dest_dir) source = packed_file(file) target = File.join(dest_dir, source) super(source, dest_dir) puts "=> Unpacking #{target}" `tar -C #{dest_dir} -xf #{target}` raise ArchivingFailed unless $?.exitstatus == 0 end |
#packed_file(file) ⇒ Object
122 123 124 |
# File 'lib/bundle_depot/cache.rb', line 122 def packed_file(file) file + ".tar.gz" end |
#store(file) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/bundle_depot/cache.rb', line 95 def store(file) working_dir = File.(File.dirname(file)) source = File.basename(file) target = packed_file(file) raise BundleNotFound unless File.exists? file unless File.exist?(target) puts "=> Packing bundle" `tar -C #{working_dir} -czf #{target} #{source}` raise ArchivingFailed unless $?.exitstatus == 0 end super(target) end |