This tutorial shows how to create your own Paclet site. If you deploy code to other people you can use the Paclet system to allow your application to check for code or data updates. This is useful if you have bugs that have been fixed, new features added or data that has changed or been updated.
I am going to use a GitHub release page for my site.
sitepathpath =
"https://github.com/ERWS/diyPaclet/releases/download/v1.0/";
mysite = PacletSiteAdd[sitepathpath, "ERWS", "Local" -> False];
PacletSites[]
{PacletSite["http://pacletserver.wolfram.com",
"Wolfram Research Paclet Server", "Local" -> False],
PacletSite[
"https://github.com/ERWS/diyPaclet/releases/download/v1.0/", "ERWS",
"Local" -> False]}
To make a site you need at least one Paclet.
diypacpath =
First@URLDownload["https://github.com/ERWS/diyPaclet/releases/download/v1.0/ diyPaclet-0.0.1.paclet",
URLDownload["http://wolfram.com", FileNameJoin[{$TemporaryDirectory, "diyPaclet-0.0.1.paclet"}]]];
diypac = PacletInstall[diypacpath]
Then create your Paclet site object
pacassoc = Append[diypac /. Paclet[x__] :> <|x|>, "Location" -> sitepathpath];
modifiedpac = Paclet @@ Normal@pacassoc;
pacletsitenew = PacletSite[modifiedpac]
Some processing is required to create a zipped archive file with a .mz extension
pacletsitetext = ToString[pacletsitenew, InputForm]
newfile = CreateFile[FileNameJoin[{NotebookDirectory[], "Pacsite1", "PacletSite.m"}]]
s = OpenWrite[newfile, CharacterEncoding -> "UTF8"]
WriteString[s, pacletsitetext]
Close[s]
zip = CreateArchive[newfile, FileNameDrop[newfile, -1]]
ziprename = CopyFile[zip, FileNameJoin[{FileNameDrop[zip, -1], "PacletSite.mz"}]]
Upload the .mz file to your site. If you are able to use a http site instead and can create a sub-directory /Paclets and then put your paclet files in it you could finish at this stage. Paclet Install and other useful functionality should work.
I want to use a GitHub release page so I need to use https and I also can't create a sub-directory at this location so a slight modification of code is need for this. The code is in the attached notebook.
Block[{PacletManager`Package`setLocation = mysetLocation,
PacletManager`Package`downloadPaclet = mydownloadpaclet},
PacletInstall["diyPaclet", "Site" -> sitepathpath, "Asynchronous" -> False]]
PacletManager`Paclet[ "Name" -> "diyPaclet", "Version" -> "0.0.1",
"MathematicaVersion" -> "7+", "Creator" -> "ERWS",
"Loading" -> "Automatic", "Root" -> "diyPaclet",
"Extensions" -> {{"Kernel", "Context" -> "diyPaclet`"}, {
"Documentation", "Language" -> "English",
"MainPage" -> "Guides/diyPacletGuide"}},
"Location" -> "C:\\Users\\2moro\\AppData\\Roaming\\Mathematica\\\Paclets\\Repository\\diyPaclet"]
Attachments: