lapis-minecraft-versioning 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +18 -0
  3. data/.gitignore +151 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +1156 -0
  6. data/.travis.yml +4 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.md +16 -0
  9. data/README.md +83 -0
  10. data/Rakefile +28 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +7 -0
  13. data/lapis-minecraft-versioning.gemspec +35 -0
  14. data/lib/lapis/minecraft/version.rb +89 -0
  15. data/lib/lapis/minecraft/versioning.rb +26 -0
  16. data/lib/lapis/minecraft/versioning/asset.rb +44 -0
  17. data/lib/lapis/minecraft/versioning/asset_index.rb +61 -0
  18. data/lib/lapis/minecraft/versioning/basic.rb +56 -0
  19. data/lib/lapis/minecraft/versioning/detailed.rb +69 -0
  20. data/lib/lapis/minecraft/versioning/launcher_properties.rb +48 -0
  21. data/lib/lapis/minecraft/versioning/library.rb +51 -0
  22. data/lib/lapis/minecraft/versioning/manifest.rb +49 -0
  23. data/lib/lapis/minecraft/versioning/marshalling.rb +15 -0
  24. data/lib/lapis/minecraft/versioning/marshalling/asset_index_parser.rb +41 -0
  25. data/lib/lapis/minecraft/versioning/marshalling/manifest_parser.rb +66 -0
  26. data/lib/lapis/minecraft/versioning/marshalling/version_parser.rb +204 -0
  27. data/lib/lapis/minecraft/versioning/meta_server.rb +52 -0
  28. data/lib/lapis/minecraft/versioning/os_rule.rb +45 -0
  29. data/lib/lapis/minecraft/versioning/resource.rb +44 -0
  30. data/lib/lapis/minecraft/versioning/resource_set.rb +61 -0
  31. data/lib/lapis/minecraft/versioning/rule.rb +32 -0
  32. data/lib/lapis/minecraft/versioning/version.rb +7 -0
  33. data/lib/lapis/minecraft/versioning/version_list.rb +64 -0
  34. data/spec/factories/asset_factory.rb +11 -0
  35. data/spec/factories/asset_index_document_factory.rb +25 -0
  36. data/spec/factories/asset_index_factory.rb +15 -0
  37. data/spec/factories/basic_factory.rb +28 -0
  38. data/spec/factories/detailed_factory.rb +16 -0
  39. data/spec/factories/launcher_properties_factory.rb +11 -0
  40. data/spec/factories/library_factory.rb +21 -0
  41. data/spec/factories/manifest_document_factory.rb +48 -0
  42. data/spec/factories/manifest_factory.rb +12 -0
  43. data/spec/factories/meta_server_mock_factory.rb +33 -0
  44. data/spec/factories/os_rule_factory.rb +30 -0
  45. data/spec/factories/resource_factory.rb +32 -0
  46. data/spec/factories/resource_set_factory.rb +16 -0
  47. data/spec/factories/rule_factory.rb +17 -0
  48. data/spec/factories/version_document_factory.rb +176 -0
  49. data/spec/factories/version_factory.rb +18 -0
  50. data/spec/lapis/minecraft/version_spec.rb +181 -0
  51. data/spec/lapis/minecraft/versioning/asset_index_spec.rb +89 -0
  52. data/spec/lapis/minecraft/versioning/asset_spec.rb +65 -0
  53. data/spec/lapis/minecraft/versioning/basic_spec.rb +75 -0
  54. data/spec/lapis/minecraft/versioning/detailed_spec.rb +175 -0
  55. data/spec/lapis/minecraft/versioning/launcher_properties_spec.rb +73 -0
  56. data/spec/lapis/minecraft/versioning/library_spec.rb +91 -0
  57. data/spec/lapis/minecraft/versioning/manifest_spec.rb +71 -0
  58. data/spec/lapis/minecraft/versioning/marshalling/asset_index_parser_spec.rb +27 -0
  59. data/spec/lapis/minecraft/versioning/marshalling/manifest_parser_spec.rb +74 -0
  60. data/spec/lapis/minecraft/versioning/marshalling/version_parser_spec.rb +101 -0
  61. data/spec/lapis/minecraft/versioning/meta_server_spec.rb +59 -0
  62. data/spec/lapis/minecraft/versioning/os_rule_spec.rb +73 -0
  63. data/spec/lapis/minecraft/versioning/resource_set_spec.rb +87 -0
  64. data/spec/lapis/minecraft/versioning/resource_spec.rb +55 -0
  65. data/spec/lapis/minecraft/versioning/rule_spec.rb +36 -0
  66. data/spec/lapis/minecraft/versioning/version_list_spec.rb +66 -0
  67. data/spec/spec_helper.rb +90 -0
  68. data/spec/time_helper.rb +39 -0
  69. metadata +289 -0
