XenForo CLI - making our lives easier

Naatan

Well-known member
For the past month or so, Robbo and I have been working on an ambitious project to create a command line tool for XenForo. The reason being that we both felt having to always switch between IDE and editor was costing a lot of time and worse, it was ripping us out of the "zone".

Currently the CLI already implements a lot of commands, some examples of what it can do:
  • Create a new addon and generate basic file structure
  • Install / Update / Uninstall addons
  • Import an addon from git or mercurial (experimental)
  • Show information about addons
  • Extend existing XenForo classes
  • Create event listeners
  • Create routes and their related controllers
  • Manage phrases & templates
  • Rebuild your caches
  • More .. (see the readme for details)
All of these commands are working for the most part, but should be considered as alpha. We have not yet entered the polishing phase and are currently simply adding features and extending upon existing ones.

That said, I'd like to invite anyone interested over to the Github repository and our discussion group to contribute (be it by providing feedback or actual code) and make this project a success, you can find the links below.



Hope to get some good feedback and useful contributions!
 
I'm a bit surprised by the lack of response to this. Surely Robbo and I can't be the only ones that see the value in this?

Please, if you find the project interesting but not useful in it's current state for any other reason besides it being alpha, let us know. Part of the purpose for my posting this thread is to get useful feedback.
 
Sorry,

I am interested. Though I expressed it in rather a lazy way by merely liking your post.

For me to be more interested, I'd probably need specific details on how to use it.

I'd also be happy to test out some of its functions on my test board if, for example, you can provide basic instructions on how to install an add-on with it.
 
Hm, i'm intersted too, but i'm having & using my own tools for a long time and too many things are "hardcoded"
sc2.webpsc.webp
and include ugly code like:
PHP:
$name = 'Ragtek_' . substr($addOnId, 6) . '_Hashes';
$hashFileContent = XenForo_Helper_Hash::getHashClassCode($name, $this->hashes);
$directory = 'upload/library/Ragtek/' . substr($addOnId, 6) . '/Hashes.php';
 
...
 
 
    protected function _getPaXXXXX(){
        $structure = '';
        if ($this->_checkIfRagtekAddon()){
            $structure .= "Ragtek_" . substr($this->_addon['addon_id'], 6) . '_';
        }
        else {
            // TODO i need to change this
            die('only ragtek add-ons are supported ATM');
        }
        return $structure;
    }
As i started developing add-ons, i've decided to put all my add-ons into the "ragtek" directory, so it's easier to use my add-ons via symlink for > 30 boards (http://xenforo.com/community/threads/move-config-php-out-of-library-directory.8970/ )
so i'm not able to use https://github.com/Naatan/XenForo-CLI or https://github.com/daohoangson/DevHelper

now it would be a too big "refactoring challenge" to move everything out of the ragtek directory
 
Sorry,

I am interested. Though I expressed it in rather a lazy way by merely liking your post.

For me to be more interested, I'd probably need specific details on how to use it.

I'd also be happy to test out some of its functions on my test board if, for example, you can provide basic instructions on how to install an add-on with it.

Thanks Yorick, I will certainly add more documentation, unfortunately I'm not very good at writing documentation as my head is too much in the code, it makes it hard to look at it from a newcomers perspective. Either way I'll do my best and write up some info to get people started.

Hm, i'm intersted too, but i'm having & using my own tools for a long time and too many things are "hardcoded"
View attachment 30295View attachment 30296
and include ugly code like:
PHP:
$name = 'Ragtek_' . substr($addOnId, 6) . '_Hashes';
$hashFileContent = XenForo_Helper_Hash::getHashClassCode($name, $this->hashes);
$directory = 'upload/library/Ragtek/' . substr($addOnId, 6) . '/Hashes.php';
 
...
 
 
    protected function _getPaXXXXX(){
        $structure = '';
        if ($this->_checkIfRagtekAddon()){
            $structure .= "Ragtek_" . substr($this->_addon['addon_id'], 6) . '_';
        }
        else {
            // TODO i need to change this
            die('only ragtek add-ons are supported ATM');
        }
        return $structure;
    }
As i started developing add-ons, i've decided to put all my add-ons into the "ragtek" directory, so it's easier to use my add-ons via symlink for > 30 boards (http://xenforo.com/community/threads/move-config-php-out-of-library-directory.8970/ )
so i'm not able to use https://github.com/Naatan/XenForo-CLI or https://github.com/daohoangson/DevHelper

now it would be a too big "refactoring challenge" to move everything out of the ragtek directory

Actually this is already possible, the "addon add" command allows you to specify the directory the addon is in, so you can have your own namespace directory.

I see you basically had the same "problem" as us, being that some things are just too tedious to do repeatedly. I think having a web interface for it is an interesting solution but it still draws you out of your IDE. Why not join us in developing the CLI and add some of the tools that you are currently missing in it?

A nice side-effect of doing this with a larger group of developers is that you have constant code-review, essentially forcing you to a certain level of code quality. And if you miss something, other developers might catch it.
 
Maybe if I get my head around it all I could start writing documentation for you.

But - clear something up for me - I assume I need to install this as an add-on first? Or maybe not?

Then how would I actually run the commands?
 
These installation steps are preliminary and will be polished when we head into beta, but at the moment you simply download the project and put the "xf" file on your PATH (Mac & Linux). Currently Windows is not supported but we'll be adding support very soon.

Once you can run "xf" from any directory you go either in your xenforo, library or addon directory and execute "xf", it will then give you information on what commands you can run.

I'll provide a more detailed step-by-step guide soon.
 
Sounds good, thanks.

I have access to Linux and Mac, but my primary OS is Windows so that functionality is important for me, but won't stop me from having a play, thank you :)
 
Rebuilding cache through CLI sounds good. Especially if you have a very large DB (like we have in testing).
That way you don't have to keep your browser open (and pc on).
 
Rebuilding cache through CLI sounds good. Especially if you have a very large DB (like we have in testing).
That way you don't have to keep your browser open (and pc on).
Even better. If you have an addon installed from github you can simple run "xf addon update" and it will grab all updates, update the addon and rebuild caches for you :)

We have wanted rebuild times to also be much faster and Naatan has looked at ways to improve the time but is yet to find anything to speed it up a lot.
 
Imports are a whole new beast that I doubt we will do. However we have the foundation to do it on.
XenForo upgrades will most likely be in a release to remove the browser steps from the situation.

The parts I work on are generally to work with git or hg. I deploy websites with them and by using hooks can have certain functionality run on the command line by the server when I push an update.
For example a XenForo upgrade gets pushed to my server, the server detects it when it receives the new changes at puts the forum into maintenance and executes the updates without me doing a thing. (this isn't possible yet though)
 
I have XFCliImporter on my server and I don't remember installing it or where I got it from. What's it for? I don't see the addon on my site either.
 
I have XFCliImporter on my server and I don't remember installing it or where I got it from. What's it for? I don't see the addon on my site either.

Oh so I used this when importing my vbulletin 4 forum over to xenforo. So I can delete this from the server now?

This has nothing to do with the project that this thread is about. But yes, you can.
 
Why not call it "XenForo Developer CLI"?

As it is, I was confused the first time I saw the title as well.

Because while the current feature set is mostly targeted at developers it's meant to evolve to be a general toolkit for XenForo usable by anyone comfortable with the CLI.

You can easily see from the first post that this is not about the CLI Importer.
 
Top Bottom