Skip to main content
fixed numbering
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84

23.1 Creating a script for deployment

23.2 Using the paclet

2.1 Creating a script for deployment

2.2 Using the paclet

3.1 Creating a script for deployment

3.2 Using the paclet

improved formatting
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84
Eclipse IDE for Java Developers Version: Neon.3 Release (4.6.3) Build id: 20170314-1500 Plugin: Wolfram Workbench COreCore (10.1.1087) 

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of things; also we do not need the additional directory MyFirstPaclet so we can movemove the \Kernel directory to the top level and deletedelete the subdirectory \MyFirstPaclet. We also deletedelete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

Eclipse IDE for Java Developers Version: Neon.3 Release (4.6.3) Build id: 20170314-1500 Plugin: Wolfram Workbench COre (10.1.1087) 

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of things; also we do not need the additional directory MyFirstPaclet so we can move the \Kernel directory to the top level and delete the subdirectory \MyFirstPaclet. We also delete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

Eclipse IDE for Java Developers Version: Neon.3 Release (4.6.3) Build id: 20170314-1500 Plugin: Wolfram Workbench Core (10.1.1087) 

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of things; also we do not need the additional directory MyFirstPaclet so we can move the \Kernel directory to the top level and delete the subdirectory \MyFirstPaclet. We also delete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

improved ordering of information
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of thingsthings; also we do not need the additional directory MyFirstPaclet so we can move the \Kernel directory to the top level and delete the subdirectory \MyFirstPaclet. We also delete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

... to be continued For what follows I assume that you are going to deploy your paclet to some paclet server. Again please refer to Todd's excellent guide for how to set this up. Personally, I am using a local directory in my \Dropbox directory, which works out nicely.

2.1 Creating a script for deployment

As before, by right clicking on the project directory we add a new file, which we call deployPaclet.wls:

We then open deployPaclet.wls using the Text Editor:

We then enter the following script, which of course has to be adapted, and save it [Ctrl + s]:

#!/usr/bin/env wolframscript (* deploy the paclet to the local paclet server and update the paclet site files *) Needs[ "PacletManager`" ] $localPacletServer = "D:\\Dropbox\\BSLPacletServer" (* the location of the paclet server as needed for CreatPacletArchive[ ] *) $thisPaclet = "D:\\git-local\\MyFirstPaclet" CreatePacletArchive[ $thisPaclet, $localPacletServer ] (* create the .paclet archive *) PacletManager`BuildPacletSitesFiles[ $localPacletServer ] (* update the paclet site files *) 

Now, all we have to do is to tell Workbench that deployPaclet.wls is a script (it does not know by itself ;-) by entering the context menu with a right click for that file and selecting open with other... and Wolfram Script:

CLosing the dialog with Ok will already run the script and upon inspection of the paclet server directory we find:

From now on we should be able to deploy the paclet simply by selecting the script file deployPaclet.wls and pressing F3.

Note: If newer versions of a paclet are added to the paclet server, it may be necessary to remove the older versions before updating the index files. I will check this and append the script later on.

2.2 Using the paclet

If the PacletSite is registered, all one needs to do is to install the paclet once into $UserBasePacletsDirectory by

PacletInstall[ "MyFirstPaclet" ] 

Note: There is currently no way to force PacletInstall or PacletInstallSubmit to install paclets into $BasePacletsDirectory, but paclets can be placed there by hand to become visible to all users on the system.

Any notebook that needs the paclet then can use it with Needs[ ]:

Needs[ "MyFirstPaclet`" ] 

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of things. We also delete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

... to be continued

We will not need init.m and can thus delete it. We then move the file MyFirstPaclet.m into the directory \Kernel and we then rename (Refactor>Rename in the context menu) it to MyFirstPaclet.wl to be on the modern side of things; also we do not need the additional directory MyFirstPaclet so we can move the \Kernel directory to the top level and delete the subdirectory \MyFirstPaclet. We also delete the hidden file .WolframResources (it will always be recreated upon changes to the project properties).

For what follows I assume that you are going to deploy your paclet to some paclet server. Again please refer to Todd's excellent guide for how to set this up. Personally, I am using a local directory in my \Dropbox directory, which works out nicely.

2.1 Creating a script for deployment

As before, by right clicking on the project directory we add a new file, which we call deployPaclet.wls:

We then open deployPaclet.wls using the Text Editor:

We then enter the following script, which of course has to be adapted, and save it [Ctrl + s]:

#!/usr/bin/env wolframscript (* deploy the paclet to the local paclet server and update the paclet site files *) Needs[ "PacletManager`" ] $localPacletServer = "D:\\Dropbox\\BSLPacletServer" (* the location of the paclet server as needed for CreatPacletArchive[ ] *) $thisPaclet = "D:\\git-local\\MyFirstPaclet" CreatePacletArchive[ $thisPaclet, $localPacletServer ] (* create the .paclet archive *) PacletManager`BuildPacletSitesFiles[ $localPacletServer ] (* update the paclet site files *) 

Now, all we have to do is to tell Workbench that deployPaclet.wls is a script (it does not know by itself ;-) by entering the context menu with a right click for that file and selecting open with other... and Wolfram Script:

CLosing the dialog with Ok will already run the script and upon inspection of the paclet server directory we find:

From now on we should be able to deploy the paclet simply by selecting the script file deployPaclet.wls and pressing F3.

Note: If newer versions of a paclet are added to the paclet server, it may be necessary to remove the older versions before updating the index files. I will check this and append the script later on.

2.2 Using the paclet

If the PacletSite is registered, all one needs to do is to install the paclet once into $UserBasePacletsDirectory by

PacletInstall[ "MyFirstPaclet" ] 

Note: There is currently no way to force PacletInstall or PacletInstallSubmit to install paclets into $BasePacletsDirectory, but paclets can be placed there by hand to become visible to all users on the system.

Any notebook that needs the paclet then can use it with Needs[ ]:

Needs[ "MyFirstPaclet`" ] 
catching spelling errors
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84
Loading
catching spelling errors
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84
Loading
Source Link
gwr
  • 13.7k
  • 2
  • 49
  • 84
Loading