It is currently December 3rd, 2022, 11:41 am

Version control for your skins with CoreInstaller

Share and get help with Plugins and Addons
User avatar
Jax
Posts: 104
Joined: June 7th, 2021, 11:46 am

Version control for your skins with CoreInstaller

Post by Jax »

Hi all! :welcome: CoreInstaller's v5.6 update allows all skin developers to take advantage of the download & installation capabilities of CoreInstaller!

The following will be a guide on how to use JaxCore's powerful version control tool! You can find a copy of this guide on JaxCore's wiki

What's CoreInstaller?

CoreInstaller allows users to install your skin even without Rainmeter installed, and allows your skin to self-update with a single click. This does not require JaxCore to be installed.
This is meant for advanced skin publishers only. If you're new to releasing skins, consider adding this later down your development schedule.
Complete a 3-step process for basic setup, and another 3-step process to allow your module to self-update.

Basic setup

The following section expects basic knowledge on how to setup a Github repository. If you're having trouble with this, Google's your best friend.
  1. Create a Github Repository with your skin name as the repository name
  2. Clone local skin folder to Github Repository. Have your skin folder as the root folder. (Optional)
  3. The releases section is where you'll upload new versions of your skin. When uploading your .rmskin file, make sure to give the release a version tag.
Documentation on how to compile your rmskin release can be found here

Now your skin can be installed via the following command:

Code: Select all

$o_NoPostActions=$true;$o_InstallModule='MyUser/MySkin';iwr -useb 'https://raw.githubusercontent.com/Jax-Core/JaxCore/master/CoreInstaller.ps1' | iex
Make sure to replace any occurances of MySkin and MyUser with your Github Repo's name and your username in the sections following.
Example: If your Github username is timmy and your repo name is my-first-skin: MyUser/MySkin --> timmy/my-first-skin
The slash must be forward!
You can also add the installation guide to your README.md file so it's easier for users to install your module:
  1. Create a README.md file in the root of your skins folder
  2. Put the following contents into it. ​

Code: Select all

## How to install
Run the following command in Powershell to install the latest version.
​
```
$o_NoPostActions=$true;$o_InstallModule='MyUser/MySkin';iwr -useb 'https://raw.githubusercontent.com/Jax-Core/JaxCore/master/CoreInstaller.ps1' | iex
```
Skin Updater

Complete the following setups to allow your skin to self-update. You'll need the following things in your module for it to work.
  • PowershellRM Plugin
  • A way to allow users to click on something to update
  • A powershell script located in the resources folder (or anywhere within the skin)
1. Setup the measure in your skin
Replace path_to_powershell_script with corresponding path

Code: Select all

[CoreInstallHandler]
Measure=Plugin
Plugin=PowershellRM
DynamicVariables=1
ScriptFile=#path_to_powershell_script#
ExecutionPolicy=Unrestricted
2. Setup the Powershell script
Make sure to replace MyUser/MySkin

Code: Select all

​​function Install($Version) {
    # ---------------------------------- Command --------------------------------- #
    $command = "-command `"`$o_NoPostActions=`$true;`$o_InstallModule='MyUser/MySkin';"
    $rminstalledat = join-path "$($RmAPI.VariableStr('SETTINGSPATH'))" ""
    # If installation is portable
    If (!((join-path "$Env:APPDATA\Rainmeter\" "") -eq ($rminstalledat))) {
        $rminstalledat = Split-path "$rminstalledat"
        $command += "`$o_Location='$rminstalledat';"
    }
    # If specific version is requested
    If ($Version) {
        $Version = $Version -replace 'v', ''
        $command += "`$o_Version='$Version';"
    }
    $command += "iwr -useb 'https://raw.githubusercontent.com/Jax-Core/JaxCore/master/CoreInstaller.ps1' | iex`""
    # --------------------------------- Fallback --------------------------------- #
    # Put any bangs here that should be ran everytime that you run the local updater, to let the user know what they should do if the installer doesn't work.
    # ---------------------------- Launch PS instance ---------------------------- #
    If (Test-Path "C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe") {
        Start-Process "C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -ArgumentList "-ExecutionPolicy Bypass", $command
    } else {
        Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass", $command
    }
}
3. Setup action in your skin

Code: Select all

# To get the latest version
LeftMouseUpAction=[!CommandMeasure CoreInstallHandler 'Install']
# To get a specific version
LeftMouseUpAction=[!CommandMeasure CoreInstallHandler 'Install v1.5']
Everything should be setup correctly!
Now your skin can be updated with just running a single bang! If you have any questions or if you have encountered any issues, feel free to leave a comment :bow: