views:

116

answers:

3

Hi,
we are using Perforce for source configuration management and I have just started to hack some small stuff in Ruby on Rails. As Perforce follows the "check-out before modify" paradigm, and RoR expects to have all files writable for the various script/ stuff, do you know/use any helpers to make RoR work together with Perforce? I know I could just open all files for edit all the time, but is there something more elegant?
Thanks, Henrik

A: 

Not sure what you are asking: do want do check-out your files before you compile in your IDE -or- do you want to do perforce actions in a RoR application?

If it is the latter, try P4Ruby: http://public.perforce.com/guest/tony%5Fsmith/perforce/API/Ruby/main/doc/

The other requires IDE support, which is possible, however I cannot advise further unless you say which one you are using (Visual Studio, CodeGear, Notepad?).

HTH,

Dennis Roche
I was talking about the rails command-line stuff (mostly: script/generate) where rails just assumes everything is writable, or where it is easy to forget to add newly created files to the Perforce changelist.
jhwist
OK, not having done **any** RoR development before I probably cannot help further. One idea, however off-the-mark, would be to write a file watcher that checks-outs or adds files from a directory root. Could be setup to be triggered when the RoR (or any other process) requests access.
Dennis Roche
It's probably easier and cleaner to hack a `--perforce` option into the rails scripts (mostly the generators and migrations).
jhwist
A: 

I use git for local RoR development, then git-p4 to synchronize with the Perforce server. My workarea files stay writable, I get all the benefits of git, and I stay in sync with others on my team who use Perforce.

ScottJ
+2  A: 

"Check-out-before-edit" is Perforce's dominant paradigm, but not the only way to use it. Perforce has a good article on Working Disconnected, which sounds closer to your needs:

  1. Set up your Perforce workspace with the "allwrite" option
  2. Allow RoR to make any changes to any files it wants
  3. Update the server's view of your workspace by marking the files you added, deleted, and modified. You can use "Reconcile offline work" in p4v, or run several shell commands suggested in the "Working Disconnected" article.
Commodore Jaeger
Short of a real `--perforce` option this seems the best option. Don't know why I haven't thought of that myself.
jhwist