summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2022-06-17 22:49:30 +0200
committerEugen Wissner <belka@caraus.de>2022-06-17 22:49:30 +0200
commitbdb3b929fba2f7989141d1b1c859f56da9bbd8d4 (patch)
tree52a27d7ae03080e1ba2fd3fd28666830a02bca13 /lib
parentd349a90636f859cf789f70e9185c6efe416e59b0 (diff)
downloadslackbuilder-bdb3b929fba2f7989141d1b1c859f56da9bbd8d4.tar.gz
Add hhvm subtasks
Diffstat (limited to 'lib')
-rw-r--r--lib/download.rb20
-rw-r--r--lib/package.rb4
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