Small Tools That Make Your Life Easier

If you’re actively doing development work and your production server is different from the development one, as it is in my case, at some point you’ll need to upload or deploy files from the development server to production. If this happens a lot during the day or even once a day, you might want to automate the deployment process.

I’ve created 2 small shell (PHP) scripts that will do just that, one using RSYNC/SSH and the other one plain FTP (you need to have ncftp installed). Here’s how to use them:

$> cd dir_to_deploy/
$> deploy now

Or, for the deployment via FTP:

$> cd dir_to_deploy/
$> ftpdeploy

It’s quite simple! Assuming you’ve installed the scripts in your path (with +x permission) you just go to the directory you want deployed and issue the above commands. You will be asked for the required information, such as host, user, pass, remote path, etc… the nice thing is that this information is saved on a per directory basis, so the next time you deploy you don’t have to enter it again, unless you want to change something, of course!

These tools were specially created to deploy applications made with My Framework, but they will work in almost any situation. You also have options to exclude certain files from deployment (like log and temporary files), but to find out how either ask me by posting a comment or read the source code.

Another tool I created that’s also available to download at the end of this post might help you if you want to minify and compress your JS files. It uses a PHP library that you can find here.  It is a very good practice to minify and compress your JS files because you save a lot of bandwidth, especially if you’re web server is configured to serve compressed Javascript for browsers that support this (almost all!).

Suppose you have a JS file named “myjsfile.js”. To minify it, simply use:

$> minifyjs myjsfile.js

The above command will create 2 new files in the same directory as the target file, named “myjsfile.min.js” and “myjsfile.min.js.gz”. You figured out what these are, right?

Download these tools here.

You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

1 Comment »