lib/bukin/providers/bukkit_dl.rb in bukin-0.2.0 vs lib/bukin/providers/bukkit_dl.rb in bukin-0.3.0
- old
+ new
@@ -12,19 +12,23 @@
def api_url
"#{url}/api/1.0/downloads"
end
- def download_url
- url
- end
+ def resolve_info(data)
+ if data[:download]
+ data[:display_version] = data[:version]
+ return data
+ end
- def download(name, version)
- url = download_url + info(name, version)['file']['url']
- download_file(url)
- end
+ name = data[:name]
+ version = data[:version] || 'latest-rb'
- def info(name, version)
url = "#{api_url}/projects/#{name}/view/#{version}/"
- JSON.parse(open(url).read)
+ info = JSON.parse(open(url).read)
+
+ data[:version] = "build-#{info['build_number']}"
+ data[:display_version] = info['version']
+ data[:download] = @url + info['file']['url']
+ data
end
end