Sha256: 91e6cf6b5546143704fd24786a817c53c31226c00408af8a7b0b14d2a14292a3

Contents?: true

Size: 923 Bytes

Versions: 4

Compression:

Stored size: 923 Bytes

Contents

module Commands

  def Commands.start(options=nil)
    if !File.exists?(OsUtil.p4d_path)
      Commands.download(options)
    end
    Conventions.init_p4droot_dir
    spawn_p4d
  end

  def Commands.spawn_p4d
    pid = Process.spawn("#{OsUtil.p4d_path} -r #{Conventions.p4droot_dir} "+
                        "-v server=1 -L #{Conventions.p4d_log_path}")
    Process.detach(pid)

    while !p4d_running?
      sleep 0.2
    end

    while !p4d_available?
      sleep 0.1
    end
  end

  def Commands.print_start_help
    puts <<-END.gsub(/^ {6}/,'')
      p4util start

      Spawns a Perforce process in your local /tmp/p4util/p4droot directory.

      If the Perforce executable does not exist, will download the binary first.

      Will try to set up a server log at /tmp/p4util/server.log. It'll be fairly
      verbose by default; this is *not* intended for any kind of performance
      testing.
    END
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
p4util-0.4.3 ./lib/commands/start.rb
p4util-0.4.2 ./lib/commands/start.rb
p4util-0.4.1 ./lib/commands/start.rb
p4util-0.4 ./lib/commands/start.rb