From 2910a89d6c59b997a3896f05c6ad7fb65c26f813 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 9 Dec 2020 18:28:42 +0100 Subject: Add autoupdater --- lib/package.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/package.rb (limited to 'lib/package.rb') diff --git a/lib/package.rb b/lib/package.rb new file mode 100644 index 0000000..7bc81ec --- /dev/null +++ b/lib/package.rb @@ -0,0 +1,38 @@ +# 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 + +class Package + attr_reader :path + attr_reader :version + attr_reader :homepage + attr_reader :requires + + def initialize(path, version:, homepage:, requires: []) + @path = path + @version = version + @homepage = homepage + @requires = requires + end + + def name + File.basename @path + end +end + +def info_template(package, download, md5sum) + <<~INFO_FILE + PRGNAM="#{package.name}" + VERSION="#{package.version}" + HOMEPAGE="#{package.homepage}" + DOWNLOAD="#{download * " \\\n "}" + MD5SUM="#{md5sum * " \\\n "}" + DOWNLOAD_x86_64="" + MD5SUM_x86_64="" + REQUIRES="#{package.requires * ' '}" + MAINTAINER="Eugene Wissner" + EMAIL="belka@caraus.de" + INFO_FILE +end -- cgit v1.2.3