Skip to content

Commit

Permalink
category and program system reworked to use JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Barrachina committed Feb 26, 2022
1 parent f157a3b commit 368cec6
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 97 deletions.
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"spellright.language": [
"en",
"es"
],
"spellright.documentTypes": [
"markdown",
"latex"
]
}
13 changes: 0 additions & 13 deletions Games/games.ps1

This file was deleted.

3 changes: 0 additions & 3 deletions Games/games.txt

This file was deleted.

13 changes: 0 additions & 13 deletions Programming/programming.ps1

This file was deleted.

9 changes: 0 additions & 9 deletions Programming/programming.txt

This file was deleted.

36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,36 @@

Script using winget for easy windows setup

## How to create new categories
## Add new programs to existing categories

To add a new program you have to add a new entry to the array inside its JSON file.

In main.ps1 put this line of code at the end of the script
Said object must follow this model

```powershell
.\NewFolder\NewScript.ps1
```json
{
"mode": "ID or NAME",
"identifier": "Name or ID of the program",
"source": "winget or msstore",
"scope": "user or machine"
}
```

In the new folder create a .txt file with the app id's and a .ps1 with the file.txt name in the line
Depending on whether it comes from winget or the Microsoft Store, you should put "winget" or "msstore" on the source field.

```powershell
foreach ($line in Get-Content $PSSCriptRoot\newFile.txt)
```
Some programs as Netflix can only be installed for the current user, others like Steam can only be installed machine-wide.

And change the name of the category in
## How to create new categories

```powershell
$confirmation = Read-Host "Install EXAMPLE stuff? (y/n) "
To create a new category you only have to add a new JSON file to [./json](./json). This files will be an array of programs, so you have to use an array syntax inside the file. Open the file with a square bracket, open and close a new program with curly brackets, and use a coma to separate programs:

```json
[
{
ONE Program
},
{
OTHER PROGRAM
}
]
```
13 changes: 0 additions & 13 deletions Template/template.ps1

This file was deleted.

1 change: 0 additions & 1 deletion Template/template.txt

This file was deleted.

13 changes: 0 additions & 13 deletions Utils/Utils.ps1

This file was deleted.

9 changes: 0 additions & 9 deletions Utils/Utils.txt

This file was deleted.

32 changes: 32 additions & 0 deletions json/games.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"mode": "id",
"identifier": "Valve.Steam",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "GOG.Galaxy",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "Ubisoft.Uplay",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "EpicGames.EpicGamesLauncher",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "ElectronicArts.EADesktop",
"source": "winget",
"scope": "machine"
}
]
50 changes: 50 additions & 0 deletions json/programming.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"mode": "id",
"identifier": "Microsoft.WindowsTerminal",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Microsoft.WindowsTerminal",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Microsoft.VisualStudio.2022.Community",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Python.Python",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "AnsgarBecker.HeidiSQL",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Git.Git",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Axosoft.GitKraken",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "RubyInstallerTeam.RubyWithDevKit",
"source": "winget",
"scope": "user"
}
]
50 changes: 50 additions & 0 deletions json/utils.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"mode": "id",
"identifier": "Spotify.Spotify",
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Discord.Discord",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "Mozilla.Firefox",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "Google.Chrome",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "flux.flux",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "RARLab.WinRAR",
"source": "winget",
"scope": "machine"
},
{
"mode": "id",
"identifier": "9WZDNCRFJ3TJ", //netflix
"source": "winget",
"scope": "user"
},
{
"mode": "id",
"identifier": "Corsair.iCUE",
"source": "winget",
"scope": "machine"
}
]
29 changes: 17 additions & 12 deletions main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ foreach ($gpu in $gpus) {
}
}

#Programming script
.\Programming\programming.ps1

#Games script
.\Games\Games.ps1

#Util script
.\Utils\Utils.ps1


#Uninstal shit
.\Uninstall\Uninstal.ps1
Get-ChildItem -Recurse -Filter *.json | Foreach-Object {
$install = 0
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($_)
while ($install -ne "y" -and $install -ne "n") {
$install = Read-Host "Install $fileName stuff? (y/n) "
if ($install -eq "y") {
$json = Get-Content -Raw -Path $_.FullName | ConvertFrom-Json
$json | ForEach-Object {
$mode = $_.mode
$id = $_.identifier
$source = $_.source
$scope = $_.scope
winget.exe install --$mode $id -e -s $source --scope $scope --accept-package-agreements --accept-source-agreements --force
}
}
}
}

0 comments on commit 368cec6

Please sign in to comment.