CakeLicenseHeaderUpdaterAliases.

UpdateLicenseHeaders(ICakeContext, IEnumerable<FilePath>, CakeLicenseHeaderUpdaterSettings) Method

Summary

Modifies the License Headers of all the passed in files based on the given settings.

Syntax

public static void UpdateLicenseHeaders(this ICakeContext context, IEnumerable<FilePath> files, CakeLicenseHeaderUpdaterSettings settings)

Examples

        CakeLicenseHeaderUpdaterSettings settings = new CakeLicenseHeaderUpdaterSettings();
        settings.LicenseString =
@"//
// Copyright Seth Hendrick 2019-2020.
// Distributed under the MIT License.
// (See accompanying file LICENSE in the root of the repository).
//";

        string old2019String = 
@"//
// Copyright Seth Hendrick 2019\.
// Distributed under the MIT License\.
// \(See accompanying file LICENSE in the root of the repository\)\.
//";
        settings.OldHeaderRegexPatterns.Add( old2019String );
        settings.Threads = 1;
        settings.DryRun = true;
        settings.Verbosity = Verbosity.Diagnostic;
        settings.FileFilter = delegate( FilePath path )
        {
            if( path.ToString().Contains( "bin" ) )
            {
                return false;
            }
            else if( path.ToString().Contains( "obj" ) )
            {
                return false;
            }

            return true;
        };

        CakeLicenseHeaderUpdaterRunner runner = new CakeLicenseHeaderUpdaterRunner( context );

        FilePathCollection files = GetFiles( "*.cs");
        UpdateLicenseHeaders( files, settings );

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute
CakeNamespaceImportAttribute

Parameters

Name Type Description
context ICakeContext
files IEnumerable<FilePath> The files to modify
settings CakeLicenseHeaderUpdaterSettings The settings to use

Return Value

Type Description
void