lib/place/project.rb
# Retrieve a specific project (based on url only)
Retrieve a specific project (based on url only)
Retrieve a specific project ( based on url only )
def retrieve
    start_time = Time.now.to_i
    Dir.glob("#{url}/polarion-project.xml").each do |filename|
	  content = IO.readlines(filename).join('')
	  doc = Nokogiri::XML(content)
	  self.class.rules.each_pair do |k,v|
	    tmp = doc.xpath(v)
		self.send("#{k}=", tmp[0].content)  unless tmp[0].nil?		
	  end
	end
	self.save
	Place.logger.info("saved project with name #{self.name}")
	retrieve_parent_roles
	TimePoint.collect_all(url)
    timepoints.all.each{|tp| tp.retrieve}  if timepoints.size > 0
	WorkItem.collect_all(url)
    workitems.all.each{|wi| wi.retrieve}  if workitems.size > 0
	retrieve_participations
	users.each do |u|
	  u.retrieve  if u.full_name.nil?
	  u.retrieve_watches
	end
	self.save
  end
def retrieve start_time = Time . now . to_i Dir . glob ( "#{url}/polarion-project.xml" ) . each do | filename | content = IO . readlines ( filename ) . join ( '' ) doc = Nokogiri :: XML ( content ) self . class . rules . each_pair do | k , v | tmp = doc . xpath ( v ) self . send ( "#{k}=" , tmp [ 0 ] . content ) unless tmp [ 0 ] . nil? end end self . save Place . logger . info ( "saved project with name #{self.name}" ) retrieve_parent_roles TimePoint . collect_all ( url ) timepoints . all . each { | tp | tp . retrieve } if timepoints . size > 0 WorkItem . collect_all ( url ) workitems . all . each { | wi | wi . retrieve } if workitems . size > 0 retrieve_participations users . each do | u | u . retrieve if u . full_name . nil? u . retrieve_watches end self . save end
Retrieve a specific project (based on url only)
Retrieve a specific project ( based on url only )
# ugly way to prevent multiple (global) data retrieve :(