Class: RailsZero::PackagesClient

Inherits:
BaseClient show all
Defined in:
app/clients/rails_zero/packages_client.rb

Instance Method Summary collapse

Instance Method Details

#download_destinationObject



5
6
7
# File 'app/clients/rails_zero/packages_client.rb', line 5

def download_destination
  Rails.root.join('tmp', 'rails_zero', 'downloads', 'public.tar').to_s
end

#getObject



9
10
11
12
13
14
15
# File 'app/clients/rails_zero/packages_client.rb', line 9

def get
  remote_url = File.join(RailsZero.config.backend.url, packages_path)
  FileUtils.mkdir_p(File.dirname(download_destination))
  command = "curl #{remote_url} > #{download_destination}"
  stdout_str, stderr_str, status = Open3.capture3(command)
  Rails.logger.error stderr_str
end