summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-01-02 07:39:32 +0100
committerEugen Wissner <belka@caraus.de>2021-01-02 07:39:32 +0100
commit839d42faf4312a0e04772ccbf1e1f6ea8f2957cf (patch)
treeed3ea68c04ad12a87db31f0aebbc381c427216fa /lib
parent2910a89d6c59b997a3896f05c6ad7fb65c26f813 (diff)
downloadslackbuilder-839d42faf4312a0e04772ccbf1e1f6ea8f2957cf.tar.gz
Make remote paths configurable
Diffstat (limited to 'lib')
-rw-r--r--lib/download.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/download.rb b/lib/download.rb
index 49bb0c0..44a9553 100644
--- a/lib/download.rb
+++ b/lib/download.rb
@@ -4,6 +4,7 @@
# frozen_string_literal: true
+require_relative '../config/config'
require_relative 'package'
require 'net/http'
@@ -56,7 +57,7 @@ def download(uri, target)
end
def hosted_sources(absolute_url)
- "https://download.dlackware.com/hosted-sources#{absolute_url}"
+ CONFIG[:download_url] + absolute_url
end
def remote_file_exists?(url)
@@ -70,8 +71,7 @@ def remote_file_exists?(url)
end
def upload_command(local_path, remote_path)
- "scp slackbuilds/#{local_path} "\
- "caraus.de:/srv/httpd/dlackware/download/hosted-sources#{remote_path}"
+ ['scp', "slackbuilds/#{local_path} ", CONFIG[:remote_path] + remote_path]
end
def clone_and_archive(repo, name_version, tarball)
@@ -99,7 +99,7 @@ def clone(repo, tarball)
clone_and_archive repo, name_version, tarball
- sh upload_command(tarball, remote_path)
+ sh(*upload_command(tarball, remote_path))
Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
end
@@ -113,7 +113,7 @@ def download_and_deploy(uri, tarball)
end
checksum = download uri, "slackbuilds/#{tarball}"
- sh upload_command(tarball, remote_path)
+ sh(*upload_command(tarball, remote_path))
checksum.hexdigest
end