Class: EdaCodeDownloader

Inherits:
Struct
  • Object
show all
Defined in:
lib/eda-code-downloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#branch_name_includesObject

Returns the value of attribute branch_name_includes



4
5
6
# File 'lib/eda-code-downloader.rb', line 4

def branch_name_includes
  @branch_name_includes
end

#clone_locationObject

Returns the value of attribute clone_location



4
5
6
# File 'lib/eda-code-downloader.rb', line 4

def clone_location
  @clone_location
end

#organizationObject

Returns the value of attribute organization



4
5
6
# File 'lib/eda-code-downloader.rb', line 4

def organization
  @organization
end

Instance Method Details

#clone_reposObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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