Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-08 18:27:42

From: Germany
Registered: 2005-01-20
Posts: 4,026

How to: compile txt installers for rah_ plugins

Jukka (gocom) has some great and pretty indispensable plugins on his rahforum.biz website and he does update them periodically, but the the newer versions are mostly on github.com/gocom. On top of that, they’re mostly not available as the typical txt or zip.txt installer files. Because he structures his plugins slightly differently to the standard txp plugin template, the php files won’t install in via the file upload button.

This is a brief how-to on how to create txt and compressed txt installers using his own MassPlugCompiler or mtxpc for short.

Note: This is only for use with rah plugins.

Setting up mtxpc for use on the Mac

This step only needs to be done once.

1. Download the most recent version of mtxpc.phar from the releases page of the MassPlugCompiler repository on GitHub. This is a bundled php package that can be run from the command line.

If you place this file in a folder in your $PATH list and make it executable, you can run it anywhere from the terminal. To do that…

2. Open your finder where you downloaded mtxpc.phar and open the Terminal app. Arrange them side by side so you can see both on your screen.

In the Terminal enter:

echo $PATH

It will show you a list of directories in your terminal’s $PATH variable separated by colons.

3. Type mv {drag in mtxpc.phar from the finder} {folder in your $PATH}/mtxpc.phar. Some folders are protected and need permission. In my case, I chose /usr/local/bin/:

mv /Users/myname/Downloads/mtxpc.phar /usr/local/bin/mtxpc.phar

The file should be moved. You can check by typing cd {folder in your $PATH} (the prompt changes to your new path) and then ls- la to list the files in that directory. You should see the file in the list.

Now we need to make that file executable with chmod 755 {folder in your $PATH}/mtxpc.phar. In my case, that’s:

chmod 755 /usr/local/bin/mtxpc.phar

4. To make it a little easier to use, you can set up an alias so you can call it as a command from the command line. You can set that up in your shell. Newer Macs (Catalina / Big Sur) use .zshrc, earlier Macs .bashrc. You can type echo $0 to find out whether you’re using bash or zsh.

Now type:

open ~/.zshrc

(or open ~/.bashrc if you’re using a bash shell). A text editor will open with file, which probably already contains several lines. Add the line alias mtxpc="php {folder in your $PATH}/mtxpc.phar" using your folder to the end of the file. In my case that’s:

alias mtxpc="php /usr/local/bin/mtxpc.phar"

Save and close the file. You can check it has been modified by typing cat ~/.zshrc to output its contents in the Terminal. The new line should be there.

You should now be ready to use it. But first Quit and restart the Terminal app.

Using mtxpc to compile rah plugins

Let’s take an example and compile rah_replace.

1. Visit the rah_replace GitHub repo.

2. Click on green Code download button and choose Download zip. Typically that will be the most version of the main branch. If you want a specific version, visit the Releases page (in the right-hand sidebar) and download the zip of the version you want.

On a Mac it should download and auto-unpack to a folder called rah_repeat-master in the Downloads folder.

3. Open up the Terminal app and the finder next to it with the Downloads folder open. Type cd {drag in the Download folder from the finder}, in my case:

cd /Users/myname/Downloads

and “enter” and the prompt should change to “Downloads”

4. Now you can compile from that folder. Type:

mtxpc rah_replace-master > rah_replace_v0.5.0.txt

and a compiled .txt installer will appear in the Downloads folder. If you want a compressed installer use the -c flag:

mtxpc -c rah_replace-master > rah_replace_v0.5.0_zip.txt

and a compressed _zip.txt installer will appear in the Downloads folder.

That’s it!

Further options are explained on Jukka’s readme or by typing:

mtxpc -h


If any of you command line aficionados have any notes or corrections, please let me know and I’ll incorporate them.

And if anyone could supply some instructions for windows users, that would be great!

TXP Builders – finely-crafted code, design and txp


#2 2020-12-08 18:53:37

From: Cyprus
Registered: 2004-11-20
Posts: 8,451

Re: How to: compile txt installers for rah_ plugins

Thanks so much Julian. I’m on it with testing your instructions.

neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.


Board footer

Powered by FluxBB