Sha256: 7e87ce27d5348df784c75c47adb650b6cb7639c47337cc26f3148a3f23200e43

Contents?: true

Size: 1.71 KB

Versions: 20

Compression:

Stored size: 1.71 KB

Contents

#--
# Yast rake
#
# Copyright (C) 2009-2013 Novell, Inc.
#   This library is free software; you can redistribute it and/or modify
# it only under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
#   This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
#   You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#++

require "yaml"

# create wrapper to Packaging Configuration
module Yast
  # Yast::Task module contains helper methods
  module Tasks
    # Targets definition
    TARGETS_FILE = File.expand_path("../../../data/targets.yml", __FILE__)

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

    # read the version from spec file
    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

    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
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
yast-rake-0.2.22.1 lib/yast/tasks.rb
yast-rake-0.2.33 lib/yast/tasks.rb
yast-rake-0.2.32 lib/yast/tasks.rb
yast-rake-0.2.31 lib/yast/tasks.rb
yast-rake-0.2.30 lib/yast/tasks.rb
yast-rake-0.2.29 lib/yast/tasks.rb
yast-rake-0.2.28 lib/yast/tasks.rb
yast-rake-0.2.27 lib/yast/tasks.rb
yast-rake-0.2.26 lib/yast/tasks.rb
yast-rake-0.2.25 lib/yast/tasks.rb
yast-rake-0.2.24 lib/yast/tasks.rb
yast-rake-0.2.23 lib/yast/tasks.rb
yast-rake-0.2.22 lib/yast/tasks.rb
yast-rake-0.2.21 lib/yast/tasks.rb
yast-rake-0.2.20 lib/yast/tasks.rb
yast-rake-0.2.19 lib/yast/tasks.rb
yast-rake-0.2.17 lib/yast/tasks.rb
yast-rake-0.2.16 lib/yast/tasks.rb
yast-rake-0.2.15 lib/yast/tasks.rb
yast-rake-0.2.14 lib/yast/tasks.rb