summaryrefslogtreecommitdiff
path: root/lib/download.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/download.rb')
-rw-r--r--lib/download.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/download.rb b/lib/download.rb
index cb09c42..56cabc3 100644
--- a/lib/download.rb
+++ b/lib/download.rb
@@ -72,20 +72,20 @@ def upload_command(local_path, remote_path)
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
end
-def clone_and_archive(repo, name_version, tarball)
+def clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
_, _, version = name_version.rpartition '-'
rm_rf name_version
- sh "git clone #{repo} #{name_version}"
- sh "git -C #{name_version} checkout v#{version}"
- sh "git -C #{name_version} submodule update --init --recursive"
+ sh 'git', 'clone', repo, name_version
+ sh 'git', '-C', name_version, 'checkout', "#{tag_prefix}#{version}"
+ sh 'git', '-C', name_version, 'submodule', 'update', '--init', '--recursive'
- sh "tar Jcvf slackbuilds/#{tarball} #{name_version}"
+ sh 'tar', 'Jcvf', "slackbuilds/#{tarball}", name_version
rm_rf name_version
end
-def clone(repo, tarball)
+def clone(repo, tarball, tag_prefix = 'v')
name_version = File.basename tarball, '.tar.xz'
remote_path = tarball[tarball.index('/')..]
@@ -95,7 +95,7 @@ def clone(repo, tarball)
return download(uri, "slackbuilds/#{tarball}").hexdigest
end
- clone_and_archive repo, name_version, tarball
+ clone_and_archive repo, name_version, tarball, tag_prefix
sh(*upload_command(tarball, remote_path))
@@ -115,9 +115,9 @@ def download_and_deploy(uri, tarball)
checksum.hexdigest
end
-def write_info(package, download:, md5sum:)
+def write_info(package, downloads:)
File.open "slackbuilds/#{package.path}/#{package.name}.info", 'w' do |file|
- file.write info_template(package, download, md5sum)
+ file.write info_template(package, downloads)
end
end