7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/gpr/api_helper.rb', line 7
def get_repository_urls(host, user)
case host
when 'github.com'
uri = URI.parse("https://api.github.com/users/#{user}/repos?per_page=100")
JSON.parse(request_https_get(uri).body).map do |repository|
repository['clone_url']
end
when 'bitbucket.org'
uri = URI.parse("https://api.bitbucket.org/1.0/users/#{user}")
JSON.parse(request_https_get(uri).body)['repositories'].map do |repository|
"https://#{repository['owner']}@bitbucket.org/#{repository['owner']}/#{repository['name']}.git"
end
else
puts "#{host} is not supported"
exit 0
end
end
|