Public/Coding/New-EdenSolution.ps1
function New-EdenSolution { <# .SYNOPSIS Creates a new Eden solution folder using the Github repo specified in the Template parameter. .Description Creates a new Eden solution folder using the Github repo specified in the Template parameter. #> [CmdletBinding()] param( # The name of the solution. This will set the name of the folder. # It will also be used to replace all instances of MyEdenSolution in the template. [String] $Name, # The url to the GitHub repository that contains the template files. # Eden will download the repo, remove the .git folder, # then find and replace all instances of MyEdenSolution with the Name # value provided across folders names, files names and file content. [String] $Template ) $location = Get-Location try { $loggingPrefix = "Eden Coding" if (!$Template) { $Template = "NewBlankSolution" } if ($Template.EndsWith(".git")) { Copy-GitRepo $Template $Name $loggingPrefix Set-StringReplacement "./$Name/*" "MyEdenSolution" $Name } else { Write-EdenInfo "Creating a new Eden solution: '$Name'." $loggingPrefix New-Item "./" -ItemType Directory -Name $Name [string]$sourceDirectory = "$PSScriptRoot/../../Templates/$Template/*" [string]$destinationDirectory = "./$Name" Copy-Item $sourceDirectory -Destination $destinationDirectory -Force -Recurse -Verbose Write-EdenInfo "Finished creating a new Eden solution." $loggingPrefix } } catch { Write-EdenError "Error creating a new Eden solution. Message: '$($_.Exception.Message)'" $loggingPrefix throw $_ } finally { Set-Location $location } } New-Alias ` -Name e-csol ` -Value New-EdenSolution ` -Force |