2 messages in com.perforce.p4ruby[p4ruby] Creating client from scratch
FromSent OnAttachments
Dale Quigg28 Feb 2008 16:03 
Dale Quigg28 Feb 2008 18:33 
Subject:[p4ruby] Creating client from scratch
From:Dale Quigg (dal@messagegate.com)
Date:02/28/2008 06:33:17 PM
List:com.perforce.p4ruby

I got an answer off-list.

spec._view = spec._view =[ a, b ] is what I need to get it to work.

Thanks Jeff!

Dale

-----Original Message----- From: p4ru@perforce.com [mailto:p4ruby-bounces at perforce.com] On
Behalf Of Dale Quigg Sent: Thursday, February 28, 2008 4:04 PM To: p4ruby at perforce.com Subject: [p4ruby] Creating client from scratch

Hi,

I want to create a client from scratch (specifically the view spec)

I can use the code below to get the client created, but the resulting view spec
contains (in my case) //test/... //dq-auto-1/test/... //messagegate/... //dq-auto-1/messagegate/... //depot/... //dq-auto-1/depot/... //messagegate/foo/... //dq-auto-1/foo/... //messagegate/bar/... //dq-auto-1/bar/...

All I want are the last two lines that I added.

I'm sure this is a basic question, but I don't see how to iterate through
spec._view and make changes.

If I add code to my example like; spec._view = "" prior to adding my entries, the resulting client has no reference to View:

Also, doing something like; spec._view = spec._view << "//messagegate/bar/... //" << ClientName <<
"/bar/..." gives pretty odd results. I'm sure there is some reason for this, and I'm fine
with creating a variable and using it like in my example.

Thanks for any help. Dale

--- begin sample ---

require "P4" p4 = P4.new p4.connect

ClientName = "dq-auto-1"

begin spec = p4.fetch_client( ClientName )

a = "//messagegate/foo/... //" << ClientName << "/foo/..." b = "//messagegate/bar/... //" << ClientName << "/bar/..." spec._view = spec._view << a spec._view = spec._view << b spec._description = ClientName << " description"

p4.save_client( spec )

rescue P4Exception p4.errors.each { |e| $stderr.puts( e ) } raise end

--- end sample ---

Dale Quigg? |||? Senior Build / Configuration / Installation Engineer MessageGate |||? Enterprise Email Governance