class EdaCodeDownloader
Public Instance Methods
clone_repos()
click to toggle source
# File lib/eda-code-downloader.rb, line 5 def clone_repos FileUtils::mkdir_p(clone_location) unless File.directory? clone_location repos.each do |repo| puts repo.name branch_to_clone = repo.rels[:branches].get.data.find { |branch| branch[:name].downcase.include? branch_name_includes } if branch_to_clone puts "Found branch: #{branch_to_clone[:name]}, cloning..." clone_repo(repo, branch_to_clone[:name], clone_location) end end end
Private Instance Methods
clone_repo(repo, branch, clone_location)
click to toggle source
# File lib/eda-code-downloader.rb, line 42 def clone_repo(repo, branch, clone_location) clone_job = fork do exec "cd #{clone_location} && git clone -b #{branch} --single-branch #{clone_url(repo)} &>/dev/null" end Process.detach(clone_job) end
clone_url(repo)
click to toggle source
# File lib/eda-code-downloader.rb, line 38 def clone_url(repo) repo.rels.to_hash[:ssh_url] end
fetch_paginated_repos()
click to toggle source
# File lib/eda-code-downloader.rb, line 26 def fetch_paginated_repos next_repo_request = Octokit.org(organization).rels[:repos].get repos = next_repo_request.data until next_repo_request.rels[:next].nil? next_repo_request = next_repo_request.rels[:next].get repos.concat(next_repo_request.data) end repos end
repos()
click to toggle source
# File lib/eda-code-downloader.rb, line 22 def repos @repos ||= fetch_paginated_repos end