Skip to content

Commit

Permalink
rebrand the whole thing why not (mattpannella#216)
Browse files Browse the repository at this point in the history
* rebrand the whole thing why not

* removed

* skip-update option

* formatting

* woof
  • Loading branch information
mattpannella authored Jan 21, 2024
1 parent 3c37807 commit d8f9294
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 72 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/announce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
"fields": [
{ "name": "Release Notes", "value": "[Click Me](https://github.com/mattpannella/pocket-updater-utility/releases/tag/${{ github.event.release.tag_name }})", "inline": true },
{ "name": "Version", "value": "${{ github.event.release.tag_name }}", "inline": true },
{ "name": "macOS Build", "value": "[Download Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_mac.zip)" },
{ "name": "Linux Build", "value": "[Or Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_linux.zip)" },
{ "name": "Linux ARM64 Build", "value": "[This is for creeps](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_linux_arm.zip)" },
{ "name": "Windows Build", "value": "[This is a virus](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_win.zip)" }
{ "name": "macOS Build", "value": "[Download Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_mac.zip)" },
{ "name": "Linux Build", "value": "[Or Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_linux.zip)" },
{ "name": "Linux ARM64 Build", "value": "[This is for creeps](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_linux_arm.zip)" },
{ "name": "Windows Build", "value": "[This is a virus](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_win.zip)" }
]
}]
}' \
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,33 @@ jobs:
release_name="App-$tag-${{ matrix.target }}"
# Build everything
dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-x64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
dotnet publish pupdate.csproj -r ${{ matrix.target }}-x64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
if ${{ matrix.arm }}; then
mv ${release_name}/pocket_updater ${release_name}/pocket_updater_x64
dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-arm64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
mv ${release_name}/pocket_updater ${release_name}/pocket_updater_arm64
mv ${release_name}/pupdate ${release_name}/pupdate_x64
dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
mv ${release_name}/pupdate ${release_name}/pupdate_arm64
if [ "${{ matrix.target }}" == "linux" ]; then
dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-arm --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
mv ${release_name}/pocket_updater ${release_name}/pocket_updater_arm32
dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly
mv ${release_name}/pupdate ${release_name}/pupdate_arm32
fi
fi
# Pack files
if [ "${{ matrix.target }}" == "win" ]; then
# Pack to zip for Windows
7z a -tzip "pocket_updater_win.zip" "./${release_name}/pocket_updater.exe"
7z a -tzip "pupdate_win.zip" "./${release_name}/pupdate.exe"
elif [ "${{ matrix.target }}" == "osx" ]; then
cd $release_name
lipo -create -output pocket_updater pocket_updater_arm64 pocket_updater_x64
rm pocket_updater_arm64
rm pocket_updater_x64
zip "../pocket_updater_mac.zip" "pocket_updater"; cd ..;
lipo -create -output pupdate pupdate_arm64 pupdate_x64
rm pupdate_arm64
rm pupdate_x64
zip "../pupdate_mac.zip" "pupdate"; cd ..;
else
cd $release_name
mv pocket_updater_x64 pocket_updater
zip "../pocket_updater_linux.zip" "pocket_updater"
zip "../pocket_updater_linux_arm64.zip" "pocket_updater_arm64"
zip "../pocket_updater_linux_arm32.zip" "pocket_updater_arm32"
mv pupdate_x64 pupdate
zip "../pupdate_linux.zip" "pupdate"
zip "../pupdate_linux_arm64.zip" "pupdate_arm64"
zip "../pupdate_linux_arm32.zip" "pupdate_arm32"
cd ..
fi
Expand All @@ -76,6 +76,6 @@ jobs:
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "pocket_updater*.zip"
files: "pupdate*.zip"
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net6.0/pocket_updater.dll",
"program": "${workspaceFolder}/bin/Debug/net6.0/pupdate.dll",
"args": ["-p", "/Users/mattpannella/pocket-test"],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
Expand Down
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/pocket_updater.csproj",
"${workspaceFolder}/pupdate.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/pocket_updater.csproj",
"${workspaceFolder}/pupdate.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/pocket_updater.csproj"
"${workspaceFolder}/pupdate.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Checks for missing required assets for each core you have selected (mainly arcad
menu (Default Verb) Interactive Main Menu
-p, --path Absolute path to install location
-s, --skip-update Go straight to the menu, without looking for an update
fund List sponsor links. Lists all if no core is provided
-c, --core The core to check funding links for
Expand Down Expand Up @@ -124,19 +125,19 @@ examples:



`/path/to/pocket_updater -p /path/to/sdcard/`
`/path/to/pupdate -p /path/to/sdcard/`



`/path/to/pocket_updater update -c boogermann.bankpanic`
`/path/to/pupdate update -c boogermann.bankpanic`



`/path/to/pocket_updater assets -c jotego.jtcontra`
`/path/to/pupdate assets -c jotego.jtcontra`



`/path/to/pocket_updater images -i pocket-platform-images -o dyreschlock -v home`
`/path/to/pupdate images -i pocket-platform-images -o dyreschlock -v home`

