Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Offline
Re: How to: compile txt installers for rah_ plugins
Thanks so much Julian. I’m on it with testing your instructions.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to: compile txt installers for rah_ plugins
I got to the final instruction in Terminal:
mtxpc rah_swap-master > rah_swap_v0.1.0.txt
zsh: command not found: mtxpc
Some context:
I’m using MAMP, with my .zshrc configured as
alias phpmamp='/Applications/MAMP/bin/php/php7.4.2/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php7.4.2.ini"'
alias mtxpc="php /usr/local/bin/mtxpc.phar
php.ini location is
/Applications/MAMP/bin/php/php7.4.2/conf
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Can someone please advise where I need to place mtxpc.phar on my system?
Offline
Re: How to: compile txt installers for rah_ plugins
Try using phpmamp
instead of php
in the command line, i.e. to test:
phpmamp /usr/local/bin/mtxpc.phar /path/to/rah_swap-master > /path/to/rah_swap_v0.1.0.txt
And if that works, then change the line in your .zshrc
to:
alias mtxpc="phpmamp /usr/local/bin/mtxpc.phar"
You’ll just need to make sure MAMP is running when you want to call that.
Don’t forget to quit and restart the Terminal after changing .zshrc
(or enter source ~/.zshrc
to load the new settings).
TXP Builders – finely-crafted code, design and txp
Offline
Re: How to: compile txt installers for rah_ plugins
Thank you 2
That did the trick.
Offline
Re: How to: compile txt installers for rah_ plugins
Good to know that works 👍.
TXP Builders – finely-crafted code, design and txp
Offline
Re: How to: compile txt installers for rah_ plugins
You can, of course, install his installer with composer as he describes in the readme. That also sets it up for system-wide use.
TXP Builders – finely-crafted code, design and txp
Offline