Sha256: 91b4e551efb4c6b41b5f787433ff184bec0996ddc09cdaec19bdcfbf75283cd2
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'json' require 'cgi' # BukGet api # Docs: http://bukget.org/pages/docs/API3.html class Bukin::Bukget DEFAULT_URL = 'http://api.bukget.org' attr_reader :data def initialize(data) @data = data end def resolve_info info = JSON.parse(open(url).read) versions = info['versions'] if versions.empty? raise Bukin::InstallError, "The plugin #{name} (#{version}) has no available downloads from BukGet." end # Some people release two of the same version on bukkit # dev, one as a zip package and one with the jar only. # This downloads the jar only version by default. version_data = versions.find {|version_data| jar_extension?(version_data)} || versions.first data[:version] = version_data['version'] data[:download] = version_data['download'] data end def url "#{data[:bukget]}/3/plugins/#{CGI.escape(server)}/#{CGI.escape(name)}/#{CGI.escape(version)}" end def name data[:name] end def version data[:version] || 'latest' end def server if data[:server].nil? || data[:server] == 'craftbukkit' 'bukkit' else data[:server] end end private def jar_extension?(version_data) File.extname(version_data['filename']) == '.jar' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.6.0 | lib/bukin/providers/bukget.rb |