diff options
| author | Eugen Wissner <belka@caraus.de> | 2022-06-17 22:49:30 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2022-06-17 22:49:30 +0200 |
| commit | bdb3b929fba2f7989141d1b1c859f56da9bbd8d4 (patch) | |
| tree | 52a27d7ae03080e1ba2fd3fd28666830a02bca13 /lib | |
| parent | d349a90636f859cf789f70e9185c6efe416e59b0 (diff) | |
| download | slackbuilder-bdb3b929fba2f7989141d1b1c859f56da9bbd8d4.tar.gz | |
Add hhvm subtasks
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/download.rb | 20 | ||||
| -rw-r--r-- | lib/package.rb | 4 |
2 files changed, 24 insertions, 0 deletions
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 diff --git a/lib/package.rb b/lib/package.rb index ab31ce6..39a36c6 100644 --- a/lib/package.rb +++ b/lib/package.rb @@ -17,6 +17,10 @@ class Package def name File.basename @path end + + def name_version + "#{name}-#{@version}" + end end class Download |
