au icon indicating copy to clipboard operation
au copied to clipboard

Plugins that run before/after each package

Open majkinetor opened this issue 8 years ago • 0 comments

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
    #94 could be done as this type of plugin that would save latest version in a file and wait for delay to pass
  • VirusTotal #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

majkinetor avatar Nov 15 '17 07:11 majkinetor