Sha256: ea1909eb6ea027ad59e04681bc159ecd6d675380960348bb112c91a58f3d73fc

Contents?: true

Size: 1.62 KB

Versions: 27

Compression:

Stored size: 1.62 KB

Contents

module ASF

  class ICLA
    include Enumerable

    def self.find_by_id(value)
      return if value == 'notinavail'
      new.each do |id, name, email|
        if id == value
	  return Struct.new(:id, :name, :email).new(id, name, email)
        end 
      end
      nil
    end

    def self.find_by_email(value)
      value = value.downcase
      ICLA.new.each do |id, name, email|
        if email.downcase == value
	  return Struct.new(:id, :name, :email).new(id, name, email)
        end 
      end
      nil
    end

    def self.availids
      return @availids if @availids
      availids = []
      ICLA.new.each {|id, name, email| availids << id unless id == 'notinavail'}
      @availids = availids
    end

    def each(&block)
      officers = ASF::SVN['private/foundation/officers']
      iclas = File.read("#{officers}/iclas.txt")
      iclas.scan(/^([-\w]+):.*?:(.*?):(.*?):/).each(&block)
    end
  end

  class Person
    def icla
      @icla ||= ASF::ICLA.find_by_id(name)
    end

    def icla?
      ICLA.availids.include? name
    end
  end

  # Search archive for historical records of people who were committers
  # but never submitted an ICLA (some of which are still ASF members or
  # members of a PMC).
  def self.search_archive_by_id(value)
    require 'net/http'
    require 'nokogiri'
    historical_committers = 'http://people.apache.org/~rubys/committers.html'
    doc = Nokogiri::HTML(Net::HTTP.get(URI.parse(historical_committers)))
    doc.search('tr').each do |tr|
      tds = tr.search('td')
      next unless tds.length == 3
      return tds[1].text if tds[0].text == value
    end
    nil
  rescue
    nil
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
whimsy-asf-0.0.27 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.26 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.25 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.24 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.23 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.22 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.21 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.20 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.19 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.18 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.17 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.16 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.15 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.14 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.13 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.12 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.11 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.10 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.9 lib/whimsy/asf/icla.rb
whimsy-asf-0.0.8 lib/whimsy/asf/icla.rb