lapis-minecraft-versioning 0.6.0 → 0.6.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lapis-minecraft-versioning.gemspec +1 -1
- data/lib/lapis/minecraft/versioning/library.rb +23 -0
- data/lib/lapis/minecraft/versioning/os_rule.rb +12 -0
- data/lib/lapis/minecraft/versioning/resource_set.rb +32 -0
- data/lib/lapis/minecraft/versioning/rule.rb +9 -0
- data/lib/lapis/minecraft/versioning/version.rb +1 -1
- data/spec/lapis/minecraft/version_spec.rb +3 -3
- data/spec/lapis/minecraft/versioning/detailed_spec.rb +2 -2
- data/spec/lapis/minecraft/versioning/library_spec.rb +56 -2
- data/spec/lapis/minecraft/versioning/manifest_spec.rb +1 -1
- data/spec/lapis/minecraft/versioning/marshalling/manifest_parser_spec.rb +1 -1
- data/spec/lapis/minecraft/versioning/marshalling/version_parser_spec.rb +2 -2
- data/spec/lapis/minecraft/versioning/os_rule_spec.rb +60 -0
- data/spec/lapis/minecraft/versioning/resource_set_spec.rb +155 -1
- data/spec/lapis/minecraft/versioning/rule_spec.rb +10 -0
- data/spec/spec_helper.rb +8 -6
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe1219f00dea98ce8e396a939ccf023f4f6d412
|
4
|
+
data.tar.gz: 4cf496cc2d864e771e584ed1edafca65c08928f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e40c8f79903f2d489f26874245774d5d76ef3d3bee27650a69824fa0e09f6cd4f60017af87198cf022e0b5024cbf20c9f8bbebe668313707121087dd735b67c
|
7
|
+
data.tar.gz: fa3aa2d4359dc5a5de4d1456edba4aaa3451faa698daef581573a4ace4bedcfc630995e922078b258dd9c556ad926f2e647feb2dc001409b4c547401d3a08242
|
data/.travis.yml
CHANGED
@@ -31,6 +31,6 @@ Includes a command-line utility as well.}
|
|
31
31
|
spec.add_development_dependency 'webmock', '~> 2.0'
|
32
32
|
spec.add_development_dependency 'reek', '~> 3.0'
|
33
33
|
spec.add_development_dependency 'rubocop', '~> 0.38.0'
|
34
|
-
spec.add_development_dependency 'codeclimate-test-reporter'
|
34
|
+
spec.add_development_dependency 'codeclimate-test-reporter' unless RUBY_PLATFORM == 'java'
|
35
35
|
spec.add_development_dependency 'yard'
|
36
36
|
end
|
@@ -33,6 +33,29 @@ module Lapis
|
|
33
33
|
@exclude_paths = exclude_paths.map(&:freeze).freeze
|
34
34
|
end
|
35
35
|
|
36
|
+
# Checks whether the library applies to a set of properties.
|
37
|
+
# @param properties [Hash<Symbol => String>] Properties to check the library rules against.
|
38
|
+
# @option properties [String] :os_type One of: windows, linux, or osx.
|
39
|
+
# @option properties [String] :os_version Version of the OS.
|
40
|
+
# @return [true] The library should be included with a client installation.
|
41
|
+
# @return [false] The library should not be included.
|
42
|
+
def applies_to?(properties)
|
43
|
+
if @rules.empty?
|
44
|
+
true
|
45
|
+
else
|
46
|
+
applicable = @rules.select do |rule|
|
47
|
+
rule.applies_to?(properties)
|
48
|
+
end
|
49
|
+
if applicable.empty?
|
50
|
+
false
|
51
|
+
else
|
52
|
+
applicable.all? do |rule|
|
53
|
+
rule.allowed?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
36
59
|
# Compares one library to another.
|
37
60
|
# @param other [Library] Library to compare against.
|
38
61
|
# @return [true] The libraries are the same.
|
@@ -28,6 +28,18 @@ module Lapis
|
|
28
28
|
@os_version = os_version ? Regexp.new(os_version) : // # Use empty regex if no version specified.
|
29
29
|
end
|
30
30
|
|
31
|
+
# Checks whether the rule applies to a set of properties.
|
32
|
+
# @param properties [Hash<Symbol => String>] Properties to check the rule against.
|
33
|
+
# @option properties [String] :os_type One of: windows, linux, or osx.
|
34
|
+
# @option properties [String] :os_version Version of the OS.
|
35
|
+
# @return [true] The rule should be considered when using the resource.
|
36
|
+
# @return [false] The rule should not be considered.
|
37
|
+
def applies_to?(properties)
|
38
|
+
super(properties) &&
|
39
|
+
properties[:os_type].downcase == @os_type.to_s &&
|
40
|
+
@os_version.match(properties[:os_version])
|
41
|
+
end
|
42
|
+
|
31
43
|
# Compares one rule to another.
|
32
44
|
# @param other [OSRule] Rule to compare against.
|
33
45
|
# @return [true] The rules are the same.
|
@@ -43,6 +43,38 @@ module Lapis
|
|
43
43
|
@resources = resources.dup.freeze
|
44
44
|
end
|
45
45
|
|
46
|
+
# Filters the resources in the set based on properties.
|
47
|
+
# @param properties [Hash<Symbol => String>] Properties to check the resources against.
|
48
|
+
# @option properties [String] :os_type One of: windows, linux, or osx.
|
49
|
+
# @option properties [String] :arch CPU architecture - 32 or 64.
|
50
|
+
# @return [Array<Resource>] List of resources applicable to the properties given.
|
51
|
+
def filter_resources(properties)
|
52
|
+
result = []
|
53
|
+
generic = @resources.find do |resource|
|
54
|
+
resource.classifier == 'artifact'
|
55
|
+
end
|
56
|
+
result << generic if generic
|
57
|
+
classifier = case(properties[:os_type])
|
58
|
+
when 'windows'
|
59
|
+
@windows_classifier
|
60
|
+
when 'linux'
|
61
|
+
@linux_classifier
|
62
|
+
when 'osx'
|
63
|
+
@osx_classifier
|
64
|
+
end
|
65
|
+
if classifier
|
66
|
+
native_classifier = classifier.gsub(/\$\{([^}]*)\}/) do |match|
|
67
|
+
property = match[2...-1].downcase.to_sym
|
68
|
+
properties[property]
|
69
|
+
end
|
70
|
+
native = @resources.find do |resource|
|
71
|
+
resource.classifier == native_classifier
|
72
|
+
end
|
73
|
+
result << native if native
|
74
|
+
end
|
75
|
+
result
|
76
|
+
end
|
77
|
+
|
46
78
|
# Compares one resource set to another.
|
47
79
|
# @param other [ResourceSet] Resource set to compare against.
|
48
80
|
# @return [true] The resource sets are the same.
|
@@ -17,6 +17,15 @@ module Lapis
|
|
17
17
|
@is_allowed = !!is_allowed
|
18
18
|
end
|
19
19
|
|
20
|
+
# Checks whether the rule applies to a set of properties.
|
21
|
+
# @param _properties [Hash<Symbol => String>] Properties to check the rule against.
|
22
|
+
# @return [true] The rule should be considered when using the resource.
|
23
|
+
# @return [false] The rule should not be considered.
|
24
|
+
# @note Base rules always apply.
|
25
|
+
def applies_to?(_properties)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
20
29
|
# Compares one rule to another.
|
21
30
|
# @param other [Rule] Rule to compare against.
|
22
31
|
# @return [true] The rules are the same.
|
@@ -66,7 +66,7 @@ RSpec.describe Lapis::Minecraft::Version do
|
|
66
66
|
subject { version.assets }
|
67
67
|
|
68
68
|
it 'retrieves the expected items' do
|
69
|
-
is_expected.to
|
69
|
+
is_expected.to match_array(assets)
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'is frozen' do
|
@@ -80,7 +80,7 @@ RSpec.describe Lapis::Minecraft::Version do
|
|
80
80
|
subject { version.downloads }
|
81
81
|
|
82
82
|
it 'retrieves the expected items' do
|
83
|
-
is_expected.to
|
83
|
+
is_expected.to match_array(downloads)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'is frozen' do
|
@@ -138,7 +138,7 @@ RSpec.describe Lapis::Minecraft::Version do
|
|
138
138
|
subject { version.libraries }
|
139
139
|
|
140
140
|
it 'retrieves the expected items' do
|
141
|
-
is_expected.to
|
141
|
+
is_expected.to match_array(libraries)
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'is frozen' do
|
@@ -70,7 +70,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Detailed do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'has the same elements' do
|
73
|
-
is_expected.to
|
73
|
+
is_expected.to match_array(downloads)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'is frozen' do
|
@@ -132,7 +132,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Detailed do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'has the same elements' do
|
135
|
-
is_expected.to
|
135
|
+
is_expected.to match_array(libraries)
|
136
136
|
end
|
137
137
|
|
138
138
|
it 'is frozen' do
|
@@ -36,7 +36,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Library do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'has the same elements' do
|
39
|
-
is_expected.to
|
39
|
+
is_expected.to match_array(rules)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'is frozen' do
|
@@ -54,7 +54,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Library do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'has the same elements' do
|
57
|
-
is_expected.to
|
57
|
+
is_expected.to match_array(paths)
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'is frozen' do
|
@@ -66,6 +66,60 @@ RSpec.describe Lapis::Minecraft::Versioning::Library do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
describe '#applies_to?' do
|
70
|
+
let(:library) { build(:library, :rules => rules) }
|
71
|
+
let(:properties) { {:os_type => 'osx', :os_version => '10.5'} }
|
72
|
+
subject { library.applies_to?(properties) }
|
73
|
+
|
74
|
+
context 'with no rules' do
|
75
|
+
let(:rules) { [] }
|
76
|
+
|
77
|
+
it 'returns true' do
|
78
|
+
is_expected.to be_truthy
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'with all applicable rules' do
|
83
|
+
let(:rules) { build_list(:rule, 5) }
|
84
|
+
|
85
|
+
it 'returns true' do
|
86
|
+
is_expected.to be_truthy
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'with no applicable rules' do
|
91
|
+
let(:rules) { [build(:os_rule, :windows, :no_version), build(:os_rule, :linux, :no_version)] }
|
92
|
+
|
93
|
+
it 'returns false' do
|
94
|
+
is_expected.to be_falsey
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'with not applicable deny rule' do
|
99
|
+
let(:rules) { [build(:rule), build(:os_rule, :windows, :no_version, :disallow)] }
|
100
|
+
|
101
|
+
it 'returns true' do
|
102
|
+
is_expected.to be_truthy
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'with an applicable deny rule' do
|
107
|
+
let(:rules) { [build(:os_rule, :windows, :no_version, :allow), build(:os_rule, :osx, :no_version, :disallow)] }
|
108
|
+
|
109
|
+
it 'returns false' do
|
110
|
+
is_expected.to be_falsey
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'with conflicting allow and deny rules' do
|
115
|
+
let(:rules) { [build(:rule), build(:os_rule, :osx, :no_version, :disallow)] }
|
116
|
+
|
117
|
+
it 'returns false' do
|
118
|
+
is_expected.to be_falsey
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
69
123
|
describe '#==' do
|
70
124
|
subject { library_1 == library_2 }
|
71
125
|
|
@@ -12,7 +12,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Marshalling::ManifestParser do
|
|
12
12
|
subject(:result) { parser.parse(document) }
|
13
13
|
|
14
14
|
it 'has the expected versions' do
|
15
|
-
is_expected.to
|
15
|
+
is_expected.to match_array(versions)
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '.latest_release' do
|
@@ -73,7 +73,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Marshalling::VersionParser do
|
|
73
73
|
subject(:downloads) { result.downloads }
|
74
74
|
|
75
75
|
it 'has the expected contents' do
|
76
|
-
is_expected.to
|
76
|
+
is_expected.to match_array(source.downloads)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ RSpec.describe Lapis::Minecraft::Versioning::Marshalling::VersionParser do
|
|
85
85
|
subject(:libraries) { result.libraries }
|
86
86
|
|
87
87
|
it 'has the expected contents' do
|
88
|
-
is_expected.to
|
88
|
+
is_expected.to match_array(source.libraries)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -48,6 +48,66 @@ RSpec.describe Lapis::Minecraft::Versioning::OSRule do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
describe '#applies_to?' do
|
52
|
+
subject { rule.applies_to?(properties) }
|
53
|
+
|
54
|
+
context 'with version specified' do
|
55
|
+
let(:rule) { build(:os_rule, :linux, :os_version => '^5\\.0$') }
|
56
|
+
|
57
|
+
context 'the type and version match' do
|
58
|
+
let(:properties) { {:os_type => 'linux', :os_version => '5.0'} }
|
59
|
+
|
60
|
+
it 'returns true' do
|
61
|
+
is_expected.to be_truthy
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'the version matches' do
|
66
|
+
let(:properties) { {:os_type => 'windows', :os_version => '5.0'} }
|
67
|
+
|
68
|
+
it 'returns false' do
|
69
|
+
is_expected.to be_falsey
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'the type matches' do
|
74
|
+
let(:properties) { {:os_type => 'linux', :os_version => '7.0'} }
|
75
|
+
|
76
|
+
it 'returns false' do
|
77
|
+
is_expected.to be_falsey
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'neither type nor version match' do
|
82
|
+
let(:properties) { {:os_type => 'osx', :os_version => '10.0'} }
|
83
|
+
|
84
|
+
it 'returns false' do
|
85
|
+
is_expected.to be_falsey
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'without version specified' do
|
91
|
+
let(:rule) { build(:os_rule, :osx, :no_version) }
|
92
|
+
|
93
|
+
context 'the type matches' do
|
94
|
+
let(:properties) { {:os_type => 'osx', :os_version => '11.0'} }
|
95
|
+
|
96
|
+
it 'returns true' do
|
97
|
+
is_expected.to be_truthy
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'the type does not match' do
|
102
|
+
let(:properties) { {:os_type => 'windows', :os_version => '8.1'} }
|
103
|
+
|
104
|
+
it 'returns false' do
|
105
|
+
is_expected.to be_falsey
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
51
111
|
describe '#==' do
|
52
112
|
subject { rule_1 == rule_2 }
|
53
113
|
|
@@ -58,7 +58,161 @@ RSpec.describe Lapis::Minecraft::Versioning::ResourceSet do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'contains the expected values' do
|
61
|
-
is_expected.to
|
61
|
+
is_expected.to match_array(resources)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#filter_resources' do
|
66
|
+
let(:windows_native) { build(:resource, :windows) }
|
67
|
+
let(:linux_native) { build(:resource, :linux) }
|
68
|
+
let(:osx_native) { build(:resource, :osx) }
|
69
|
+
let(:generic) { build(:resource) }
|
70
|
+
let(:resources) { [generic, windows_native, linux_native, osx_native] }
|
71
|
+
let(:set) { build(:resource_set, :resources => resources, :windows_classifier => windows_native.classifier, :linux_classifier => linux_native.classifier, :osx_classifier => osx_native.classifier) }
|
72
|
+
subject { set.filter_resources(properties) }
|
73
|
+
|
74
|
+
context 'with Windows properties' do
|
75
|
+
let(:properties) { {:os_type => 'windows'} }
|
76
|
+
|
77
|
+
it 'contains the Windows native' do
|
78
|
+
is_expected.to include(windows_native)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'contains the generic resource' do
|
82
|
+
is_expected.to include(generic)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'does not contain the other natives' do
|
86
|
+
is_expected.to_not include(linux_native, osx_native)
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'without a Windows native' do
|
90
|
+
let(:resources) { [generic, linux_native, osx_native] }
|
91
|
+
|
92
|
+
it 'contains the generic resource' do
|
93
|
+
is_expected.to include(generic)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'does not contain the other natives' do
|
97
|
+
is_expected.to_not include(linux_native, osx_native)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'with variables in the classifier' do
|
102
|
+
let(:native_64) { build(:resource, :classifier => 'natives-64') }
|
103
|
+
let(:native_32) { build(:resource, :classifier => 'natives-32') }
|
104
|
+
let(:properties) { {:os_type => 'windows', :arch => '64'} }
|
105
|
+
let(:resources) { [generic, native_32, native_64] }
|
106
|
+
let(:set) { build(:resource_set, :resources => resources, :windows_classifier => 'natives-${arch}') }
|
107
|
+
|
108
|
+
it 'contains the correct native' do
|
109
|
+
is_expected.to include(native_64)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'does not contain the other natives' do
|
113
|
+
is_expected.to_not include(native_32)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'contains the generic resource' do
|
117
|
+
is_expected.to include(generic)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'with Linux properties' do
|
123
|
+
let(:properties) { {:os_type => 'linux'} }
|
124
|
+
|
125
|
+
it 'contains the Linux native' do
|
126
|
+
is_expected.to include(linux_native)
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'contains the generic resource' do
|
130
|
+
is_expected.to include(generic)
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'does not contain the other natives' do
|
134
|
+
is_expected.to_not include(windows_native, osx_native)
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'without a Linux native' do
|
138
|
+
let(:resources) { [generic, windows_native, osx_native] }
|
139
|
+
|
140
|
+
it 'contains the generic resource' do
|
141
|
+
is_expected.to include(generic)
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'does not contain the other natives' do
|
145
|
+
is_expected.to_not include(windows_native, osx_native)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context 'with variables in the classifier' do
|
150
|
+
let(:native_64) { build(:resource, :classifier => 'natives-64') }
|
151
|
+
let(:native_32) { build(:resource, :classifier => 'natives-32') }
|
152
|
+
let(:properties) { {:os_type => 'linux', :arch => '64'} }
|
153
|
+
let(:resources) { [generic, native_32, native_64] }
|
154
|
+
let(:set) { build(:resource_set, :resources => resources, :linux_classifier => 'natives-${arch}') }
|
155
|
+
|
156
|
+
it 'contains the correct native' do
|
157
|
+
is_expected.to include(native_64)
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'does not contain the other natives' do
|
161
|
+
is_expected.to_not include(native_32)
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'contains the generic resource' do
|
165
|
+
is_expected.to include(generic)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'with OSX properties' do
|
171
|
+
let(:properties) { {:os_type => 'osx'} }
|
172
|
+
|
173
|
+
it 'contains the OSX native' do
|
174
|
+
is_expected.to include(osx_native)
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'contains the generic resource' do
|
178
|
+
is_expected.to include(generic)
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'does not contain the other natives' do
|
182
|
+
is_expected.to_not include(windows_native, linux_native)
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'without an OSX native' do
|
186
|
+
let(:resources) { [generic, windows_native, linux_native] }
|
187
|
+
|
188
|
+
it 'contains the generic resource' do
|
189
|
+
is_expected.to include(generic)
|
190
|
+
end
|
191
|
+
|
192
|
+
it 'does not contain the other natives' do
|
193
|
+
is_expected.to_not include(windows_native, linux_native)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context 'with variables in the classifier' do
|
198
|
+
let(:native_64) { build(:resource, :classifier => 'natives-64') }
|
199
|
+
let(:native_32) { build(:resource, :classifier => 'natives-32') }
|
200
|
+
let(:properties) { {:os_type => 'osx', :arch => '64'} }
|
201
|
+
let(:resources) { [generic, native_32, native_64] }
|
202
|
+
let(:set) { build(:resource_set, :resources => resources, :osx_classifier => 'natives-${arch}') }
|
203
|
+
|
204
|
+
it 'contains the correct native' do
|
205
|
+
is_expected.to include(native_64)
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'does not contain the other natives' do
|
209
|
+
is_expected.to_not include(native_32)
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'contains the generic resource' do
|
213
|
+
is_expected.to include(generic)
|
214
|
+
end
|
215
|
+
end
|
62
216
|
end
|
63
217
|
end
|
64
218
|
|
@@ -11,6 +11,16 @@ RSpec.describe Lapis::Minecraft::Versioning::Rule do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe '#applies_to?' do
|
15
|
+
let(:rule) { build(:rule) }
|
16
|
+
let(:properties) { {:os => 'Linux'} }
|
17
|
+
subject { rule.applies_to?(properties) }
|
18
|
+
|
19
|
+
it 'is true' do
|
20
|
+
is_expected.to be_truthy
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
14
24
|
describe '#==' do
|
15
25
|
subject { rule_1 == rule_2 }
|
16
26
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
if RUBY_PLATFORM != 'java'
|
2
|
+
# Code Climate test coverage.
|
3
|
+
begin
|
4
|
+
require 'codeclimate-test-reporter'
|
5
|
+
CodeClimate::TestReporter.start
|
6
|
+
rescue
|
7
|
+
# Continue without Code Climate test coverage.
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
require 'rspec'
|
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lapis-minecraft-versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: factory_girl
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '4.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '4.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: reek
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.38.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.38.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: codeclimate-test-reporter
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: yard
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
description: |-
|
@@ -174,11 +174,11 @@ executables:
|
|
174
174
|
extensions: []
|
175
175
|
extra_rdoc_files: []
|
176
176
|
files:
|
177
|
-
- .codeclimate.yml
|
178
|
-
- .gitignore
|
179
|
-
- .rspec
|
180
|
-
- .rubocop.yml
|
181
|
-
- .travis.yml
|
177
|
+
- ".codeclimate.yml"
|
178
|
+
- ".gitignore"
|
179
|
+
- ".rspec"
|
180
|
+
- ".rubocop.yml"
|
181
|
+
- ".travis.yml"
|
182
182
|
- Gemfile
|
183
183
|
- LICENSE.md
|
184
184
|
- README.md
|
@@ -254,17 +254,17 @@ require_paths:
|
|
254
254
|
- lib
|
255
255
|
required_ruby_version: !ruby/object:Gem::Requirement
|
256
256
|
requirements:
|
257
|
-
- -
|
257
|
+
- - ">="
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0'
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
|
-
- -
|
262
|
+
- - ">="
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project:
|
267
|
-
rubygems_version: 2.
|
267
|
+
rubygems_version: 2.5.1
|
268
268
|
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Retrieves and processes information about versions of Minecraft.
|