nexus_mods 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE.md +31 -0
- data/README.md +61 -0
- data/lib/nexus_mods/api_limits.rb +44 -0
- data/lib/nexus_mods/category.rb +37 -0
- data/lib/nexus_mods/game.rb +78 -0
- data/lib/nexus_mods/mod.rb +106 -0
- data/lib/nexus_mods/mod_file.rb +86 -0
- data/lib/nexus_mods/user.rb +37 -0
- data/lib/nexus_mods/version.rb +5 -0
- data/lib/nexus_mods.rb +274 -0
- data/spec/nexus_mods_test/helpers.rb +140 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/api_limits_spec.rb +19 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/game_spec.rb +122 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/mod_file_spec.rb +140 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/mod_spec.rb +185 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods_access_spec.rb +37 -0
- data/spec/nexus_mods_test/scenarios/rubocop_spec.rb +31 -0
- data/spec/spec_helper.rb +103 -0
- metadata +165 -0
@@ -0,0 +1,140 @@
|
|
1
|
+
describe NexusMods::ModFile do
|
2
|
+
|
3
|
+
context 'when testing mod files' do
|
4
|
+
|
5
|
+
# Example of JSON object returned by the API for a mod files list
|
6
|
+
let(:json_example_mod_files) do
|
7
|
+
[
|
8
|
+
{
|
9
|
+
'id' => [
|
10
|
+
2472,
|
11
|
+
1704
|
12
|
+
],
|
13
|
+
'uid' => 7_318_624_274_856,
|
14
|
+
'file_id' => 2472,
|
15
|
+
'name' => 'ApachiiSkyHair_v_1_6_Full',
|
16
|
+
'version' => '1.6.Full',
|
17
|
+
'category_id' => 4,
|
18
|
+
'category_name' => 'OLD_VERSION',
|
19
|
+
'is_primary' => false,
|
20
|
+
'file_name' => 'ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z',
|
21
|
+
'uploaded_timestamp' => 1_477_967_645,
|
22
|
+
'uploaded_time' => '2016-11-01T02:34:05.000+00:00',
|
23
|
+
'mod_version' => '1.6.Full',
|
24
|
+
'external_virus_scan_url' => 'https://www.virustotal.com/file/3dcc96dce0b846ea643d626c48bd6ad08752da8232f3d29be644d36e1fd627cf/analysis/1477978674/',
|
25
|
+
'description' => '[b][color=orange] NOT optimized meshes. Standalone. Adds 42 new hairstyles for females, 21 hair for males and 5 hairs for Female Khajiit- 2 hairs for Male Khajiit[/color][/b] ',
|
26
|
+
'size' => 304_347,
|
27
|
+
'size_kb' => 304_347,
|
28
|
+
'size_in_bytes' => 309_251_227,
|
29
|
+
'changelog_html' => nil,
|
30
|
+
'content_preview_link' => 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z.json'
|
31
|
+
},
|
32
|
+
{
|
33
|
+
'id' => [
|
34
|
+
2487,
|
35
|
+
1705
|
36
|
+
],
|
37
|
+
'uid' => 7_318_624_274_857,
|
38
|
+
'file_id' => 2487,
|
39
|
+
'name' => 'ApachiiSkyHairMale_v_1_2',
|
40
|
+
'version' => '1.2',
|
41
|
+
'category_id' => 4,
|
42
|
+
'category_name' => 'OLD_VERSION',
|
43
|
+
'is_primary' => false,
|
44
|
+
'file_name' => 'ApachiiSkyHairMale_v_1_2-2014-1-2.7z',
|
45
|
+
'uploaded_timestamp' => 1_477_968_373,
|
46
|
+
'uploaded_time' => '2016-11-01T02:46:13.000+00:00',
|
47
|
+
'mod_version' => '1.2',
|
48
|
+
'external_virus_scan_url' => 'https://www.virustotal.com/file/3e86106233499ac43383c32ce4a2d8e162dc6e940b4d228f649a701b71ee5676/analysis/1477979366/',
|
49
|
+
'description' => 'NOT optimezed meshes. Standalone 55 Male hairs - Not included in ApachiiSkyHair v_1_6_Full ',
|
50
|
+
'size' => 204_347,
|
51
|
+
'size_kb' => 204_347,
|
52
|
+
'size_in_bytes' => 209_251_227,
|
53
|
+
'changelog_html' => nil,
|
54
|
+
'content_preview_link' => 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHairMale_v_1_2-2014-1-2.7z.json'
|
55
|
+
}
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
# Expect a mod's files to be the example ones
|
60
|
+
#
|
61
|
+
# Parameters::
|
62
|
+
# * *mod_files* (Array<NexusMods::File>): List of files to validate
|
63
|
+
def expect_mod_files_to_be_example(mod_files)
|
64
|
+
expect(mod_files.size).to eq 2
|
65
|
+
sorted_mod_files = mod_files.sort_by(&:id)
|
66
|
+
first_mod_file = sorted_mod_files.first
|
67
|
+
expect(first_mod_file.ids).to eq [2472, 1704]
|
68
|
+
expect(first_mod_file.uid).to eq 7_318_624_274_856
|
69
|
+
expect(first_mod_file.id).to eq 2472
|
70
|
+
expect(first_mod_file.name).to eq 'ApachiiSkyHair_v_1_6_Full'
|
71
|
+
expect(first_mod_file.version).to eq '1.6.Full'
|
72
|
+
expect(first_mod_file.category_id).to eq :old
|
73
|
+
expect(first_mod_file.category_name).to eq 'OLD_VERSION'
|
74
|
+
expect(first_mod_file.is_primary).to be false
|
75
|
+
expect(first_mod_file.size).to eq 309_251_227
|
76
|
+
expect(first_mod_file.file_name).to eq 'ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z'
|
77
|
+
expect(first_mod_file.uploaded_time).to eq Time.parse('2016-11-01T02:34:05.000+00:00')
|
78
|
+
expect(first_mod_file.mod_version).to eq '1.6.Full'
|
79
|
+
expect(first_mod_file.external_virus_scan_url).to eq 'https://www.virustotal.com/file/3dcc96dce0b846ea643d626c48bd6ad08752da8232f3d29be644d36e1fd627cf/analysis/1477978674/'
|
80
|
+
expect(first_mod_file.description).to eq '[b][color=orange] NOT optimized meshes. Standalone. Adds 42 new hairstyles for females, 21 hair for males and 5 hairs for Female Khajiit- 2 hairs for Male Khajiit[/color][/b] '
|
81
|
+
expect(first_mod_file.changelog_html).to be_nil
|
82
|
+
expect(first_mod_file.content_preview_url).to eq 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z.json'
|
83
|
+
second_mod_file = sorted_mod_files[1]
|
84
|
+
expect(second_mod_file.ids).to eq [2487, 1705]
|
85
|
+
expect(second_mod_file.uid).to eq 7_318_624_274_857
|
86
|
+
expect(second_mod_file.id).to eq 2487
|
87
|
+
expect(second_mod_file.name).to eq 'ApachiiSkyHairMale_v_1_2'
|
88
|
+
expect(second_mod_file.version).to eq '1.2'
|
89
|
+
expect(second_mod_file.category_id).to eq :old
|
90
|
+
expect(second_mod_file.category_name).to eq 'OLD_VERSION'
|
91
|
+
expect(second_mod_file.is_primary).to be false
|
92
|
+
expect(second_mod_file.size).to eq 209_251_227
|
93
|
+
expect(second_mod_file.file_name).to eq 'ApachiiSkyHairMale_v_1_2-2014-1-2.7z'
|
94
|
+
expect(second_mod_file.uploaded_time).to eq Time.parse('2016-11-01T02:46:13.000+00:00')
|
95
|
+
expect(second_mod_file.mod_version).to eq '1.2'
|
96
|
+
expect(second_mod_file.external_virus_scan_url).to eq 'https://www.virustotal.com/file/3e86106233499ac43383c32ce4a2d8e162dc6e940b4d228f649a701b71ee5676/analysis/1477979366/'
|
97
|
+
expect(second_mod_file.description).to eq 'NOT optimezed meshes. Standalone 55 Male hairs - Not included in ApachiiSkyHair v_1_6_Full '
|
98
|
+
expect(second_mod_file.changelog_html).to be_nil
|
99
|
+
expect(second_mod_file.content_preview_url).to eq 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHairMale_v_1_2-2014-1-2.7z.json'
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'returns a mod files list' do
|
103
|
+
expect_validate_user
|
104
|
+
expect_http_call_to(
|
105
|
+
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
106
|
+
json: { files: json_example_mod_files }
|
107
|
+
)
|
108
|
+
expect_mod_files_to_be_example(nexus_mods.mod_files(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'returns the default mod files list' do
|
112
|
+
expect_validate_user
|
113
|
+
expect_http_call_to(
|
114
|
+
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
115
|
+
json: { files: json_example_mod_files }
|
116
|
+
)
|
117
|
+
expect_mod_files_to_be_example(nexus_mods(mod_id: 2014).mod_files(game_domain_name: 'skyrimspecialedition'))
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'returns mod files list for the default game' do
|
121
|
+
expect_validate_user
|
122
|
+
expect_http_call_to(
|
123
|
+
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
124
|
+
json: { files: json_example_mod_files }
|
125
|
+
)
|
126
|
+
expect_mod_files_to_be_example(nexus_mods(game_domain_name: 'skyrimspecialedition').mod_files(mod_id: 2014))
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'returns mod files list for the default game and mod' do
|
130
|
+
expect_validate_user
|
131
|
+
expect_http_call_to(
|
132
|
+
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
133
|
+
json: { files: json_example_mod_files }
|
134
|
+
)
|
135
|
+
expect_mod_files_to_be_example(nexus_mods(game_domain_name: 'skyrimspecialedition', mod_id: 2014).mod_files)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
describe NexusMods::Mod do
|
2
|
+
|
3
|
+
context 'when testing mods' do
|
4
|
+
|
5
|
+
# Example of JSON object returned by the API for a mod information, having all possible fields
|
6
|
+
let(:json_complete_mod) do
|
7
|
+
{
|
8
|
+
'name' => 'ApachiiSkyHair SSE',
|
9
|
+
'summary' => 'New Female and Male Hairstyles for Humans, Elves and Orcs. Converted hair from Sims2 and Sims3.<br />Standalone version.',
|
10
|
+
'description' => 'Mod description',
|
11
|
+
'picture_url' => 'https://staticdelivery.nexusmods.com/mods/1704/images/10168-1-1392817986.jpg',
|
12
|
+
'mod_downloads' => 13_634_545,
|
13
|
+
'mod_unique_downloads' => 4_052_221,
|
14
|
+
'uid' => 7_318_624_272_650,
|
15
|
+
'mod_id' => 2014,
|
16
|
+
'game_id' => 1704,
|
17
|
+
'allow_rating' => true,
|
18
|
+
'domain_name' => 'skyrimspecialedition',
|
19
|
+
'category_id' => 26,
|
20
|
+
'version' => '1.6.Full',
|
21
|
+
'endorsement_count' => 298_845,
|
22
|
+
'created_timestamp' => 1_477_972_056,
|
23
|
+
'created_time' => '2016-11-01T03:47:36.000+00:00',
|
24
|
+
'updated_timestamp' => 1_507_398_546,
|
25
|
+
'updated_time' => '2017-10-07T17:49:06.000+00:00',
|
26
|
+
'author' => 'Apachii',
|
27
|
+
'uploaded_by' => 'apachii',
|
28
|
+
'uploaded_users_profile_url' => 'http://www.nexusmods.com/games/users/283148',
|
29
|
+
'contains_adult_content' => false,
|
30
|
+
'status' => 'published',
|
31
|
+
'available' => true,
|
32
|
+
'user' => {
|
33
|
+
'member_id' => 283_148,
|
34
|
+
'member_group_id' => 27,
|
35
|
+
'name' => 'apachii'
|
36
|
+
},
|
37
|
+
'endorsement' => {
|
38
|
+
'endorse_status' => 'Undecided',
|
39
|
+
'timestamp' => nil,
|
40
|
+
'version' => nil
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Example of JSON object returned by the API for a mod information, having minimum fields
|
46
|
+
let(:json_partial_mod) do
|
47
|
+
{
|
48
|
+
'mod_downloads' => 13_634_545,
|
49
|
+
'mod_unique_downloads' => 4_052_221,
|
50
|
+
'uid' => 7_318_624_272_650,
|
51
|
+
'mod_id' => 2014,
|
52
|
+
'game_id' => 1704,
|
53
|
+
'allow_rating' => true,
|
54
|
+
'domain_name' => 'skyrimspecialedition',
|
55
|
+
'category_id' => 26,
|
56
|
+
'version' => '1.6.Full',
|
57
|
+
'endorsement_count' => 298_845,
|
58
|
+
'created_timestamp' => 1_477_972_056,
|
59
|
+
'created_time' => '2016-11-01T03:47:36.000+00:00',
|
60
|
+
'updated_timestamp' => 1_507_398_546,
|
61
|
+
'updated_time' => '2017-10-07T17:49:06.000+00:00',
|
62
|
+
'author' => 'Apachii',
|
63
|
+
'uploaded_by' => 'apachii',
|
64
|
+
'uploaded_users_profile_url' => 'http://www.nexusmods.com/games/users/283148',
|
65
|
+
'contains_adult_content' => false,
|
66
|
+
'status' => 'published',
|
67
|
+
'available' => true,
|
68
|
+
'user' => {
|
69
|
+
'member_id' => 283_148,
|
70
|
+
'member_group_id' => 27,
|
71
|
+
'name' => 'apachii'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Expect a mod to be the example complete one
|
77
|
+
#
|
78
|
+
# Parameters::
|
79
|
+
# * *mod* (NexusMods::Mod): Mod to validate
|
80
|
+
def expect_mod_to_be_complete(mod)
|
81
|
+
expect(mod.name).to eq 'ApachiiSkyHair SSE'
|
82
|
+
expect(mod.summary).to eq 'New Female and Male Hairstyles for Humans, Elves and Orcs. Converted hair from Sims2 and Sims3.<br />Standalone version.'
|
83
|
+
expect(mod.description).to eq 'Mod description'
|
84
|
+
expect(mod.picture_url).to eq 'https://staticdelivery.nexusmods.com/mods/1704/images/10168-1-1392817986.jpg'
|
85
|
+
expect(mod.downloads_count).to eq 13_634_545
|
86
|
+
expect(mod.unique_downloads_count).to eq 4_052_221
|
87
|
+
expect(mod.uid).to eq 7_318_624_272_650
|
88
|
+
expect(mod.mod_id).to eq 2014
|
89
|
+
expect(mod.game_id).to eq 1704
|
90
|
+
expect(mod.allow_rating).to be true
|
91
|
+
expect(mod.domain_name).to eq 'skyrimspecialedition'
|
92
|
+
expect(mod.category_id).to eq 26
|
93
|
+
expect(mod.version).to eq '1.6.Full'
|
94
|
+
expect(mod.endorsements_count).to eq 298_845
|
95
|
+
expect(mod.created_time).to eq Time.parse('2016-11-01T03:47:36.000+00:00')
|
96
|
+
expect(mod.updated_time).to eq Time.parse('2017-10-07T17:49:06.000+00:00')
|
97
|
+
expect(mod.author).to eq 'Apachii'
|
98
|
+
expect(mod.contains_adult_content).to be false
|
99
|
+
expect(mod.status).to eq 'published'
|
100
|
+
expect(mod.available).to be true
|
101
|
+
expect(mod.uploader.member_id).to eq 283_148
|
102
|
+
expect(mod.uploader.member_group_id).to eq 27
|
103
|
+
expect(mod.uploader.name).to eq 'apachii'
|
104
|
+
expect(mod.uploader.profile_url).to eq 'http://www.nexusmods.com/games/users/283148'
|
105
|
+
end
|
106
|
+
|
107
|
+
# Expect a mod to be the example partial one
|
108
|
+
#
|
109
|
+
# Parameters::
|
110
|
+
# * *mod* (NexusMods::Mod): Mod to validate
|
111
|
+
def expect_mod_to_be_partial(mod)
|
112
|
+
expect(mod.name).to be_nil
|
113
|
+
expect(mod.summary).to be_nil
|
114
|
+
expect(mod.description).to be_nil
|
115
|
+
expect(mod.picture_url).to be_nil
|
116
|
+
expect(mod.downloads_count).to eq 13_634_545
|
117
|
+
expect(mod.unique_downloads_count).to eq 4_052_221
|
118
|
+
expect(mod.uid).to eq 7_318_624_272_650
|
119
|
+
expect(mod.mod_id).to eq 2014
|
120
|
+
expect(mod.game_id).to eq 1704
|
121
|
+
expect(mod.allow_rating).to be true
|
122
|
+
expect(mod.domain_name).to eq 'skyrimspecialedition'
|
123
|
+
expect(mod.category_id).to eq 26
|
124
|
+
expect(mod.version).to eq '1.6.Full'
|
125
|
+
expect(mod.endorsements_count).to eq 298_845
|
126
|
+
expect(mod.created_time).to eq Time.parse('2016-11-01T03:47:36.000+00:00')
|
127
|
+
expect(mod.updated_time).to eq Time.parse('2017-10-07T17:49:06.000+00:00')
|
128
|
+
expect(mod.author).to eq 'Apachii'
|
129
|
+
expect(mod.contains_adult_content).to be false
|
130
|
+
expect(mod.status).to eq 'published'
|
131
|
+
expect(mod.available).to be true
|
132
|
+
expect(mod.uploader.member_id).to eq 283_148
|
133
|
+
expect(mod.uploader.member_group_id).to eq 27
|
134
|
+
expect(mod.uploader.name).to eq 'apachii'
|
135
|
+
expect(mod.uploader.profile_url).to eq 'http://www.nexusmods.com/games/users/283148'
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'returns a mod complete information' do
|
139
|
+
expect_validate_user
|
140
|
+
expect_http_call_to(
|
141
|
+
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
142
|
+
json: json_complete_mod
|
143
|
+
)
|
144
|
+
expect_mod_to_be_complete(nexus_mods.mod(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'returns a mod partial information' do
|
148
|
+
expect_validate_user
|
149
|
+
expect_http_call_to(
|
150
|
+
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
151
|
+
json: json_partial_mod
|
152
|
+
)
|
153
|
+
expect_mod_to_be_partial(nexus_mods.mod(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'returns the default mod information' do
|
157
|
+
expect_validate_user
|
158
|
+
expect_http_call_to(
|
159
|
+
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
160
|
+
json: json_complete_mod
|
161
|
+
)
|
162
|
+
expect_mod_to_be_complete(nexus_mods(mod_id: 2014).mod(game_domain_name: 'skyrimspecialedition'))
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'returns mod information for the default game' do
|
166
|
+
expect_validate_user
|
167
|
+
expect_http_call_to(
|
168
|
+
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
169
|
+
json: json_complete_mod
|
170
|
+
)
|
171
|
+
expect_mod_to_be_complete(nexus_mods(game_domain_name: 'skyrimspecialedition').mod(mod_id: 2014))
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'returns mod information for the default game and mod' do
|
175
|
+
expect_validate_user
|
176
|
+
expect_http_call_to(
|
177
|
+
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
178
|
+
json: json_complete_mod
|
179
|
+
)
|
180
|
+
expect_mod_to_be_complete(nexus_mods(game_domain_name: 'skyrimspecialedition', mod_id: 2014).mod)
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
describe NexusMods do
|
2
|
+
|
3
|
+
context 'when testing authentication and access' do
|
4
|
+
|
5
|
+
it 'fails with an exception if the API key is invalid' do
|
6
|
+
expect_http_call_to(
|
7
|
+
path: '/v1/users/validate.json',
|
8
|
+
api_key: 'wrong_api_key',
|
9
|
+
code: 401,
|
10
|
+
json: {
|
11
|
+
message: 'Please provide a valid API Key'
|
12
|
+
}
|
13
|
+
)
|
14
|
+
expect { nexus_mods(api_key: 'wrong_api_key') }.to raise_error(NexusMods::InvalidApiKeyError)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'fails with an exception if the API limits have been reached' do
|
18
|
+
expect_http_call_to(
|
19
|
+
path: '/v1/users/validate.json',
|
20
|
+
code: 429
|
21
|
+
)
|
22
|
+
expect { nexus_mods }.to raise_error(NexusMods::LimitsExceededError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'fails with an exception if the API limits have been reached during usage' do
|
26
|
+
expect_validate_user
|
27
|
+
expect_http_call_to(
|
28
|
+
path: '/v1/games.json',
|
29
|
+
code: 429
|
30
|
+
)
|
31
|
+
nexus_mods
|
32
|
+
expect { nexus_mods.games }.to raise_error(NexusMods::LimitsExceededError)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
describe 'Coding guidelines' do
|
4
|
+
|
5
|
+
it 'makes sure code style follow Rubocop guides' do
|
6
|
+
rubocop_report = JSON.parse(`bundle exec rubocop --format json`)
|
7
|
+
expect(rubocop_report['summary']['offense_count']).to(
|
8
|
+
eq(0),
|
9
|
+
proc do
|
10
|
+
# Format a great error message to help
|
11
|
+
wrong_files = rubocop_report['files'].reject { |file_info| file_info['offenses'].empty? }
|
12
|
+
<<~EO_ERROR
|
13
|
+
#{wrong_files.size} files have Rubocop issues:
|
14
|
+
#{
|
15
|
+
wrong_files.map do |file_info|
|
16
|
+
offenses = file_info['offenses'].map { |offense_info| "L#{offense_info['location']['start_line']}: #{offense_info['cop_name']} - #{offense_info['message']}" }
|
17
|
+
"* #{file_info['path']}:#{
|
18
|
+
if offenses.size == 1
|
19
|
+
" #{offenses.first}"
|
20
|
+
else
|
21
|
+
" #{offenses.size} offenses:\n#{offenses.map { |offense| " - #{offense}" }.join("\n")}"
|
22
|
+
end
|
23
|
+
}"
|
24
|
+
end.join("\n")
|
25
|
+
}
|
26
|
+
EO_ERROR
|
27
|
+
end
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'nexus_mods_test/helpers'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
44
|
+
# have no way to turn it off -- the option exists only for backwards
|
45
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
46
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
47
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
48
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
49
|
+
|
50
|
+
# The settings below are suggested to provide a good initial experience
|
51
|
+
# with RSpec, but feel free to customize to your heart's content.
|
52
|
+
|
53
|
+
# This allows you to limit a spec run to individual examples or groups
|
54
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
55
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
56
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
57
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
58
|
+
# config.filter_run_when_matching :focus
|
59
|
+
|
60
|
+
# Allows RSpec to persist some state between runs in order to support
|
61
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
62
|
+
# you configure your source control system to ignore this file.
|
63
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
64
|
+
|
65
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
66
|
+
# recommended. For more details, see:
|
67
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
68
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
69
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
70
|
+
# config.disable_monkey_patching!
|
71
|
+
|
72
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
73
|
+
# be too noisy due to issues in dependencies.
|
74
|
+
# config.warnings = true
|
75
|
+
|
76
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
77
|
+
# file, and it's useful to allow more verbose output when running an
|
78
|
+
# individual spec file.
|
79
|
+
# if config.files_to_run.one?
|
80
|
+
# # Use the documentation formatter for detailed output,
|
81
|
+
# # unless a formatter has already been configured
|
82
|
+
# # (e.g. via a command-line flag).
|
83
|
+
# config.default_formatter = "doc"
|
84
|
+
# end
|
85
|
+
|
86
|
+
# Print the 10 slowest examples and example groups at the
|
87
|
+
# end of the spec run, to help surface which specs are running
|
88
|
+
# particularly slow.
|
89
|
+
# config.profile_examples = 10
|
90
|
+
|
91
|
+
# Run specs in random order to surface order dependencies. If you find an
|
92
|
+
# order dependency and want to debug it, you can fix the order by providing
|
93
|
+
# the seed, which is printed after each run.
|
94
|
+
# --seed 1234
|
95
|
+
# config.order = :random
|
96
|
+
|
97
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
98
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
99
|
+
# test failures related to randomization by passing the same `--seed` value
|
100
|
+
# as the one that triggered the failure.
|
101
|
+
# Kernel.srand config.seed
|
102
|
+
|
103
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nexus_mods
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Muriel Salvan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-http-cache
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.18'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.18'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.48'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.48'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.19'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.19'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sem_ver_components
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.3'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- muriel@x-aeon.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files:
|
117
|
+
- CHANGELOG.md
|
118
|
+
- LICENSE.md
|
119
|
+
- README.md
|
120
|
+
files:
|
121
|
+
- CHANGELOG.md
|
122
|
+
- LICENSE.md
|
123
|
+
- README.md
|
124
|
+
- lib/nexus_mods.rb
|
125
|
+
- lib/nexus_mods/api_limits.rb
|
126
|
+
- lib/nexus_mods/category.rb
|
127
|
+
- lib/nexus_mods/game.rb
|
128
|
+
- lib/nexus_mods/mod.rb
|
129
|
+
- lib/nexus_mods/mod_file.rb
|
130
|
+
- lib/nexus_mods/user.rb
|
131
|
+
- lib/nexus_mods/version.rb
|
132
|
+
- spec/nexus_mods_test/helpers.rb
|
133
|
+
- spec/nexus_mods_test/scenarios/nexus_mods/api_limits_spec.rb
|
134
|
+
- spec/nexus_mods_test/scenarios/nexus_mods/game_spec.rb
|
135
|
+
- spec/nexus_mods_test/scenarios/nexus_mods/mod_file_spec.rb
|
136
|
+
- spec/nexus_mods_test/scenarios/nexus_mods/mod_spec.rb
|
137
|
+
- spec/nexus_mods_test/scenarios/nexus_mods_access_spec.rb
|
138
|
+
- spec/nexus_mods_test/scenarios/rubocop_spec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
homepage: https://github.com/Muriel-Salvan/nexus_mods
|
141
|
+
licenses:
|
142
|
+
- BSD-3-Clause
|
143
|
+
metadata:
|
144
|
+
homepage_uri: https://github.com/Muriel-Salvan/nexus_mods
|
145
|
+
rubygems_mfa_required: 'true'
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '3.1'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubygems_version: 3.4.6
|
162
|
+
signing_key:
|
163
|
+
specification_version: 4
|
164
|
+
summary: Access NexusMods REST API from Ruby
|
165
|
+
test_files: []
|