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", __FILE__)

Class Method Summary collapse

Class Method Details

.configuration(&block) ⇒ Object



28
29
30
# File 'lib/yast/tasks.rb', line 28

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

.spec_versionObject

read the version from spec file



33
34
35
36
37
38
# File 'lib/yast/tasks.rb', line 33

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



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/yast/tasks.rb', line 40

def self.submit_to(target, file = TARGETS_FILE)
  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