Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Plugins that run before/after each package #116

Open
majkinetor opened this issue Nov 15, 2017 · 0 comments
Open

Plugins that run before/after each package #116

majkinetor opened this issue Nov 15, 2017 · 0 comments

Comments

@majkinetor
Copy link
Owner

majkinetor commented Nov 15, 2017

Currently AU plugins run at the end and there is a single BeforeAfter script that can be set in updateall options.

It should be possible to define plugins that run before/after each package in the same way. AU can known which plugin to run at the end and which in between based on plugin file system location.

This would allow for creation of more interesting plugins:

  • Attribute setter
    Define what package attributes are automatically set - very useful for setting package source url, icon url, adding user among maintainers etc. With it migration of packages between AU repositories would be true file copy.
  • Guideliness checker
    Could be run to check powershell style etc.
  • Deleyer
    Delayer #94 could be done as this type of plugin that would save latest version in a file and wait for delay to pass
  • VirusTotal
    Virus Total integration #84 can be done as plugin.
  • Grammar
    Can be used to automatically check for spelling errors.

Details

  • Plugin would need to get [AUPackage]. It could determine if its invocation is before or after package update based on its fields.
  • Plugin should have an option to get output of previous plugin that did run on package
  • Plugin should have an option to reference stuff
  • Plugins could be run only in updateall context. update should never support them as updateall can be used to run single package.
  • Global before/after scripts should run before/after all plugins.
  • Files used by plugins should be saved by git plugin automatically (and streams json along the way).

Example

AttributeSetter = @{
   packageSourceUrl = { 'https://github.../$this_repo/automatic/$Name' }
   owners  = { 'chocolatey, ' + ($owners -replace 'chocolatey,?' }
   description = { $description + "`n`nAutomatic package by majkinetor" }
}

MetadataChecker = @{
    Tags = { Compare-Object $mandatory_tags ($Tags -split ' ') ... }
    licenseUrl = $true      
    files = { if (ls $Package.Path VERIFICATION) { $files -contains 'legal' } }
}

Ignorant = @{
     err      = 60    # rise ignored to error after 60 days
     'clover' = 'Disabled due virustotal results'
     'pkg'    = 'Disabled due to no maintainers'
}

Deleyer    = @{ 
     '*' = 2           # 2 days latency for all packages
     clover = 14  # specific package latency
}
VirusTotal = @{ Threshold = 5 #report errors after this many positives }
Enforcer = @{ForcedPackages = $ForcedPackages}  

/cc @AdmiringWorm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant