Class: TerraspaceBundler::Mod::Fetcher::Gcs
- Extended by:
- Memoist
- Defined in:
- lib/terraspace_bundler/mod/fetcher/gcs.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#extract, #initialize, #switch_version
Constructor Details
This class inherits a constructor from TerraspaceBundler::Mod::Fetcher::Base
Instance Method Details
#download(bucket_name, key, path) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/terraspace_bundler/mod/fetcher/gcs.rb', line 33 def download(bucket_name, key, path) # Download to cache area bucket = storage.bucket(bucket_name) unless bucket logger.error "ERROR: bucket #{bucket_name} does not exist".color(:red) exit 1 end file = bucket.file(key) unless file logger.error "ERROR: Unable to find gs://#{bucket_name}/#{key}".color(:red) exit 1 end archive = cache_path(path) # temporary path logger.debug "Gcs save archive to #{archive}" FileUtils.mkdir_p(File.dirname(archive)) file.download(archive) # Save to stage dest = stage_path(rel_dest_dir) extract(archive, dest) end |
#run ⇒ Object
28 29 30 31 |
# File 'lib/terraspace_bundler/mod/fetcher/gcs.rb', line 28 def run bucket, key, path = gcs_info download(bucket, key, path) end |