Ask for updating packages
This commit is contained in:
parent
df4c9b4ae9
commit
a0788d2f3a
61
Rakefile
61
Rakefile
@ -15,8 +15,8 @@ require_relative 'lib/up2date'
|
||||
task :dmd, [:version] do |_, arguments|
|
||||
raise 'Version is not specified.' unless arguments.key? :version
|
||||
|
||||
dub_version = '1.32.1'
|
||||
dscanner_version = '0.14.0'
|
||||
dub_version = '1.33.0'
|
||||
dscanner_version = '0.15.2'
|
||||
dcd_version = '0.15.2'
|
||||
|
||||
SlackBuilder::DmdTools.update_dmd arguments[:version]
|
||||
@ -137,22 +137,63 @@ task 'rdiff-backup', [:version] do |_, arguments|
|
||||
commit 'system/rdiff-backup', arguments[:version]
|
||||
end
|
||||
|
||||
module SlackBuilder
|
||||
class Updater
|
||||
include Rake::FileUtilsExt
|
||||
|
||||
def update(version)
|
||||
raise NotImplementedError
|
||||
end
|
||||
end
|
||||
|
||||
class UniversalCtags < Updater
|
||||
def update(version)
|
||||
package = create_package version
|
||||
|
||||
uri = "https://github.com/universal-ctags/ctags/archive/#{version}/ctags-#{version}.tar.gz"
|
||||
tarball = "slackbuilds/development/universal-ctags/ctags-#{version}.tar.gz"
|
||||
checksum = SlackBuilder.download URI(uri), tarball
|
||||
download = "https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{version}.tar.gz"
|
||||
|
||||
write_info package, downloads: [Download.new(download, checksum.hexdigest)]
|
||||
update_slackbuild_version 'development/universal-ctags', version
|
||||
sh 'scp', tarball, "#{CONFIG[:remote_path]}/universal-ctags"
|
||||
|
||||
commit 'development/universal-ctags', version
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_package(version)
|
||||
Package.new 'development/universal-ctags',
|
||||
version: version,
|
||||
homepage: 'https://ctags.io/',
|
||||
requires: ['%README%']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
php_transform = proc do |version|
|
||||
version.delete_prefix 'php-' if version.match?(/^php-8\.2\.[[:digit:]+]$/)
|
||||
end
|
||||
|
||||
AUTO_UPDATABLE = {
|
||||
'universal-ctags' => SlackBuilder::GitHub.new('universal-ctags', 'ctags'),
|
||||
'composer' => SlackBuilder::Packagist.new('composer', 'composer'),
|
||||
'php82' => SlackBuilder::GitHub.new('php', 'php-src', php_transform),
|
||||
'rdiff-backup' => SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup'),
|
||||
'librsync' => SlackBuilder::GitHub.new('librsync', 'librsync'),
|
||||
'jitsi-meet-desktop' => SlackBuilder::GitHub.new('jitsi', 'jitsi-meet-electron'),
|
||||
'dmd' => SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')
|
||||
'universal-ctags' => [SlackBuilder::GitHub.new('universal-ctags', 'ctags'), SlackBuilder::UniversalCtags.new],
|
||||
'composer' => [SlackBuilder::Packagist.new('composer', 'composer')],
|
||||
'php82' => [SlackBuilder::GitHub.new('php', 'php-src', php_transform)],
|
||||
'rdiff-backup' => [SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup')],
|
||||
'librsync' => [SlackBuilder::GitHub.new('librsync', 'librsync')],
|
||||
'jitsi-meet-desktop' => [SlackBuilder::GitHub.new('jitsi', 'jitsi-meet-electron')],
|
||||
'dmd' => [SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')]
|
||||
}.freeze
|
||||
|
||||
task :up2date do
|
||||
AUTO_UPDATABLE.each do |key, value|
|
||||
SlackBuilder.check_for_latest key, value
|
||||
repository, updater = value
|
||||
latest_version = SlackBuilder.check_for_latest key, repository
|
||||
next if latest_version.nil? || updater.nil?
|
||||
|
||||
puts "Would like to update #{key} to #{latest_version} (y/N)? "
|
||||
updater.update latest_version if $stdin.gets.chomp.downcase.start_with? 'y'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user