If you use a setup like I explained in my previous post calling the bake script involves a lot of typing with the core and app parameter paths.
If I want to call the bake script from the /Users/mwesten/Sites/dev/myapp cake app folder, it has to be done like this:
php /Users/mwesten/Sites/cake1.2.x.x/cake/scripts/bake.php -core /Users/mwesten/Sites/cake1.2.x.x/cake -app /Users/mwesten/Sites/dev/myapp
To make things easier on myself I use the following alias and shell script.
First I edit /etc/profile (or ~/.bash_profile)
sudo mate -w /etc/profile
and add the following line:
alias bake="/Users/mwesten/cake12bake.sh"
After this I create the shell script:
mate /Users/mwesten/cake12bake.sh
add the following 2 lines:
#!/bin/sh php /Users/mwesten/Sites/cake1.2.x.x/cake/scripts/bake.php -core /Users/mwesten/Sites/cake1.2.x.x/cake -app $PWD
Now you can execute the bake script from the app folders.
UPDATE:
If you are using the latest version (bleeding edge dev install of CakePHP 1.2) you can do the following instead:
edit /etc/profile or ~/.bash_profile and add the following folder to the path statement:
/Users/mwesten/Sites/cake1.2.x.x/cake/console
After this you can call the bake script like this:
cake bake
or just “cake” for all possible options….
Hmmm….. For some reason it now still calls the wrong app folder, but I think it will be fixed in no-time
Would be really cool if you could just navigate to the directory containing your app in the terminal and just type in bake, and it will get the appropriate inputs… just an idea
Thanks for the tips!
heheheeh That’s exactly what I’m telling that the result of the operation will be….
The first part works with cake 1.1 and svn version of 1.2 until a week ago or so.
Since then cake has an own shell-script that (if put in the path as stated here) can be called directly from an app folder. If you then type “cake bake” you get the bake script to work for you
I went through some similar issues when I started using cakephp on my Mac at home. I came up with a slightly different solution where you navigate to you you app installation and then start bake from there, just like ryan is after.
You can see my solution at http://lemoncake.wordpress.com/2007/06/14/bake-with-mamp-on-os-x/
Thanks Geoff, for showing how the bake-script can be called from eclipse.
As stated in the post and in my comment, the first part of the post worked with an older version of the 1.2 dev-release. Since then the bake process and the entire shell for that matter has been updated. Now you only need to place the cake/scripts folder in your path and then call “cake bake” from the folder of your project to start baking….
(I definately have to write an update to this post! ;o)
RE: Update
I think part of your “wrong app folder” problem is to do with where you call cake from.
If you call from outside the folder which contains the app folder you need to pass in project option. (see cake bake help for info). Basically bake assumes the app folder is in the folder where you called bake from.
I think you are better off using ‘./cake/console’ in your shell path and then baking from the project root folder. This way you will be in the correct location for bake to find the app folder automatically.
The added bonus is this will work for every cake project and you won’t need to a new path with every new project. Just my 2c
Cheers,
Geoff
Hi Geoff,
Thanks again.
)
The problem I was talking about was just 1 or 2 days after the addition of the cake console. I reported the error and it got fixed. Hence it works now if the console folder is added to your path. (This post is prehistoric by now, due to all changes that are made since then in svn
Cheers,
Max