Class RSCM::P4Daemon
In: lib/rscm/scm/perforce.rb
Parent: Object

Methods

assert_running   launch   new   running?   shutdown   start  

Included Modules

FileUtils

Public Class methods

[Source]

     # File lib/rscm/scm/perforce.rb, line 439
439:     def initialize(depotpath)
440:       @depotpath = depotpath
441:     end

Public Instance methods

[Source]

     # File lib/rscm/scm/perforce.rb, line 448
448:     def assert_running
449:       raise "p4d did not start properly" if timeout(10) { running? }
450:     end

[Source]

     # File lib/rscm/scm/perforce.rb, line 452
452:     def launch
453:       fork do
454:         mkdir_p(@depotpath)
455:         cd(@depotpath)
456:         debug "starting p4 server"
457:         exec("p4d")
458:       end
459:       at_exit { shutdown }
460:     end

[Source]

     # File lib/rscm/scm/perforce.rb, line 466
466:     def running?
467:       `p4 -p 1666 info 2>&1`!~ /Connect to server failed/
468:     end

[Source]

     # File lib/rscm/scm/perforce.rb, line 462
462:     def shutdown
463:       `p4 -p 1666 admin stop` if running?
464:     end

[Source]

     # File lib/rscm/scm/perforce.rb, line 443
443:     def start
444:       launch
445:       assert_running
446:     end

[Validate]