From bdb3b929fba2f7989141d1b1c859f56da9bbd8d4 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 17 Jun 2022 22:49:30 +0200 Subject: Add hhvm subtasks --- lib/download.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/download.rb') diff --git a/lib/download.rb b/lib/download.rb index 5777e64..6d1b7fb 100644 --- a/lib/download.rb +++ b/lib/download.rb @@ -7,6 +7,26 @@ require_relative '../config/config' require_relative 'package' require 'net/http' +require 'pathname' + +module SlackBuilder + extend Rake::FileUtilsExt + + def self.clone(repo, package, tag_prefix = 'v') + repository = Pathname.new('pkg') + package.name_version + + if repository.directory? + sh 'git', '-C', repository.to_path, 'remote', 'update', '--prune' + else + sh 'git', 'clone', repo, repository.to_path + end + + sh 'git', '-C', repository.to_path, 'checkout', "#{tag_prefix}#{package.version}" + sh 'git', '-C', repository.to_path, 'submodule', 'update', '--init', '--recursive' + + repository + end +end def write_download(target, response) checksum = Digest::MD5.new -- cgit v1.2.3