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
93 94 95 |
# File 'lib/bundle_depot/cache.rb', line 93 def cached?(file) super(packed_file(file)) end |
#fetch(file, dest_dir) ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/bundle_depot/cache.rb', line 113 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
124 125 126 |
# File 'lib/bundle_depot/cache.rb', line 124 def packed_file(file) file + ".tar.gz" end |
#store(file) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/bundle_depot/cache.rb', line 97 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 |