lib/github_labeler.rb
def process_labels_for_repos(repos, labels, change_creator, options = {})
    if !is_remaining_rate_limit_sufficient?(repos.size)
      @logger.error "Rate limit is not enough to process all labels in repositories"
      return nil
    end

    changes = []

    for repo in repos
      repo_name = repo if repo.instance_of?(String)
      repo_name = repo[:full_name] if repo.instance_of?(Hash)

      @logger.debug "Processing labels for repository #{repo_name}"

      refresh_repo_labels(repo_name, options)

      for label in labels
        @logger.debug "Processing label #{label[:name]}"
        change = change_creator.call(repo_name, label, options)
        changes << change if !change.nil?
      end
    end

    return changes
  end
#
# Generic creation of changes for list of labels and list of repos
#
Generic creation of changes for list of labels and list of repos
Generic creation of changes for list of labels and list of repos
def process_labels_for_repos(repos, labels, change_creator, options = {})
    if !is_remaining_rate_limit_sufficient?(repos.size)
      @logger.error "Rate limit is not enough to process all labels in repositories"
      return nil
    end
    changes = []
    for repo in repos
      repo_name = repo if repo.instance_of?(String)
      repo_name = repo[:full_name] if repo.instance_of?(Hash)
      @logger.debug "Processing labels for repository #{repo_name}"
      refresh_repo_labels(repo_name, options)
      for label in labels
        @logger.debug "Processing label #{label[:name]}"
        change = change_creator.call(repo_name, label, options)
        changes << change if !change.nil?
      end
    end
    return changes
  end
def process_labels_for_repos ( repos , labels , change_creator , options = { } ) if ! is_remaining_rate_limit_sufficient? ( repos . size ) @logger . error "Rate limit is not enough to process all labels in repositories" return nil end changes = [ ] for repo in repos repo_name = repo if repo . instance_of? ( String ) repo_name = repo [ :full_name ] if repo . instance_of? ( Hash ) @logger . debug "Processing labels for repository #{repo_name}" refresh_repo_labels ( repo_name , options ) for label in labels @logger . debug "Processing label #{label[:name]}" change = change_creator . call ( repo_name , label , options ) changes << change if ! change . nil? end end return changes end
Generic creation of changes for list of labels and list of repos
Generic creation of changes for list of labels and list of repos
repos
labels
change_creator
options