-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet-RepoName.ps1
More file actions
27 lines (24 loc) · 1 KB
/
Copy pathSet-RepoName.ps1
File metadata and controls
27 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<#
.Synopsis
Renames the template content from PSModuleTemplate to the name of the new repo.
#>
#Requires -Version 3
[CmdletBinding()] Param()
$NewName = (Split-Path (git remote get-url origin) -Leaf) -replace '\.git\z',''
if($NewName -eq 'PSModuleTemplate')
{
Stop-ThrowError.ps1 'Run this script once you have created a new repo from this template.' `
-OperationContext (git remote get-url origin)
}
Push-Location $PSScriptRoot
Get-ChildItem -Filter PSModuleTemplate* -Recurse |
where { $_.FullName -notmatch '\\bin\\|\\obj\\|\\\.git\\' } |
foreach {Rename-Item $_.FullName ($_.Name -replace '\APSModuleTemplate',$NewName)}
Get-ChildItem -File -Recurse |
where { $_.FullName -notmatch '\\bin\\|\\obj\\|\\\.git\\' } |
Select-String -Pattern '\bPSModuleTemplate' -List |
Set-RegexReplace.ps1 -Replacement $NewName
Get-ChildItem -File -Filter *.sln -Recurse |Add-Utf8Signature
Remove-Item .\docs\Get-Foo.md -Force
Pop-Location
Remove-Item $PSCommandPath -Force