@@ -0,0 +1,69 @@
1
+ require_relative 'basic'
2
+
3
+ module Lapis
4
+ module Minecraft
5
+ module Versioning
6
+
7
+ # Additional information about a Minecraft version.
8
+ class Detailed < Basic
9
+
10
+ # Overview of assets included in this version.
11
+ # @return [AssetIndex]
12
+ attr_reader :asset_index
13
+
14
+ # List of downloads available for this version.
15
+ # @return [Array<Resource>]
16
+ attr_reader :downloads
17
+
18
+ # List of libraries needed to run this version.
19
+ # @return [Array<Library>]
20
+ attr_reader :libraries
21
+
22
+ # Information about how to start the client in a launcher.
23
+ # @return [LauncherProperties]
24
+ attr_reader :launcher_properties
25
+
26
+ # Retrieves the client jar information for this version.
27
+ # @return [Resource, nil] Download information for the client, or +nil+ if there is no client for this version.
28
+ attr_reader :client_download
29
+
30
+ # Retrieves the server jar information for this version.
31
+ # @return [Resource, nil] Download information for the server, or +nil+ if there is no server for this version.
32
+ attr_reader :server_download
33
+
34
+ # Creates version information.
35
+ # @param basic_info [Basic] Minimal information to extend from.
36
+ # @param asset_index [AssetIndex] Overview of assets needed for the version.
37
+ # @param downloads [Array<Resource>] List of downloads available for this version.
38
+ # @param libraries [Array<Library>] List of libraries needed to run this version.
39
+ # @param launcher_properties [LauncherProperties] Information about how to start the client in a launcher.
40
+ def initialize(basic_info, asset_index, downloads, libraries, launcher_properties)
41
+ super(basic_info.id, basic_info.type, basic_info.time, basic_info.url)
42
+ @asset_index = asset_index
43
+ @downloads = downloads.dup.freeze
44
+ @libraries = libraries.dup.freeze
45
+ @launcher_properties = launcher_properties
46
+
47
+ @client_download = downloads.find { |download| download.classifier == 'client' }
48
+ @server_download = downloads.find { |download| download.classifier == 'server' }
49
+ end
50
+
51
+ # Compares one version to another.
52
+ # @param other [Detailed] Version to compare against.
53
+ # @return [true] The versions are the same.
54
+ # @return [false] The versions are different.
55
+ def ==(other)
56
+ super(other) &&
57
+ other.asset_index == @asset_index &&
58
+ other.downloads == @downloads &&
59
+ other.libraries == @libraries &&
60
+ other.launcher_properties == @launcher_properties &&
61
+ other.client_download == @client_download &&
62
+ other.server_download == @server_download
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,48 @@
1
+ module Lapis
2
+ module Minecraft
3
+ module Versioning
4
+
5
+ # Information about how the client should be started.
6
+ class LauncherProperties
7
+
8
+ # Main Java class that is the entry point for the client.
9
+ # @return [String]
10
+ attr_reader :main_class
11
+
12
+ # List of arguments to pass to the client jar.
13
+ # @return [Array<String>]
14
+ # @note Some arguments may be parametrized with +${var_name}+.
15
+ attr_reader :arguments
16
+
17
+ # Minimum launcher version required to run the client.
18
+ # @return [Fixnum]
19
+ # @note This can be ignored if a custom launcher is used.
20
+ attr_reader :minimum_version
21
+
22
+ # Creates properties for launching the client.
23
+ # @param main_class [String] Main Java class that is the entry point for the client.
24
+ # @param arguments [Array<String>] List of arguments to pass to the client jar.
25
+ # These can be parametrized by using +${var_name}+.
26
+ # @param minimum_version [Fixnum] Minimum launcher version required to run the client.
27
+ # This can be ignored if a custom launcher is used.
28
+ def initialize(main_class, arguments, minimum_version)
29
+ @main_class = main_class.dup.freeze
30
+ @arguments = arguments.map(&:freeze).freeze
31
+ @minimum_version = minimum_version
32
+ end
33
+
34
+ # Compares one set of properties to another.
35
+ # @param other [LauncherProperties] Properties to compare against.
36
+ # @return [true] The properties are the same.
37
+ # @return [false] The properties are different.
38
+ def ==(other)
39
+ other.main_class == @main_class &&
40
+ other.arguments == @arguments &&
41
+ other.minimum_version == @minimum_version
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,51 @@
1
+ module Lapis
2
+ module Minecraft
3
+ module Versioning
4
+
5
+ # Dependency needed to run Minecraft.
6
+ class Library
7
+
8
+ # Name of the dependency.
9
+ # @return [String]
10
+ attr_reader :name
11
+
12
+ # Set of resources included in the library.
13
+ # @return [ResourceSet]
14
+ attr_reader :resources
15
+
16
+ # Filter for which files should be installed.
17
+ # @return [Array<Rule>]
18
+ attr_reader :rules
19
+
20
+ # Paths to ignore when extracting resources.
21
+ # @return [Array<String>]
22
+ attr_reader :exclude_paths
23
+
24
+ # Creates information about a dependency.
25
+ # @param name [String] Name of the dependency.
26
+ # @param resources [ResourceSet] Set of resources included in the library.
27
+ # @param rules [Array<Rule>] Filter for which files should be installed.
28
+ # @param exclude_paths [Array<String>] Paths to ignore when extracting resources.
29
+ def initialize(name, resources, rules = [], exclude_paths = [])
30
+ @name = name.dup.freeze
31
+ @resources = resources
32
+ @rules = rules.dup.freeze
33
+ @exclude_paths = exclude_paths.map(&:freeze).freeze
34
+ end
35
+
36
+ # Compares one library to another.
37
+ # @param other [Library] Library to compare against.
38
+ # @return [true] The libraries are the same.
39
+ # @return [false] The libraries are different.
40
+ def ==(other)
41
+ other.name == @name &&
42
+ other.resources == @resources &&
43
+ other.rules == @rules &&
44
+ other.exclude_paths == @exclude_paths
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,49 @@
1
+ module Lapis
2
+ module Minecraft
3
+ module Versioning
4
+
5
+ # Contains basic information about all known versions of Minecraft.
6
+ class Manifest
7
+ include Enumerable
8
+
9
+ # Retrieves information about the latest release.
10
+ # @return [Basic]
11
+ attr_reader :latest_release
12
+
13
+ # Retrieves information about the latest snapshot.
14
+ # @return [Basic]
15
+ attr_reader :latest_snapshot
16
+
17
+ # Creates a new manifest with version instances.
18
+ # @param versions [Array<Basic>] List of all versions.
19
+ # @param latest_release_id [String] ID of the version for the latest release.
20
+ # @param latest_snapshot_id [String] ID of the version for the latest snapshot.
21
+ def initialize(versions, latest_release_id, latest_snapshot_id)
22
+ @versions = versions.dup.freeze
23
+ @latest_release = versions.find { |version| version.id == latest_release_id }
24
+ @latest_snapshot = versions.find { |version| version.id == latest_snapshot_id }
25
+ end
26
+
27
+ def each
28
+ return enum_for(:each) unless block_given?
29
+
30
+ @versions.each do |version|
31
+ yield version
32
+ end
33
+ end
34
+
35
+ # Compares one manifest to another.
36
+ # @param other [Manifest] Manifest to compare against.
37
+ # @return [true] The manifests are the same.
38
+ # @return [false] The manifests are different.
39
+ def ==(other)
40
+ other.entries == @versions &&
41
+ other.latest_release == @latest_release &&
42
+ other.latest_snapshot == @latest_snapshot
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ module Lapis
2
+ module Minecraft
3
+ module Versioning
4
+
5
+ # Logic for handling marshaled forms of version information.
6
+ module Marshalling
7
+ end
8
+
9
+ end
10
+ end
11
+ end
12
+
13
+ require_relative 'marshalling/asset_index_parser'
14
+ require_relative 'marshalling/version_parser'
15
+ require_relative 'marshalling/manifest_parser'
@@ -0,0 +1,41 @@
1
+ require 'json'
2
+
3
+ module Lapis
4
+ module Minecraft
5
+ module Versioning
6
+ module Marshalling
7
+
8
+ # Reads an asset index document and generates an {AssetIndex} instance.
9
+ # @see AssetIndex
10
+ # @todo JSON and structural errors are not detected and handled elegantly.
11
+ class AssetIndexParser
12
+
13
+ # Extract asset information from an asset index document.
14
+ # @param document [String] Contents of the asset index document.
15
+ # @return [Array<Asset>]
16
+ def parse(document)
17
+ structure = JSON.parse(document)
18
+ structure['objects'].map do |path, attributes|
19
+ unmarshal_asset(path, attributes)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ # Create an instance from the marshaled form of an {Asset}.
26
+ # @param path [String] Path to the stored asset.
27
+ # @param attributes [Hash{String => String, Fixnum}] Other attributes of the asset.
28
+ # This should include +hash+ or +sha1+, which is the SHA-1 hash,
29
+ # and +size+, which is the size in bytes.
30
+ # @return [Asset]
31
+ def unmarshal_asset(path, attributes)
32
+ size = attributes['size']
33
+ sha1 = attributes['sha1'] || attributes['hash']
34
+ Asset.new(size, sha1, path)
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,66 @@
1
+ require_relative '../manifest'
2
+ require_relative '../basic'
3
+
4
+ module Lapis
5
+ module Minecraft
6
+ module Versioning
7
+ module Marshalling
8
+
9
+ # Reads a manifest document and retrieves basic version information from it.
10
+ # @see Manifest
11
+ # @todo JSON and structural errors are not detected and handled elegantly.
12
+ class ManifestParser
13
+
14
+ # Retrieves information about versions from a manifest document.
15
+ # @param document [String] Contents of the version manifest document.
16
+ # @return [Manifest]
17
+ def parse(document)
18
+ structure = JSON.parse(document)
19
+ versions = unmarshal_versions(structure['versions'])
20
+ latest_release_id, latest_snapshot_id = unmarshal_latest(structure['latest'])
21
+ Manifest.new(versions, latest_release_id, latest_snapshot_id)
22
+ end
23
+
24
+ private
25
+
26
+ # Extract versions from a marshaled list format.
27
+ # @param versions [Array<Hash>] List of version information.
28
+ # @return [Array<Version>]
29
+ def unmarshal_versions(versions)
30
+ versions.map do |attributes|
31
+ unmarshal_version(attributes)
32
+ end
33
+ end
34
+
35
+ # Extract basic version information from a marshaled format.
36
+ # @param attributes [Hash<String => String>] Information about the version.
37
+ # @return [Basic]
38
+ def unmarshal_version(attributes)
39
+ id = attributes['id']
40
+ time = Time.parse(attributes['releaseTime'])
41
+ url = attributes['url']
42
+ type_str = attributes['type']
43
+ type = case type_str
44
+ when /alpha/
45
+ :alpha
46
+ when /beta/
47
+ :beta
48
+ else
49
+ type_str.to_sym
50
+ end
51
+ Basic.new(id, type, time, url)
52
+ end
53
+
54
+ # Extract IDs of the latest release and snapshot from a marshaled format.
55
+ # @param attributes [Hash<String => String>] Information about the latest versions.
56
+ # @return [Array<String>] Two-item array containing the ID of the latest release and snapshot (in that order).
57
+ def unmarshal_latest(attributes)
58
+ return attributes['release'], attributes['snapshot']
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,204 @@
1
+ require 'json'
2
+ require_relative '../detailed'
3
+ require_relative '../basic'
4
+ require_relative '../asset_index'
5
+ require_relative '../resource'
6
+ require_relative '../resource_set'
7
+ require_relative '../rule'
8
+ require_relative '../os_rule'
9
+ require_relative '../library'
10
+ require_relative '../launcher_properties'
11
+
12
+ module Lapis
13
+ module Minecraft
14
+ module Versioning
15
+ module Marshalling
16
+
17
+ # Reads a version document and generates a {Detailed} instance.
18
+ # @see Detailed
19
+ # @todo JSON and structural errors are not detected and handled elegantly.
20
+ class VersionParser
21
+
22
+ # Retrieves detailed information from a version document.
23
+ # @param document [String] Contents of the version document.
24
+ # @param url [String] Location of the version document.
25
+ # @return [Detailed]
26
+ def parse(document, url)
27
+ structure = JSON.parse(document)
28
+ basic = unmarshal_basic_info(structure, url)
29
+ asset_index = unmarshal_asset_index(structure['assetIndex'])
30
+ downloads = unmarshal_downloads(structure['downloads'])
31
+ libraries = unmarshal_libraries(structure['libraries'])
32
+ launcher_properties = unmarshal_launcher_properties(structure)
33
+ Detailed.new(basic, asset_index, downloads, libraries, launcher_properties)
34
+ end
35
+
36
+ private
37
+
38
+ # Extract basic version info from the marshaled form of a {Detailed} version.
39
+ # @param attributes [Hash] Version information.
40
+ # @option attributes [String] :id Unique name of the version.
41
+ # @option attributes [String] :type Type of version - alpha, beta, snapshot, or release.
42
+ # @option attributes [String] :releaseTime Date and time the version was released.
43
+ # @param url [String] Location of the version document.
44
+ def unmarshal_basic_info(attributes, url)
45
+ id = attributes['id']
46
+ time = Time.parse(attributes['releaseTime'])
47
+ type = case attributes['type']
48
+ when 'old_alpha'
49
+ :alpha
50
+ when 'old_beta'
51
+ :beta
52
+ else
53
+ attributes['type'].to_sym
54
+ end
55
+ Basic.new(id, type, time, url)
56
+ end
57
+
58
+ # Create an instance from the marshaled form of an {AssetIndex}.
59
+ # @param attributes [Hash{String => String, Fixnum}] Information about the asset index.
60
+ # @option attributes [String] :id Name of the asset index.
61
+ # @option attributes [String] :sha1 SHA-1 hash of the asset index document in hexadecimal.
62
+ # @option attributes [Fixnum] :size Size of the asset index document in bytes.
63
+ # @option attributes [String] :url Location of the asset index document.
64
+ # @option attributes [Fixnum] :totalSize Size, in bytes, of all assets in the index.
65
+ # @return [AssetIndex]
66
+ def unmarshal_asset_index(attributes)
67
+ id = attributes['id']
68
+ sha1 = attributes['sha1']
69
+ size = attributes['size']
70
+ url = attributes['url']
71
+ total_size = attributes['totalSize']
72
+ AssetIndex.new(id, sha1, size, url, total_size)
73
+ end
74
+
75
+ # Extract a set of downloads from a marshaled list.
76
+ # @param downloads [Hash<String => Hash>] List of marshaled download information.
77
+ # @return [Array<Resource>]
78
+ def unmarshal_downloads(downloads)
79
+ downloads.map { |label, attributes| unmarshal_download(label, attributes) }
80
+ end
81
+
82
+ # Extract information about a resource.
83
+ # @param label [String] Classifier given in the document.
84
+ # @param attributes [Hash<String => String, Fixnum>] Information about the resource.
85
+ # @option attributes [String] :sha1 SHA-1 hash of the download in hexadecimal.
86
+ # @option attributes [Fixnum] :size Size of the download in bytes.
87
+ # @option attributes [String] :url Location of the download.
88
+ # @option attributes [String] :path Location to place the download in.
89
+ # @return [Resource]
90
+ def unmarshal_download(label, attributes)
91
+ sha1 = attributes['sha1']
92
+ size = attributes['size']
93
+ url = attributes['url']
94
+ path = attributes['path']
95
+ Resource.new(url, size, sha1, path, label)
96
+ end
97
+
98
+ # Extract a set of libraries from a marshaled list.
99
+ # @param libraries [Array<Hash>] List of marshaled library information.
100
+ # @return [Array<Library>]
101
+ def unmarshal_libraries(libraries)
102
+ libraries.map { |attributes| unmarshal_library(attributes) }
103
+ end
104
+
105
+ # Extract a library from a marshaled format.
106
+ # @param attributes [Hash] Information about the library.
107
+ # @option attributes [String] :name Formal name of the library.
108
+ # @option attributes [Hash<String => Hash>] :downloads Set of downloads included in the library.
109
+ # @option attributes [Hash<String => String>] :natives Classifiers for native downloads.
110
+ # @option attributes [Array<Hash>] :rules Library application rules.
111
+ # @option attributes [Hash<String => Array>] :extract Extraction rules.
112
+ # @return [Library]
113
+ def unmarshal_library(attributes)
114
+ name = attributes['name']
115
+ downloads = unmarshal_library_downloads(attributes['downloads'])
116
+ natives = unmarshal_library_natives(attributes['natives'])
117
+ resources = ResourceSet.new(downloads, natives[0], natives[1], natives[2])
118
+ rules = unmarshal_library_rules(attributes['rules'])
119
+ paths = unmarshal_library_paths(attributes['extract'])
120
+ Library.new(name, resources, rules, paths)
121
+ end
122
+
123
+ # Extract a set of downloads included in a library.
124
+ # @param downloads [Array<Hash>] List of marshaled download information.
125
+ # @return [Array<Resource>]
126
+ def unmarshal_library_downloads(downloads)
127
+ resources = []
128
+ if downloads.key?('artifact')
129
+ resources << unmarshal_download('artifact', downloads['artifact'])
130
+ end
131
+ if downloads.key?('classifiers')
132
+ downloads['classifiers'].each do |classifier, attributes|
133
+ resources << unmarshal_download(classifier, attributes)
134
+ end
135
+ end
136
+ resources
137
+ end
138
+
139
+ # Extract the classifiers for natives.
140
+ # @param natives [Hash<String => String>] Classifier information.
141
+ # @return [Array<String>] Array of three items: Windows classifier, Linux classifier, and OSX classifier.
142
+ def unmarshal_library_natives(natives)
143
+ if natives
144
+ [natives['windows'], natives['linux'], natives['osx']]
145
+ else
146
+ [nil, nil, nil]
147
+ end
148
+ end
149
+
150
+ # Extract library exclude paths from a marshaled format.
151
+ # @param attributes [Hash<String => Array>] Path information.
152
+ # @return [Array<String>]
153
+ def unmarshal_library_paths(attributes)
154
+ if attributes && attributes.key?('exclude')
155
+ attributes['exclude']
156
+ else
157
+ []
158
+ end
159
+ end
160
+
161
+ # Extract library application rules from a marshaled format.
162
+ # @param rules [Array<Hash>] List of marshaled rule information.
163
+ # @return [Array<Rule>]
164
+ def unmarshal_library_rules(rules)
165
+ if rules
166
+ rules.map { |attributes| unmarshal_library_rule(attributes) }
167
+ else
168
+ []
169
+ end
170
+ end
171
+
172
+ # Extract library rule from a marshaled format.
173
+ # @param attributes [Hash] Rule requirements.
174
+ # @return [Rule]
175
+ def unmarshal_library_rule(attributes)
176
+ action = attributes['action'] == 'allow'
177
+ if attributes.key?('os')
178
+ os_type = attributes['os']['name'].to_sym
179
+ os_version = attributes['os']['version']
180
+ OSRule.new(action, os_type, os_version)
181
+ else
182
+ Rule.new(action)
183
+ end
184
+ end
185
+
186
+ # Extract launcher properties from a marshaled format.
187
+ # @param attributes [Hash] Version information (launcher properties are embedded).
188
+ # @option attributes [String] :mainClass Name of the main class in the client.
189
+ # @option attributes [String] :arguments Command-line arguments to pass into the client.
190
+ # @option attributes [Fixnum] :minimumVersion Minimum version of the Minecraft launcher needed to run the client.
191
+ # @return [LauncherProperties]
192
+ def unmarshal_launcher_properties(attributes)
193
+ main_class = attributes['mainClass']
194
+ arguments = attributes['minecraftArguments'].split(/\s+/)
195
+ minimum_version = attributes['minimumLauncherVersion']
196
+ LauncherProperties.new(main_class, arguments, minimum_version)
197
+ end
198
+
199
+ end
200
+
201
+ end
202
+ end
203
+ end
204
+ end