lapis-minecraft-versioning

Small library for getting version information from Mojang about Minecraft. Includes a command-line utility as well.


Keywords
api, minecraft
License
MIT
Install
gem install lapis-minecraft-versioning -v 0.6.3

Documentation

Minecraft Version Info

Travis CI Code Climate Test Coverage Issue Count Documentation

Retrieves and processes information about versions of Minecraft. Small library for getting version information from Mojang about Minecraft. Includes a command-line utility as well.

Installation

Add this line to your application's Gemfile:

gem 'lapis-minecraft-versioning'

Or to your gemspec:

spec.add_dependency 'lapis-minecraft-versioning'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lapis-minecraft-versioning

Usage

Script usage

Include the gem by adding this to your scripts:

require 'lapis/minecraft/versioning'

Accessing Minecraft version data

Retrieve the official Minecraft version list:

list = Lapis::Minecraft::Versioning::VersionList.official

Display a list of all versions:

list.each do |version|
  puts version.id
end

Get the client URL for the latest release:

list.latest_release.client_download.url

Command-line usage

This gem comes with a script named minecraft-versions. It can display most information about versions - some information is too complex to display. The following commands are available:

minecraft-versions list [TYPE]
minecraft-versions info <ID>
minecraft-versions client <ID>
minecraft-versions server <ID>
minecraft-versions assets <ID>
minecraft-versions libraries <ID>
minecraft-versions latest-id [TYPE]
minecraft-versions latest [TYPE]

list [TYPE]

Lists the identifiers of all known Minecraft versions. These are the IDs used for other commands. TYPE can be provided to filter which versions are listed. TYPE can be one of: alpha, beta, snapshot, release, or all. The default is all.

info <ID>

Displays top-level information about the specified Minecraft version. ID is the identifier of the version to display information for.

client <ID>

Outputs just the client download URL for a specific Minecraft version. ID is the identifier of the version to get the client for.

server <ID>

Outputs just the server download URL for a specific Minecraft version. ID is the identifier of the version to get the server for.

assets <ID>

Displays a list of all the assets used by the client. ID is the identifier of the version to get an asset list for. ID is not the asset index name.

libraries <ID>

Displays a list of all the libraries needed for a specific version of Minecraft. ID is the identifier of the version to get the libraries for.

latest-id [TYPE]

Outputs just the ID of the latest Minecraft version. TYPE can be specified to filter which versions are considered. TYPE can be one of: alpha, beta, snapshot, release, or any. When set to any, the latest version, regardless of type is displayed. The default is release.

latest [TYPE]

Displays top-level information for the latest Minecraft version. TYPE can be specified to filter which versions are considered. TYPE can be one of: alpha, beta, snapshot, release, or any. When set to any, the latest version, regardless of type is displayed. The default is release.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rake test to run the tests. It's recommended that you run bundle exec rake inspect to run inspections. You can also run bin/console for an interactive prompt that will allow you to experiment. bundle exec rake doc will generate documentation.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in versioning/version.rb, and then run bundle exec rake release. This will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub.