CodeIgniter TextMate Bundles

One of the best things about working with TextMate is the powerful bundle system it includes. I have been using it a lot lately with the CodeIgniter bundle. Here are two that are worth looking at:

Either one of those cover pretty much everything except the automatic creation of models and controllers. Since models and controllers require you to have the class name the same as the file name it would make sense and be a lot easier to just have this automatically happen when you call the bundle.

For my projects I created a new command that would do this automatically for you. Here is how I did it.

Step 1.

Open the textmate bundle editor and add a “new command”:

New CommandNew Command

Step 2.

Now on the right side of the bundle editor set it up like this screen shot:

Edit CommandEdit Command

Step 3.

The final step is to now insert the code to create the model for you. Here is the code I used:

If you look at those you will notice I am just using the global TM_FILENAME and then using php to process it into a workable format. Pretty easy but a huge time saver. If you have TextMate tips or improvements for this code please be sure and comment below.

Download

Here is a direct download of the bundle for this tutorial which includes the model, controller, and one for the end of the file:

http://ericlbarnes.com/codeigniter/codeigniter-textmate-bundles/