Sha256: 204a8090c071804d5a9eb60c181130083532c1da76f4cad0c5b6db10513fea3d

Contents?: true

Size: 1.31 KB

Versions: 24

Compression:

Stored size: 1.31 KB

Contents

# Attachments

class ASF::Board::Agenda
  parse do
    pattern = /
      -{41}\n
      Attachment\s\s?(?<attach>\w+):\s(?<title>.*?)\n+
      (?<report>.*?)
      (?=-{41,}\n(?:End|Attach))
    /mx

    scan @file, pattern do |attrs|

      attrs['title'].sub! /^Report from the VP of /, ''
      attrs['title'].sub! /^Report from the /, ''
      attrs['title'].sub! /^Status report for the /, ''
      attrs['title'].sub! /^Apache /, ''

      if attrs['title'] =~ /\s*\[.*\]$/
        attrs['owner'] = attrs['title'][/\[(.*?)\]/, 1]
        attrs['title'].sub! /\s*\[.*\]$/, ''
      end

      attrs['title'].sub! /\sTeam$/, ''
      attrs['title'].sub! /\sCommittee$/, ''
      attrs['title'].sub! /\sProject$/, ''

      attrs['digest'] = Digest::MD5.hexdigest(attrs['report'])

      attrs['report'].sub! /\n+\Z/, "\n"
      attrs.delete('report') if attrs['report'] == "\n"

      attrs['missing'] = true if attrs['report'].strip.empty?

      unless @quick
	begin
	  committee = ASF::Committee.find(attrs['title'])
	  attrs['chair_email'] = committee.chair.mail.first
	  attrs['mail_list'] = committee.mail_list
	  attrs.delete('mail_list') if attrs['mail_list'].include? ' '
	rescue
	end
      end

      if attrs['report'].to_s.include? "\uFFFD"
        attrs['warnings'] = ['UTF-8 encoding error']
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
whimsy-asf-0.0.33 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.32 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.31 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.30 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.29 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.28 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.27 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.26 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.25 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.24 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.23 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.22 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.21 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.20 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.19 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.18 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.17 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.16 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.15 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.14 lib/whimsy/asf/agenda/attachments.rb