Unify the generation of gh package descriptions
This commit is contained in:
parent
bb0748b400
commit
c7e300dc91
121
src/Main.hs
121
src/Main.hs
@ -31,93 +31,47 @@ import System.Console.ANSI
|
|||||||
, Color(..)
|
, Color(..)
|
||||||
, ConsoleLayer(..)
|
, ConsoleLayer(..)
|
||||||
)
|
)
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust, mapMaybe)
|
||||||
|
|
||||||
findUpdatable :: Text -> [PackageSettings] -> DownloaderSettings
|
findUpdatable :: Text -> [PackageSettings] -> DownloaderSettings
|
||||||
findUpdatable packageName = getField @"downloader" . fromJust
|
findUpdatable packageName = getField @"downloader" . fromJust
|
||||||
. find ((== packageName) . getField @"name" . getField @"downloader")
|
. find ((== packageName) . getField @"name" . getField @"downloader")
|
||||||
|
|
||||||
autoUpdatable :: [PackageSettings] -> [PackageDescription]
|
githubAutoUpdatables :: [PackageSettings] -> [PackageDescription]
|
||||||
autoUpdatable packageSettings =
|
githubAutoUpdatables = mapMaybe go
|
||||||
[ PackageDescription
|
where
|
||||||
|
go PackageSettings{ downloader = setting }
|
||||||
|
| Just githubSettings <- getField @"github" setting = Just
|
||||||
|
$ PackageDescription
|
||||||
{ latest =
|
{ latest =
|
||||||
let setting = findUpdatable "universal-ctags" packageSettings
|
let ghArguments = uncurry PackageOwner githubSettings
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
template = Package.DownloadTemplate $ getField @"template" setting
|
||||||
in Package.Updater
|
in Package.Updater
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
||||||
, is64 = getField @"is64" setting
|
, is64 = getField @"is64" setting
|
||||||
}
|
}
|
||||||
, name = "universal-ctags"
|
, name = getField @"name" setting
|
||||||
, downloaders = mempty
|
, downloaders = mempty
|
||||||
}
|
}
|
||||||
, PackageDescription
|
| Just packagistSettings <- getField @"packagist" setting = Just
|
||||||
|
$ PackageDescription
|
||||||
{ latest =
|
{ latest =
|
||||||
let setting = findUpdatable "composer" packageSettings
|
let packagistArguments = uncurry PackageOwner packagistSettings
|
||||||
packagistArguments = uncurry PackageOwner $ fromJust $ getField @"packagist" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
template = Package.DownloadTemplate $ getField @"template" setting
|
||||||
in Package.Updater
|
in Package.Updater
|
||||||
{ detectLatest = latestPackagist packagistArguments
|
{ detectLatest = latestPackagist packagistArguments
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
||||||
, is64 = getField @"is64" setting
|
, is64 = getField @"is64" setting
|
||||||
}
|
}
|
||||||
, name = "composer"
|
, name = getField @"name" setting
|
||||||
, downloaders = mempty
|
, downloaders = mempty
|
||||||
}
|
}
|
||||||
, PackageDescription
|
| otherwise = Nothing
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "jitsi-meet-desktop" packageSettings
|
autoUpdatable :: [PackageSettings] -> [PackageDescription]
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
autoUpdatable packageSettings = githubAutoUpdatables packageSettings ++
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
[ PackageDescription
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "jitsi-meet-desktop"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "php82" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "php82"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "kitty" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "kitty"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "rdiff-backup" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "rdiff-backup"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
{ latest =
|
||||||
let setting = findUpdatable "webex" packageSettings
|
let setting = findUpdatable "webex" packageSettings
|
||||||
textArguments = uncurry TextArguments $ fromJust $ getField @"text" setting
|
textArguments = uncurry TextArguments $ fromJust $ getField @"text" setting
|
||||||
@ -130,19 +84,6 @@ autoUpdatable packageSettings =
|
|||||||
, name = "webex"
|
, name = "webex"
|
||||||
, downloaders = mempty
|
, downloaders = mempty
|
||||||
}
|
}
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "librsync" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "librsync"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
, PackageDescription
|
||||||
{ latest =
|
{ latest =
|
||||||
let setting = findUpdatable "dmd" packageSettings
|
let setting = findUpdatable "dmd" packageSettings
|
||||||
@ -195,32 +136,6 @@ autoUpdatable packageSettings =
|
|||||||
, ("DCD", latestDcd)
|
, ("DCD", latestDcd)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "simde" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "simde"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
, PackageDescription
|
|
||||||
{ latest =
|
|
||||||
let setting = findUpdatable "nginx" packageSettings
|
|
||||||
ghArguments = uncurry PackageOwner $ fromJust $ getField @"github" setting
|
|
||||||
template = Package.DownloadTemplate $ getField @"template" setting
|
|
||||||
in Package.Updater
|
|
||||||
{ detectLatest = latestGitHub ghArguments (getField @"version" setting)
|
|
||||||
, getVersion = repackageWithTemplate (getField @"repackage" setting) template
|
|
||||||
, is64 = getField @"is64" setting
|
|
||||||
}
|
|
||||||
, name = "nginx"
|
|
||||||
, downloaders = mempty
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
up2Date :: Maybe Text -> SlackBuilderT ()
|
up2Date :: Maybe Text -> SlackBuilderT ()
|
||||||
|
Loading…
Reference in New Issue
Block a user