-
Notifications
You must be signed in to change notification settings - Fork 8
/
packages-red-data-tools-org-package-task.rb
55 lines (49 loc) · 1.47 KB
/
packages-red-data-tools-org-package-task.rb
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
require_relative "helper"
apache_arrow_repository = ENV["APACHE_ARROW_REPOSITORY"]
if apache_arrow_repository.nil?
raise "Specify APACHE_ARROW_REPOSITORY environment variable"
end
require "#{apache_arrow_repository}/dev/tasks/linux-packages/package-task"
class PackagesRedDataToolsOrgPackageTask < PackageTask
include Helper::Repository
def define
define_clean_tasks
super
define_release_tasks
end
private
def repositories_dir(target_namespace)
base_dir = __send__("#{target_namespace}_dir")
"#{base_dir}/repositories"
end
def release(target_namespace)
sh("rsync",
"-av",
"#{repositories_dir(target_namespace)}/",
"[email protected]:public/incoming/")
end
def define_clean_tasks
[:apt, :yum].each do |target_namespace|
namespace target_namespace do
desc "Clean #{target_namespace} packages"
task :clean do
if __send__("enable_#{target_namespace}?")
rm_rf(repositories_dir(target_namespace))
end
end
end
task target_namespace => "#{target_namespace}:clean"
end
end
def define_release_tasks
[:apt, :yum].each do |target_namespace|
namespace target_namespace do
desc "Release #{target_namespace} packages"
task :release do
release(target_namespace) if __send__("enable_#{target_namespace}?")
end
end
task target_namespace => "#{target_namespace}:release"
end
end
end