Sha256: 4a2c75a992a3d235cf5e35871cc7591e92788f53f1c9942f5d110b097a06fc4c
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 KB
Contents
require 'P4' require 'osutil' module Commands def Commands.p4d_running? list_process_names.select { |p| p =~ /p4d/ }.empty? == false end def self.list_process_names if OsUtil.osx? or OsUtil.linux? return `ps aux | awk '{print $11}'`.split(/\n/).drop(1) else # TODO investigate using tasklist just for this raise 'No support for windows just yet' end end def self.pid_for_process(process) if OsUtil.osx? or OsUtil.linux? line = `ps aux | awk '{print $2,$11}'`.split(/\n/).drop(1).find { |p| p =~ /#{process}/ } unless line.nil? return line.split('\n').first.to_i else return nil end else raise 'NO support for windows yet' end end def Commands.p4d_available?(port=':1666') begin p4 = P4.new p4.port = port p4.connect p4.disconnect true rescue false end end def Commands.unicode_upgrade system("#{OsUtil.p4d_path} -r #{Conventions.p4droot_dir} "+ "-v server=1 -L #{Conventions.p4d_log_path} " + "-xi") end end
Version data entries
11 entries across 11 versions & 1 rubygems