Module: Yast::Tasks

Defined in:
lib/yast/tasks.rb

Overview

Yast::Task module contains helper methods

Constant Summary collapse

TARGETS_FILE =

Targets definition

File.expand_path("../../data/targets.yml", __dir__)

Class Method Summary collapse

Class Method Details

.configuration(&block) ⇒ Object



30
31
32
# File 'lib/yast/tasks.rb', line 30

def self.configuration(&block)
  ::Packaging.configuration(&block)
end

.spec_versionObject

read the version from spec file



35
36
37
38
39
40
# File 'lib/yast/tasks.rb', line 35

def self.spec_version
  # use the first *.spec file found, assume all spec files
  # contain the same version
  File.readlines(Dir.glob("package/*.spec").first)
    .grep(/^\s*Version:\s*/).first.sub("Version:", "").strip
end

.submit_to(target, file = TARGETS_FILE) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/yast/tasks.rb', line 42

def self.submit_to(target, file = TARGETS_FILE)
  # override the target via environment
  target = ENV["YAST_SUBMIT"].to_sym if ENV["YAST_SUBMIT"]

  targets = YAML.load_file(file)
  config = targets[target]
  if config.nil?
    raise "No configuration found for #{target}. Known values: #{targets.keys.join(", ")}"
  end

  Yast::Tasks.configuration do |conf|
    config.each do |meth, val|
      conf.public_send("#{meth}=", val)
    end
  end
end