class Faf::Forks
Attributes
repo[R]
Public Class Methods
new(repo, _options = {})
click to toggle source
# File lib/faf/forks.rb, line 7 def initialize(repo, _options = {}) @repo = repo end
Public Instance Methods
each() { |f| ... }
click to toggle source
# File lib/faf/forks.rb, line 11 def each forks.each do |f| yield(f) end end
Private Instance Methods
forks()
click to toggle source
# File lib/faf/forks.rb, line 19 def forks @forks ||= get_forks end
get_forks(_options = {})
click to toggle source
# File lib/faf/forks.rb, line 23 def get_forks(_options = {}) query = <<-GRAPHQL query($owner: String!, $name: String!, $cursor: String) { repository(owner: $owner, name: $name) { forks(first: 100, after: $cursor, orderBy: { field: PUSHED_AT, direction: DESC }) { edges { cursor node { nameWithOwner pushedAt } } } } } GRAPHQL query_options = { owner: repo.owner, name: repo.name } forks = [] loop do response = Faf::Connection.query(query, query_options) edges = response.data.repository.forks.edges if response break unless edges && edges.any? edges.each do |edge| query_options[:cursor] = edge.cursor node = edge.node forks << Faf::Repo.new(node.name_with_owner, pushed_at: Time.parse(node.pushed_at)) end end forks end