• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introducing Fire: Similar to Cake’s Bake and RoR’s script/generate

#1
[eluser]Michael Wales[/eluser]
As I started working on a rewrite of an older project I got to thinking about how much time I spend in Windows Explorer, rather than actually working on my project. Right-click > New Text Document > Rename to my .php file

It seems to add up - then you have to go in an add the standard starter code to your controllers and models - all of this is time taken away from developing your application!

I'm not sure if something exists for Code Igniter already, but I spent 10 minutes this morning developing a php script that will ease the process of creating controllers and models (and I added views for pretty much no reason as well). Similar to Ruby on Rails' script/generate, Fire will allow you to create new controllers, models, and view via the command line - preloaded with the standard code and ready for use.

Check out my blog for more information and download: Introducing Fire: A Code Igniter Utility.

I'm definitely open to suggestions - as I said, it's extremely basic at the moment - since I am wanting to jump into my project ASAP. But, if it proves useful to others and myself I will continue developing it into a more robust solution. I'm really wanting to get Ruby on Rails style migrations in there - we'll see.

#2
[eluser]Crafter[/eluser]
Have a look at the CodeCrafter project, which does something similar to what you wish to achieve.

#3
[eluser]Michael Wales[/eluser]
Ah - I seem to remember this from 6-7 months ago when I first dabbled in Code Igniter.

I never did give it a try because your site tells me absolutely nothing about it (or I can't find it anywhere). Sad

Is there any other information, rather than "Download Here"?

#4
[eluser]Crafter[/eluser]
Look up CodeCrafter in this forum, the Code Igniter wiki : http://codeigniter.com/wiki/Category:Advanced::CRUD/

#5
[eluser]FrankieShakes[/eluser]
Michael,

Sweet! I love Rails for its quick and easy generators. Nice when you just want to get a project going quickly.

I've just downloaded Fire, and will have a go at it!

#6
[eluser]ceej[/eluser]
I get an error:

Code:
C:\www\system\application>php fire.php view test
'php' is not recognized as an internal or external command,
operable program or batch file.

#7
[eluser]FrankieShakes[/eluser]
ceej,

Is PHP in your PATH? I can't remember how to set the PATH in Windows (I'm on a Mac), but that may be the issue. If you type "php" by itself at the command prompt, do you also get that error? If so, it's definitely a path issue.

If you're unsure about how to set the path, or you just don't want to, you can also run the PHP command from its full path (ie: C:\php\php.exe fire.php <command>).

#8
[eluser]FrankieShakes[/eluser]
Michael,

Just a quick note... I made a minor modification to the script in order to take UNIX directory separators in account: / instead of \

Not sure if there's an easy way to determine the separator based on the OS the script is being run on.

#9
[eluser]Michael Wales[/eluser]
Yeah Frankie - that's something I knew would become an issue and just never got to messing with it. As the blog posts said - it was a quick 10 minute hack job to get started on my own CI app. I believe Windows will understand the Unix separator with no issues - so I'll probably just go with that.

ceej: You need to add php to your path (I'm guessing you are using xampp, if it's not there). Regardless, follow these intstructions:

1. Find php.exe on your computer and write down the entire file name (including path). It will look like C:\php\php.exe or c:\xampp\php\php.exe - something like that.
2. Right-click on My Computer and select Properties
3. Select the Advanced tab
4. Click the Environment Variables button at the bottom.
5. In the System Variables portion of the screen, highlight the PATH variable, and click Edit.
6. Add the php.exe full path (you found in step 1) to the variable, followed by a semicolon (Wink
7. Your new PATH variable should look like: c:/php/php.exe;c:/some/other/program.exe;c:/windows;c:/we/have/some/more; - kind of Big Grin

#10
[eluser]Michael Wales[/eluser]
A quick look at PHP's basename() documentation confirmed my thoughts - Windows will accept either slash as a directory seperator.

The next version of Fire will include this - for the time being, you can manually edit the file if you'd like.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.