Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Mar 21, 2023
0 parents commit 5efb747
Show file tree
Hide file tree
Showing 44 changed files with 2,557 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# For more information about CodeOwners see:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

* @StephenHodgson
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: StephenHodgson
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

# Bug Report

## Overview
<!-- A clear and concise description of what the bug is. -->

## To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

## Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

## Additional context
<!-- Add any other context about the problem here. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

# Feature Request

## Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

## Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

## Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Additional context
<!-- Add any other context or screenshots about the feature request here. -->
22 changes: 22 additions & 0 deletions .github/workflows/upm-subtree-split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: upm-subtree-split

on:
push:
branches:
- main
jobs:
upm-subtree-split:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: upm subtree split
run: |
$packageDir = Get-Item -Path "**/Packages/com.*" | Select-Object -ExpandProperty FullName
$packageDir = $packageDir.replace('${{ github.workspace }}/','')
Write-Host $packageDir
git subtree split --prefix="$packageDir" -b upm
git push -u origin upm --force
working-directory: ${{ github.workspace }}
shell: pwsh
88 changes: 88 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# ============ #
# System Files #
# ============ #
.DS_Store
._*

# =============== #
# Unity generated #
# =============== #
[Aa]pp/
[Aa]pp.meta
[Bb]in/
[Bb]uilds/
[Bb]uild/
[Ll]ibrary/
[Ll]ogs/
[Oo]bj/
[Tt]emp/
UserSettings/
UWP/
WindowsStoreApp/
UnityGenerated/
UnityPackageManager/
.out/
.gradle/
project.json
project.lock.json
*.package
TextMesh Pro.meta
TextMesh Pro/
UIElementsSchema/
*packages-lock.json

# ============ #
# Certificates #
# ============ #
*.cert
*.privkey
*.pfx
*.pfx.meta

# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
.vs/
ExportedObj/
obj/
*.svd
*.userprefs
/*.csproj
*.csproj
*.pidb
*.suo
/*.sln
*.sln
*.user
*.unityproj
*.ipch
*.opensdf
*.sdf
*.tlog
*.log
*.idb
*.opendb
*.vsconfig

# ============================ #
# Visual Studio Code Generated #
# ============================ #
.vscode/

# ========================= #
# Jetbrains Rider Generated #
# ========================= #
.idea/
_ReSharper.Caches

# ===================== #
# Project Specific List #
# ===================== #
--Version/
artifacts/
StreamingAssets/
StreamingAssets.meta

# ====================== #
# Project Specific Links #
# ====================== #
140 changes: 140 additions & 0 deletions InitializeTemplate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Copyright (c) Stephen Hodgson. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.

$InputAuthor = Read-Host "Set Author name: (i.e. your GitHub username)"
$ProjectAuthor = "ProjectAuthor"

$InputName = Read-Host "Enter a name for your new project"
$ProjectName = "ProjectName"

$InputScope = Read-Host "Enter a scope for your new project (optional)"

if(-not [String]::IsNullOrWhiteSpace($InputScope)) {
$InputScope = "$InputScope."
}

$ProjectScope = "ProjectScope."

Write-Host "Your new com.$($InputScope.ToLower())$($InputName.ToLower()) project is being created..."
Remove-Item -Path ".\Readme.md"
Copy-Item -Path ".\$ProjectScope$ProjectName\Packages\com.$($ProjectScope.ToLower())$($ProjectName.ToLower())\Documentation~\Readme.md" `
-Destination ".\Readme.md"

# Rename any directories before we crawl the folders
Rename-Item -Path ".\$ProjectScope$ProjectName\Packages\com.$($ProjectScope.ToLower())$($ProjectName.ToLower())\Runtime\$ProjectScope$ProjectName.asmdef" `
-NewName "$InputScope$InputName.asmdef"
Rename-Item -Path ".\$ProjectScope$ProjectName\Packages\com.$($ProjectScope.ToLower())$($ProjectName.ToLower())\Editor\$ProjectScope$ProjectName.Editor.asmdef" `
-NewName "$InputScope$InputName.Editor.asmdef"
Rename-Item -Path ".\$ProjectScope$ProjectName\Packages\com.$($ProjectScope.ToLower())$($ProjectName.ToLower())\Tests\$ProjectScope$ProjectName.Tests.asmdef" `
-NewName "$InputScope$InputName.Tests.asmdef"
Rename-Item -Path ".\$ProjectScope$ProjectName\Packages\com.$($ProjectScope.ToLower())$($ProjectName.ToLower())" `
-NewName "com.$($InputScope.ToLower())$($InputName.ToLower())"
Rename-Item -Path ".\$ProjectScope$ProjectName" `
-NewName ".\$InputScope$InputName"

$excludes = @('*Library*', '*Obj*','*InitializeTemplate*')
Get-ChildItem -Path "*"-File -Recurse -Exclude $excludes | ForEach-Object -Process {
$isValid = $true

foreach ($exclude in $excludes) {
if ((Split-Path -Path $_.FullName -Parent) -ilike $exclude) {
$isValid = $false
break
}
}

if ($isValid) {
Get-ChildItem -Path $_ -File | ForEach-Object -Process {
$updated = $false;

$fileContent = Get-Content $($_.FullName) -Raw

# Rename all PascalCase instances
if ($fileContent -cmatch $ProjectName) {
$fileContent -creplace $ProjectName, $InputName | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

if ($fileContent -cmatch $ProjectScope) {
$fileContent -creplace $ProjectScope, $InputScope | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

if ($fileContent -cmatch $ProjectAuthor) {
$fileContent -creplace $ProjectAuthor, $InputAuthor | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

$StephenHodgson = "StephenHodgson"

if ($fileContent -cmatch $StephenHodgson) {
$fileContent -creplace $StephenHodgson, $InputAuthor | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

# Rename all lowercase instances
if ($fileContent -cmatch $ProjectName.ToLower()) {
$fileContent -creplace $ProjectName.ToLower(), $InputName.ToLower() | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

if ($fileContent -cmatch $ProjectScope.ToLower()) {
$fileContent -creplace $ProjectScope.ToLower(), $InputScope.ToLower() | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

# Rename all UPPERCASE instances
if ($fileContent -cmatch $ProjectName.ToUpper()) {
$fileContent -creplace $ProjectName.ToUpper(), $InputName.ToUpper() | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

if ($fileContent -cmatch $ProjectScope.ToUpper()) {
$fileContent -creplace $ProjectScope.ToUpper(), $InputScope.ToUpper() | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

# Update guids
if ($fileContent -match "#INSERT_GUID_HERE#") {
$fileContent -replace "#INSERT_GUID_HERE#", [guid]::NewGuid() | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

$fileContent = Get-Content $($_.FullName) -Raw

# Update year
if ($fileContent -match "#CURRENT_YEAR#") {
$fileContent -replace "#CURRENT_YEAR#", (Get-Date).year | Set-Content $($_.FullName) -NoNewline
$updated = $true
}

# Rename files
if ($_.Name -match $ProjectName) {
Rename-Item -LiteralPath $_.FullName -NewName ($_.Name -replace ($ProjectName, $InputName))
$updated = $true
}

if ($updated) {
Write-Host $_.Name
}
}
}
}

Remove-Item -Path "InitializeTemplate.ps1"
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) #CURRENT_YEAR# ProjectAuthor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 5efb747

Please sign in to comment.