21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/package_cloud/client.rb', line 21
def repository(name)
user, repo = name.split("/")
url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos/#{user}/#{repo}.json")
begin
attrs = JSON.parse(RestClient.get(url))
if attrs["error"] == "not_found"
print "failed... Repository #{user}/#{repo} not found!\n".color(:red)
exit(127)
end
Repository.new(attrs, @config)
rescue RestClient::ResourceNotFound => e
print "failed!\n".color(:red)
exit(127)
end
end
|