class Rocketwheel::Command::Player
Constants
- HOST
Attributes
json[R]
Public Class Methods
all()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 43 def all versions.map { |p| self.new(p) } end
json()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 39 def json @json ||= JSON.parse(open(File.join(HOST, 'versions.json')).read) end
latest()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 51 def latest version(latest_version) end
latest_version()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 47 def latest_version json['latest'] end
new(json)
click to toggle source
# File lib/rocketwheel/command/player.rb, line 15 def initialize(json) @json = json end
version(version)
click to toggle source
# File lib/rocketwheel/command/player.rb, line 55 def version(version) all.find { |player| player.version.to_s == version.to_s } || raise(PlayerNotFound, "Version #{version} of the player was not found.") end
versions()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 59 def versions json['versions'] end
Public Instance Methods
download_and_unzip(destination)
click to toggle source
# File lib/rocketwheel/command/player.rb, line 27 def download_and_unzip(destination) file = open(download_url) Zip::ZipFile::open(file) do |zf| zf.each do |e| path = File.join(destination, e.to_s) FileUtils.mkdir_p(File.dirname(path)) zf.extract(e, path) { true } end end end
download_url()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 23 def download_url json['download'] end
version()
click to toggle source
# File lib/rocketwheel/command/player.rb, line 19 def version json['version'] end