Class: Sneaql::RepoManagers::HttpStoreRepoManager

Inherits:
Core::RepoDownloadManager show all
Defined in:
lib/sneaql_lib/repo_manager.rb

Overview

pulls single archive file from http/https source

Instance Attribute Summary

Attributes inherited from Core::RepoDownloadManager

#repo_base_dir

Instance Method Summary collapse

Methods inherited from Core::RepoDownloadManager

#drop_and_rebuild_directory, #initialize, #unzip_file

Constructor Details

This class inherits a constructor from Sneaql::Core::RepoDownloadManager

Instance Method Details

#manage_repoObject

Pulls a zip file from an HTTP store down to local file system then unzips it for use in transform.



62
63
64
65
66
67
68
# File 'lib/sneaql_lib/repo_manager.rb', line 62

def manage_repo
  drop_and_rebuild_directory(@repo_base_dir)
  pull_transform_repo_from_http_store(@params[:repo_url])
  if @params[:compression] == 'zip'
    unzip_file("#{@repo_base_dir}/#{File.basename(@params[:repo_url])}", @repo_base_dir)
  end
end

#pull_transform_repo_from_http_store(repo_url) ⇒ Object

Pulls the transfrom to local file system.

Parameters:

  • repo_url (String)


72
73
74
75
# File 'lib/sneaql_lib/repo_manager.rb', line 72

def pull_transform_repo_from_http_store(repo_url)
  @logger.info "repo #{repo_url} to #{@repo_base_dir}/#{File.basename(repo_url)}"
  File.write("#{@repo_base_dir}/#{File.basename(repo_url)}", open(repo_url).read)
end