Sha256: cdbc558cef4fab9199066aee0d6fb8b28b17cf2d9638bbffb0f93dcb5de7cc52

Contents?: true

Size: 909 Bytes

Versions: 9

Compression:

Stored size: 909 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 work/p4droot directory.

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

      Will try to set up a server log at work/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

9 entries across 9 versions & 1 rubygems

Version Path
p4util-0.3.1 ./lib/commands/start.rb
p4util-0.3.0 ./lib/commands/start.rb
p4util-0.2 ./lib/commands/start.rb
p4util-0.1.6 ./lib/commands/start.rb
p4util-0.1.5 ./lib/commands/start.rb
p4util-0.1.4 ./lib/commands/start.rb
p4util-0.1.3 ./lib/commands/start.rb
p4util-0.1.1 ./lib/commands/start.rb
p4util-0.1.0 ./lib/commands/start.rb