• No results found

Cloning the Development Version of MOD

In document MODX the Official Guide (Page 89-91)

If all you want to do is keep up with the latest bug-fixes for MODX and report bugs you find, you don’t actually need a GitHub account. You’ll need a Git client, such as msysgit, and a place to put your local version of MODX (e.g., in XAMPP/htdocs). See the section earlier in this chapter on installing XAMPP on your local machine. Because MODX is a collective project, it depends on people like you to contribute to its development. The method we describe here sets things up so that you can do that. You could contribute a major new feature or an add-on component that will be used by thousands of MODX users. If your skills are more modest, you could just contribute a tiny change that makes MODX easier to use, such as a change in the wording of an error message. Every little bit helps. If you’re absolutely certain that you’ll never contribute, you can skip the sections on creating and configuring a GitHub account and just clone the MODX repository. The section below describes how to do that. If you think you might contribute, however, skip down to the section on Contributing to MODX Development.

Let’s assume that you want to create a local copy of the development version of MODX in your XAMPP/htdocs/modx/ directory. Open up the Git Bash command-line tool and navigate to the htdocs/ directory with a command like this:

cd c:/xampp/htdocs

You should see the path to the htdocs/ directory on the right side of the command prompt. Now, enter this line to clone the contents of the MODX repository in the modx/ directory:

git clone http://github.com/modxcms/revolution.git modx

The clone command will duplicate the MODX Revolution repository on your local disk in a directory called modx. You can use a different directory name instead of modx if you wish by changing the last word in the line above. Git will give you progress messages while cloning the MODX repository. Because of the way the repository is configured, you have a full version of MODX when the clone process has finished, but there are a few more steps to complete before you can run Setup. First, you need to get the development branch of MODX and switch to it.

Type the following command in Git Bash to move to the MODX directory: cd modx

Now enter this command:

git pull

You should see a message telling you that everything is up-to-date. Type:

git branch

That will show you the current branches in your local repository. There will probably be just one: master. It has an asterisk next to it to show you that it’s the branch you are cur­ rently on. You should also see (master) at the end of the path Git shows you.

To get the proper development branch, use this command:

git checkout -b develop origin/develop

That will make all the local MODX files consistent with the develop branch of the MODX repository. The term o rig in , by the way, is just an alias for the remote repository we

develop based on the remote develop branch. You should now see (develop) in Git Bash instead of (master). If you type git branch, you should see both master and develop

with an asterisk next to develop to show that it is the current branch. As long as you don’t issue another checkout command, you should remain on the develop branch, and you’ll automatically be there every time you launch Git Bash to go to the modx directory. At this point, you have the current development version of MODX. You now need to

build it and run Setup. See the sections below on Building the Transport Package and Running Setup. Once you’ve done the build and run Setup, you’ll have a working copy of the development version. You can log in to your MODX site by putting the following URL in your browser’s address bar:

http://localhost/modx/manager

Of course changes will be made at the MODX remote repository as more bug-fixes come in, and you’ll want to update your copy of MODX. You can update your local files with:

git fetch origin develop git merge origin/develop

Occasionally, you will see [ReUp] or [Rebuild/Upgrade Required] in a commit message when you pull changes from the MODX repository. That means that you need to re-run the build and re-run Setup. This is an important step. If you skip it, your MODX install may not work properly.

The steps above will work fine if you never make any local changes of your own or if you make them in or under the assets/ or docs/ directories — your Git clone is configured to ignore those directories. Installing or upgrading MODX add-on components is also fine because all well-behaved components will only make changes in directories that Git ignores. If you need to add image, CSS, or JS files of your own, always remember to put them under the assets/ directory.

In document MODX the Official Guide (Page 89-91)