Hey Bruno,
I can answer some of these with some of my experience. I don't have much experience in Rails but I try to keep up with what's happening in that camp. Packages: Personally, for plugins and libs, I use git submodules. There are pitfalls there, but it works and since I'm the only one that owns the code, I just work through them. Migrations: I believe Cake supports migrations but have not used them much. I believe it works similar to Rails. Automated Deploys: I've read that people use Cap for PHP deployments. Cap seems pretty flexible and can be used outside the Rails domain. There's also things like ant and Phing but haven't looked into this just yet (but seriously need to) Asset Compression: Yes. Via plugin written Mark Story ( https://github.com/markstory/asset_compress) It works pretty well and supports CDNs. Also supports things like coffee script and lesscss. Workers, etc: Cake has a Task/Shell framework that allows you create, well, tasks and shell programs you can run from cron or wherever. Beyond that, you can add event handlers/listeners to respond to custom events in Cake's Event system (http://book.cakephp.org/2.0/en/core-libraries/events.html) which is new in 2.1. Then there's things like Gearman and Beanstalkd (neither of which I have exposure to but the concept sounds interesting) Skipping some points... Testing: PHPUnit is the framework used by CakePHP 2+ http://book.cakephp.org/2.0/en/development/testing.html Like you said, there's many ways to skin a cat, but these are some off the top of my head. Cheers! randy On Wed, Jun 6, 2012 at 8:19 AM, Bruno Dias <[email protected]> wrote: > Hi guys. My intention is not to make comparisons or discuss which > framework is better. I know the power from both CakePHP and Rails. I'm > sure that there's a way to do similar things in both of them. > > So, this is the situation: in Rails framework, I'm used to do > somethings that I'd like to do on CakePHP (some of them I haven't > found on the documentation). > > They are: > > - Package management > In Rails, I have the "Gemfile" file, where I write the version of each > "gem" used in the application. If I want to upgrade or downgrade, I > change the version and run the "bundle update" command. How do you > update plugins? Do you use tools like GIT to checkout each one to > newer versions? > > - Migrations > When I need to change the database, I create a empty "migration" file > through the console command "rails generate migration". Then, in the > generated file, I add the changes, like > "rename_column :users, :address, :location". After that, I run "rake > db:migrate" and the database is migrated. How to do that on CakePHP? > > - Automated Deployment > Deployment in Rails can be made automated using the "Capistrano" ruby > gem. Basically, I run "cap production deploy" in the command line. > Then, based on the instructions on the "deploy.rb" file, it logs into > the server(s), clone the newest version of the code from the git > repository, and backups the current release, so I can rollback. It > also can create symlinks for "shared" folders (like user uploads), > recompile the assets, run pending migrations, install new > dependencies, restart some server processes, restart the application > itself, and can execute other command line tasks. Is there something > similar on CakePHP? > > - Assets compression > In Rails, when I'm in production mode, the CSS and JS assets are > automatically compiled into single files, and regenerated after each > deployment. That's a native feature in Rails 3.1+. Is that possible on > CakePHP? > > - Workers and Background Jobs > Rails can use a gem called "delayed_job" to enqueue tasks to be > executed in background by "workers", like sending an e-mail after user > signup, for example. How do you do that? > > - Namespaces for controllers > If I want to create an admin interface, or a web service (using the > "api" namespace, for example), or a "mobile" namespace, I just create > the respective folders on the "controllers" folder. Then, I put the > controllers there and create the routes to access them. What's the > best way to do that on Cake? > > - Access model methods from view > It seems that CakePHP return an associative array when I grab data > from the database, and not the true "objects". So, I can not access > the model methods. > Let's suppose my UserModel class provides a method called "age" that > calculates the user current age based on his birthday. In Rails, I > could do this on the view: <%= @user.age %>. I need to create a view > helper for doing that on Cake? Like <?php $helpers- > >calc_user_age($user); ?> (or something like that) ? > Another situation: Let's suppose I want to get the last comment from a > user, and within the comment, insert a link to the related post using > the post title. > In Rails I would do something like @user.comments.last.post.title to > get the post title. How could I do that in Cake, without using that > "recursive=3" feature that gets lots of unnecessary data? > > - Chaining model scopes > Let's suppose I have a model called Post. In Rails, I can create > scopes on models and mix them the way I want. > If I want to the get the "5 last published posts from the category > Programming ordered by the most accessed", for example, I would call > them this way: > "Post.published.from_category("programming").most_accessed.limit(5)". > If I want only the draft posts ordered by recent, integrated with > pagination, I would call "Post.drafts.recent.page(2)". > What is the best way to create and chain scopes on CakePHP? Build > dynamically an array of conditions and send it as the parameter for > "find"? > > - Tests > What are the testing tools adopted by the CakePHP community? I need to > test the models and its methods, test the controllers and its > responses and variables, and test the views content (also Javascript > interaction), create fixtures, etc. I also would know if there is a > way to create something like autotest, that run the tests after file > saves. > > Well, basically these are the points. Sorry for the long post, and for > my error-prone and redundant english (i'm not a native speaker). Hope > we can have a good conversation. Thank you! > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
