Sha256: 9ba6a7ec9f6e2de73c34381d9edb1155f0666d8b7b4cf5df192b855377c6b5c4

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 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?

      begin
        attrs['chair_email'] = 
          ASF::Committee.find(attrs['title']).chair.mail.first
      rescue
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whimsy-asf-0.0.5 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.4 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.3 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.2 lib/whimsy/asf/agenda/attachments.rb
whimsy-asf-0.0.1 lib/whimsy/asf/agenda/attachments.rb