require 'P4' class QAPlayProjects def initialize end def projects(user, authtoken) begin p4 = P4.new p4.port = 'qaplay:1999' p4.user = user p4.password = authtoken p4.connect # puts p4.inspect # puts p4.run_info # puts p4.run_user('-o') projects = [] # now get all of the streams under //allan p4.run_streams('//allan/*').each { |streamDesc| projects << { 'id' => "#{streamDesc['Name']}", 'name' => "#{streamDesc['Name']}", 'url' => "http://localhost:3000/projects/#{streamDesc['Name']}/", 'server' => p4.port, 'P4CHARSET' => ENV['P4CHARSET'] || 'none', 'stream' => "#{streamDesc['Stream']}", } } return projects rescue P4Exception => e puts e.message raise e end end end