Class: TeachersPet::Actions::Forks

Inherits:
Base
  • Object
show all
Defined in:
lib/teachers_pet/actions/forks.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #options

Instance Method Summary collapse

Methods inherited from Base

#execute, #init_client, #initialize, #octokit_config, #read_file, #read_members_file, #read_students_file

Constructor Details

This class inherits a constructor from TeachersPet::Actions::Base

Instance Method Details

#get_forksObject



10
11
12
# File 'lib/teachers_pet/actions/forks.rb', line 10

def get_forks
  self.client.forks(self.repository)
end

#repositoryObject



6
7
8
# File 'lib/teachers_pet/actions/forks.rb', line 6

def repository
  self.options[:repository]
end

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/teachers_pet/actions/forks.rb', line 14

def run
  self.init_client
  forks = self.get_forks

  CSV.open(self.options[:output], 'wb') do |csv|
    forks.each do |fork|
       = fork.owner.
      if fork.owner.type == "User"
        csv << []
      else
        puts "Ignoring organization: @#{}"
      end
    end
  end
end