1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
require_relative '../config/config'
require_relative 'package'
require 'net/http'
require 'pathname'
require 'progressbar'
require 'term/ansicolor'
module SlackBuilder
extend Rake::FileUtilsExt
def self.clone(repo, tarball, tag_prefix = 'v')
`./bin/slackbuilder clone #{repo} #{tarball} #{tag_prefix}`
end
def self.download(uri, target)
`./bin/slackbuilder download #{uri} #{target}`.strip
end
def self.hosted_sources(absolute_url)
CONFIG[:download_url] + absolute_url
end
def self.remote_file_exists?(url)
`./bin/slackbuilder exists #{url}`.strip == 'True'
end
def self.download_and_deploy(uri, tarball)
`./bin/slackbuilder deploy #{uri} #{tarball}`.strip
end
private_class_method def self.upload_command(local_path, remote_path)
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
end
private_class_method def self.clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
sh './bin/slackbuilder', 'archive', repo, name_version, tarball, tag_prefix
end
end
def write_info(package, downloads:)
File.write "slackbuilds/#{package.path}/#{package.name}.info",
info_template(package, downloads)
end
def update_slackbuild_version(package_path, version)
sh './bin/slackbuilder', 'slackbuild', package_path, version
end
def commit(package_path, version)
sh './bin/slackbuilder', 'commit', package_path, version
end
|