How Deploy* Works
Even if you are not a programmer you might wonder how exactly does Deploy* work? Does it just copy files over? Does it create them on the fly? Is it magic?
As of 1.3.2 and under Deploy* goes through a few processes before making that final zip you get at the end after you push that big red “Deploy!” button.
The very first thing it does is creates a temp directory inside the root of Deploy*. This directory is “deploy_” then it adds the date, in UNIX time, and then a set of random numbers. This way, even if two people create Deploy*s at the exact same time the chance of them overwriting the others Deploy* is extremely slim.
Once the directory is chosen it checks to see if you chose a project name and if so what and what the file extension should be (if you chose the .php extension it would change index.html to index.php at this time). It also adds the DOCTYPE you chose into a variable for later.
If you chose to include a blank css file it creates a CSS file from scratch with PHP. If you choose include the resets it grabs the file from the /files directory. It places either the blank or reset file into your temp directory. It then saves that you chose CSS in a variable for later use.
Next, if you chose jQuery, it looks for the correct type of jQuery file to include such as the packed or uncompressed and then copys it into the temp directory. It then adds this choice to a variable for later.
The plugin part is next and if you chose plugins the process is probably one of the most tricky parts of Deploy*. I wanted to keep it easy for people to download Deploy* and add their own plugins with XML. The XML is basically in a v0.9 stage at this point and needs to have more flexibility to it.
The XML allows multiple images and stylesheets. It allows a space for a developer to put a link to his site and of course name his plugin. projectdeploy.org/plugins.xml Is where the XML that runs this Deploy* is now.
PHP runs through each choice and then runs through and copys all the files it needs into the right locations (e.g. <image>s get put into the /images in your Deploy* and <css> in the /css directory and the actual plugin file in the /js.) Finally it puts all the names of the plugins you chose into a single variable.
After this is all finished it creates that index.php file by putting all the info it needs into the final variable which holds all the previous variables above and creates a brand new file. So, for the DOCTYPE, <head>, <script>s, and everything depend on your previous choices.
The last thing it does creates any extra directories you chose such as flash, images, or includes. Deploy* is smart enough to create the images or css directory if your plugin requires it and you chose not to include those directories.
Now for the fun part, once everything is the way it should be when they unzip it, it copies this directory (deploy_xxxxxx) into the /deploys directory. It then copies itself inside of itself renames it to your project name and then zips that directory. You end up with raw project folder with the name of like deploy_xxxxx with all your files inside of it, a directory named your project name with all your files and a zip of your directory which becomes your final Deploy* which you end up downloading.
It goes through this process every time you visit the deploy.php page. It has gone through this around 12,000+ times at the time of writing this.
Hopefully this will help people when they download this and start developing on it which some have been doing. Not knowing about the temp directory makes it very strange when you are getting mkdir errors in your root directory when you think it supposed to be creating the directories inside of /deploys
