If you missed it: V2 of n98-magerun dedicated for Magento 2 is here!
We deployed it on November 11 before an exclusive “Stammtisch” after the official Magento 2 release.
As you can imagine we had to fix several issues after the official Magento 2 launch one day before.
With this blog post we like to present you some of the work we did in the last month.
The blob post give you some insides into the QA, automatic builds and features.
We use travis to run all our unit tests. Thanks to the travis team for the great service!
To speed up the travis build Tom moved the code coverage analysis to circle ci which improves the whole process by running some tasks in parallel.
To find code issues we integrated Scrutinizer. The tool sends us a nice report for every pull request or commit and adds simple school grade to every file.
This is a nice incentive to bring a class from “C” to “B” …
The tool can also track the changes in relation to the commit history.
Alle the QA checks are fetched and grouped together by Github on every pull request or commit of the core team.
If everything is right we can merge your code contribution to our code base. As you can see it’s not a big deal to extend n98-magerun2.
All this is done to guarantee a high quality software product because n98-magerun2 is used in business critical environments like deployment systems.
Automatic Phar Builds
To speed up the development and tool deployment process we decided to remove the .phar file from git repository.
The decision was taken for the following reasons:
- Github limits the size of a repository to 1GB
- The phar file is binary and with every version the file growth non linear
- Cloning the repository takes a long time
The phar file installation is the most common method to use n98-magerun2. So we needed a simple solution for everyone to get a pre build phar file.
To provide a good solution we created a new website (https://files.magerun.net) as file hub to download all n98-magerun versions.
All the phar builds are now automated. The build will be triggered on every merge/commit in the develop or master branch.
This gives us some advantages. Every merged pull request leads directly in a new generated phar file which can be downloaded by a download client like curl, wget or with the self-update command and –unstable option.
Compared to the old process we are now able to create many more development releases without blowing up the github repository.
If you compare the command list between n98-magerun1 and n98-magerun2 you can see some differences.
Version 1 comes with 118 commands. Version 2 comes with 56 commands. Let me explain the big difference:
- V1 growed with the community. Many distributions added new commands over the years.
- Some of the V1 commands are moved to the Magento 2 core. So we didn’t port this commands.
- Some commands are not any longer needed according to architecture changes in Magento 2.
The good news: The most favorite commands like db:dump the dev:console or the installer are ported yet.
Why should i use n98-magerun2″?
Magento 2 comes with a build-in command line tool “bin/magento”. Does this mean that n98-magerun2 is not needed anymore?
The short anwer is “NO!”.
The Magento 2 cli tool is result of the good working n98-magerun V1.
Magento recognized that a good command line tool is necessary to have happy developers.
So the new command line interface was created. Did you know that the n98-magerun team was involved in process?
The Magento 2 core team developed all commands with the same code base (Symfony console component).
This gives us now the advantage that we can include all the core commands in our tool.
If you execute n98-magerun2 without any parameter you should the a long list of commands.
The commands contain n98-magerun2 and the Magento 2 core commands if you are inside a Magento 2 store.
That’s also the main difference. If you develop logic which should be shipped inside your store you should now create the commands as Magento 2 commands inside your module.
If you need a command which should be available overall your Magento 2 installations or a service command which don’t need a bootstrapped Magento 2 you should consider to create a n98-magerun2 module.
Another good thing is that you can run all the Magento 2 commands everywhere in your directory tree inside a Magento 2 installation without a change to the root folder of the installation. That makes the usage of any core command really handy. You don’t need to create any bash alias or something else.
To prevent configuration clashes we added a “2” to all configuration files.
~/n98-magerun.yaml -> for Version 1
~/n98-magerun2.yaml -> for Version 2
If you like to port a custom n98-magerun module to V2 you need to add a new config file to your module.
We will add documentation to the n98-magerun2 wiki as soon as possible to give you a good start for porting your stuff.´
What can you do for us?
- Use the tool!
- Give us some starts on github
- Contribute code