Class: RSCM::P4Daemon
- Includes:
- FileUtils
- Defined in:
- lib/rscm/scm/perforce.rb
Instance Method Summary collapse
- #assert_running ⇒ Object
-
#initialize(depotpath) ⇒ P4Daemon
constructor
A new instance of P4Daemon.
- #launch ⇒ Object
- #running? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(depotpath) ⇒ P4Daemon
Returns a new instance of P4Daemon.
445 446 447 |
# File 'lib/rscm/scm/perforce.rb', line 445 def initialize(depotpath) @depotpath = depotpath end |
Instance Method Details
#assert_running ⇒ Object
454 455 456 |
# File 'lib/rscm/scm/perforce.rb', line 454 def assert_running raise "p4d did not start properly" if timeout(10) { running? } end |
#launch ⇒ Object
458 459 460 461 462 463 464 465 466 |
# File 'lib/rscm/scm/perforce.rb', line 458 def launch fork do mkdir_p(@depotpath) cd(@depotpath) debug "starting p4 server" exec("p4d") end at_exit { shutdown } end |
#running? ⇒ Boolean
472 473 474 |
# File 'lib/rscm/scm/perforce.rb', line 472 def running? `p4 -p 1666 info 2>&1`!~ /Connect to server failed/ end |
#shutdown ⇒ Object
468 469 470 |
# File 'lib/rscm/scm/perforce.rb', line 468 def shutdown `p4 -p 1666 admin stop` if running? end |
#start ⇒ Object
449 450 451 452 |
# File 'lib/rscm/scm/perforce.rb', line 449 def start launch assert_running end |