### Core Selector

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: Pocket Updater Utility
title: Pupdate
author:
name: Matt Pannella
email: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion pocket_updater.csproj → pupdate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Description>Keep your Analogue Pocket up to date</Description>
<Copyright>2023 Matt Pannella</Copyright>
<Authors>Matt Pannella</Authors>
<Product>Analogue Pocket Updater Utility</Product>
<Product>Pupdate</Product>
<RepositoryUrl>https://github.com/mattpannella/pocket-updater-utility</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion pocket_updater.sln → pupdate.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pocket_updater", "pocket_updater.csproj", "{88615FF5-4649-4DD0-B721-449269388A88}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pupdate", "pupdate.csproj", "{88615FF5-4649-4DD0-B721-449269388A88}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
63 changes: 22 additions & 41 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ internal class Program
private static string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
private const string USER = "mattpannella";
private const string REPOSITORY = "pocket-updater-utility";
private const string RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pocket_updater_{1}.zip";
private const string NEW_RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pupdate_{1}.zip";
private const string RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pupdate_{1}.zip";
private static SettingsManager settings;

private static PocketCoreUpdater updater;

private static bool cliMode = false;
private static bool migrate = false;
private static async Task Main(string[] args)
{
try {
Expand Down Expand Up @@ -122,6 +120,9 @@ private static async Task Main(string[] args)
if(o.InstallPath != null && o.InstallPath != "") {
path = o.InstallPath;
}
if(o.SkipUpdate) {
cliMode = true;
}
}
)
.WithNotParsed(o =>
Expand All @@ -136,7 +137,7 @@ private static async Task Main(string[] args)
);

if (!cliMode) {
Console.WriteLine("Pocket Updater Utility v" + version);
Console.WriteLine("Pupdate v" + version);
Console.WriteLine("Checking for updates...");

if(await CheckVersion(path) && !selfUpdate) {
Expand Down Expand Up @@ -315,37 +316,16 @@ private static async Task Main(string[] args)
}
}

static void DisplayHelp<T>(ParserResult<T> result)
{
var helpText = CommandLine.Text.HelpText.AutoBuild(result, h =>
{
h.AdditionalNewLineAfterOption = false;
h.Heading = "Myapp 2.0.0-beta"; //change header
h.Copyright = "Copyright (c) 2019 Global.com"; //change copyright text
return CommandLine.Text.HelpText.DefaultParsingErrorsHandler(result, h);
}, e => e);
Console.WriteLine(helpText);
}

private static int UpdateSelfAndRun(string directory, string[] updaterArgs)
{
string execName = "pocket_updater";
string newExecName = "pocket_updater";
if(migrate) {
newExecName = "pupdate";
}
string execName = "pupdate";
if(GetPlatform() == "win") {
execName += ".exe";
newExecName += ".exe";
}
string execLocation = Path.Combine(directory, execName);
string newExecLocation = Path.Combine(directory, newExecName);
string backupName = $"{execName}.backup";
string backupLocation = Path.Combine(directory, backupName);
string updateName = "pocket_updater.zip";
if(migrate) {
updateName = "pupdate.zip";
}
string updateName = "pupdate.zip";
string updateLocation = Path.Combine(directory, updateName);

int exitcode = int.MinValue;
Expand All @@ -366,8 +346,8 @@ private static int UpdateSelfAndRun(string directory, string[] updaterArgs)
ZipFile.ExtractToDirectory(updateLocation, directory, true);

// Execute
Console.WriteLine($"Executing {newExecLocation}");
ProcessStartInfo pInfo = new ProcessStartInfo(newExecLocation) {
Console.WriteLine($"Executing {execLocation}");
ProcessStartInfo pInfo = new ProcessStartInfo(execLocation) {
Arguments = string.Join(' ', updaterArgs),
UseShellExecute = false
};
Expand Down Expand Up @@ -694,21 +674,14 @@ async static Task<bool> CheckVersion(string path)
List<Github.Release> releases = await GithubApi.GetReleases(USER, REPOSITORY);

string tag_name = releases[0].tag_name;
string releaseUrl = RELEASE_URL;
string fileName = "pocket_updater";
if(tag_name == "3.0.0") {
releaseUrl = NEW_RELEASE_URL;
fileName = "pupdate";
migrate = true;
}
string? v = SemverUtil.FindSemver(tag_name);
if(v != null) {
bool check = SemverUtil.SemverCompare(v, version);
if(check) {
Console.WriteLine("A new version is available. Downloading now...");
string platform = GetPlatform();
string url = String.Format(releaseUrl, tag_name, platform);
string saveLocation = Path.Combine(path, $"{fileName}.zip");
string url = String.Format(RELEASE_URL, tag_name, platform);
string saveLocation = Path.Combine(path, "pupdate.zip");
await Factory.GetHttpHelper().DownloadFileAsync(url, saveLocation);
Console.WriteLine("Download complete.");
Console.WriteLine(saveLocation);
Expand All @@ -725,7 +698,6 @@ async static Task<bool> CheckVersion(string path)
}
}


private static string GetPlatform()
{
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
Expand Down Expand Up @@ -1008,15 +980,24 @@ __ _ | |
| |__| -_| _| |_ -| | | . |_ -| -_| | |
|_____|___|_| |___| |_|_|_|___|___|___|_ |
|___|",


@" _=,_
o_/6 /#\
\__ |##/
='|--\
/ #'-.
\#|_ _'-. /
|/ \_( # |''
C/ ,--___/"
};
}
[Verb("menu", isDefault: true, HelpText = "Interactive Main Menu")]
public class MenuOptions
{
[Option('p', "path", HelpText = "Absolute path to install location", Required = false)]
public string? InstallPath { get; set; }

[Option('s', "skip-update", HelpText = "Skip the self update check", Required = false)]
public bool SkipUpdate { get; set; }
}

[Verb("update", HelpText = "Run update all. (You can configure via the settings menu)")]
Expand Down

0 comments on commit d8f9294

Please sign in to comment.