eivu_video_game_info 1.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 636de9437f1f1daff2e6856a5b36b824c1c9d1acd85e20b675b0421d96d5ec98
4
+ data.tar.gz: 0072a5f8d1159542d8aba84f1a121973575e8b63d3268ead7192dd8b00cb9f38
5
+ SHA512:
6
+ metadata.gz: 5a9c9f14c11820f064387fbacdc61acc8e01f810a71f6d7cf43d1ad4aa919b329aca3010cc07bcc72c5456f0f3466ebebad4adb6446c6a6da277be4675a8d652
7
+ data.tar.gz: 35da7663c5ad268b9cd3ac09d98f655e4f808a4d3f6cb85c759e24112eab33a12adce8be7dfb626fb5481ff565d49bf8b63238168e8cd32a0c38518a7481ceb1
data/.releaserc.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "branches": ["main"],
3
+ "plugins": [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ "@semantic-release/changelog",
7
+ "@semantic-release/github",
8
+ [
9
+ "@semantic-release/git",
10
+ {
11
+ "assets": ["CHANGELOG.md"],
12
+ "message": "chore(release): [skip ci] Update v${nextRelease.version}\n\n${nextRelease.notes}"
13
+ }
14
+ ]
15
+ ]
16
+ }
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,47 @@
1
+ require:
2
+ - rubocop
3
+
4
+ # We want some defaults merged instead of overwriting them.
5
+ inherit_mode:
6
+ merge:
7
+ - Exclude # for all cops
8
+ - AllowedNames # for Naming/Uncommunicative* cops
9
+ - IgnoredMethods # for Style/SymbolProc
10
+
11
+ AllCops:
12
+ TargetRubyVersion: 3.1
13
+ NewCops: enable
14
+ SuggestExtensions: false
15
+ Exclude:
16
+ - notes/**/*
17
+ - spec/support/vcr_helper.rb
18
+ - spec/spec_helper.rb
19
+
20
+ Style/Documentation:
21
+ Enabled: false
22
+
23
+ Metrics/BlockLength:
24
+ Exclude:
25
+ - spec/**/*.rb
26
+
27
+ # No need to keep chasing and fixing autogenerated files, as well as splitting
28
+ # urls in route configs.
29
+ Layout/LineLength:
30
+ Max: 120
31
+ Exclude:
32
+ - eivu-client-ruby.gemspec
33
+ - Gemfile
34
+ - spec/spec_helper.rb
35
+ - spec/support/vcr_helper.rb
36
+
37
+
38
+ Metrics/ClassLength:
39
+ Enabled: false
40
+
41
+ Metrics/MethodLength:
42
+ Max: 30
43
+ Exclude:
44
+ - spec/**/*.rb
45
+
46
+ Metrics/AbcSize:
47
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-03-23
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at 384403+dabobert@users.noreply.github.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Rob Jenkins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # EivuVideoGameInfo
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/eivu_video_game_info`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eivu_video_game_info. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/eivu_video_game_info/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the EivuVideoGameInfo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/eivu_video_game_info/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,268 @@
1
+ require 'pry'
2
+ require 'active_record'
3
+ require 'active_support/all'
4
+
5
+ module EivuVideoGameInfo
6
+ class Loader
7
+ include EivuVideoGameInfo::Models::Concerns::ActiveRecordable
8
+
9
+ ROM_FORMATS = {
10
+ '3DO Interactive Multiplayer' => %w[],
11
+ 'Commodore Amiga' => %w[],
12
+ 'Amstrad CPC' => %w[],
13
+ 'Android' => %w[apk],
14
+ 'Arcade' => %w[],
15
+ 'Atari 2600' => %w[a26],
16
+ 'Atari 5200' => %w[a52],
17
+ 'Atari 7800' => %w[a78],
18
+ 'Atari Jaguar' => %w[jag],
19
+ 'Atari Jaguar CD' => %w[],
20
+ 'Atari Lynx' => %w[lnx],
21
+ 'Atari XEGS' => %w[],
22
+ 'ColecoVision' => %w[col],
23
+ 'Commodore 64' => %w[],
24
+ 'Mattel Intellivision' => %w[],
25
+ 'Apple iOS' => %w[ipa],
26
+ 'Apple Mac OS' => %w[],
27
+ 'Microsoft Xbox' => %w[],
28
+ 'Microsoft Xbox 360' => %w[],
29
+ 'Microsoft Xbox One' => %w[],
30
+ 'SNK Neo Geo Pocket' => %w[ngp],
31
+ 'SNK Neo Geo Pocket Color' => %w[ngc],
32
+ 'SNK Neo Geo AES' => %w[],
33
+ 'Nintendo 3DS' => %w[3ds],
34
+ 'Nintendo 64' => %w[v64 z64 n64],
35
+ 'Nintendo DS' => %w[nds],
36
+ 'Nintendo Entertainment System' => %w[nes bsv nez unf unif],
37
+ 'Nintendo Game Boy' => %w[gb],
38
+ 'Nintendo Game Boy Advance' => %w[gba srl],
39
+ 'Nintendo Game Boy Color' => %w[gbc],
40
+ 'Nintendo GameCube' => %w[gcm gcz iso],
41
+ 'Nintendo Virtual Boy' => %w[vb],
42
+ 'Nintendo Wii' => %w[wad wbfs],
43
+ 'Nintendo Wii U' => %w[],
44
+ 'Ouya' => %w[],
45
+ 'Philips CD-i' => %w[],
46
+ 'Sega 32X' => %w[32x],
47
+ 'Sega CD' => %w[],
48
+ 'Sega Dreamcast' => %w[],
49
+ 'Sega CD' => %w[],
50
+ 'Sega Dreamcast' => %w[],
51
+ 'Sega Game Gear' => %w[gg],
52
+ 'Sega Genesis' => %w[gen],
53
+ 'Sega Master System' => %w[sms],
54
+ 'Sega Saturn' => %w[],
55
+ 'Sinclair ZX Spectrum' => %w[],
56
+ 'Sony Playstation' => %w[],
57
+ 'Sony Playstation 2' => %w[],
58
+ 'Sony Playstation 3' => %w[],
59
+ 'Sony Playstation 4' => %w[],
60
+ 'Sony Playstation Vita' => %w[],
61
+ 'Sony PSP' => %w[],
62
+ 'Super Nintendo Entertainment System' => %w[sfc smc],
63
+ 'NEC TurboGrafx-16' => %w[pce],
64
+ 'WonderSwan' => %w[ws],
65
+ 'WonderSwan Color' => %w[wsc],
66
+ 'Magnavox Odyssey 2' => %w[],
67
+ 'Fairchild Channel F' => %w[],
68
+ 'BBC Microcomputer System' => %w[],
69
+ 'Memotech MTX512' => %w[],
70
+ 'Camputers Lynx' => %w[],
71
+ 'Tiger Game.com' => %w[],
72
+ 'Oric Atmos' => %w[],
73
+ 'Acorn Electron' => %w[],
74
+ 'Dragon 32/64' => %w[],
75
+ 'Entex Adventure Vision' => %w[],
76
+ 'APF Imagination Machine' => %w[],
77
+ 'Mattel Aquarius' => %w[],
78
+ 'Jupiter Ace' => %w[],
79
+ 'SAM Coupé' => %w[],
80
+ 'Enterprise' => %w[],
81
+ 'EACA EG2000 Colour Genie' => %w[],
82
+ 'Acorn Archimedes' => %w[],
83
+ 'Tapwave Zodiac' => %w[],
84
+ 'Atari ST' => %w[],
85
+ 'Bally Astrocade' => %w[],
86
+ 'Magnavox Odyssey' => %w[],
87
+ 'Emerson Arcadia 2001' => %w[],
88
+ 'Sega SG-1000' => %w[],
89
+ 'Epoch Super Cassette Vision' => %w[],
90
+ 'Microsoft MSX' => %w[],
91
+ 'MS-DOS' => %w[],
92
+ 'Windows' => %w[],
93
+ 'Web Browser' => %w[],
94
+ 'Sega Model 2' => %w[],
95
+ 'Namco System 22' => %w[],
96
+ 'Sega Model 3' => %w[],
97
+ 'Sega System 32' => %w[],
98
+ 'Sega System 16' => %w[],
99
+ 'Sammy Atomiswave' => %w[],
100
+ 'Sega Naomi' => %w[],
101
+ 'Sega Naomi 2' => %w[],
102
+ 'Atari 800' => %w[],
103
+ 'Sega Model 1' => %w[],
104
+ 'Sega Pico' => %w[],
105
+ 'Acorn Atom' => %w[],
106
+ 'Amstrad GX4000' => %w[],
107
+ 'Apple II' => %w[],
108
+ 'Apple IIGS' => %w[],
109
+ 'Casio Loopy' => %w[],
110
+ 'Casio PV-1000' => %w[],
111
+ 'Coleco ADAM' => %w[],
112
+ 'Commodore 128' => %w[],
113
+ 'Commodore Amiga CD32' => %w[],
114
+ 'Commodore CDTV' => %w[],
115
+ 'Commodore Plus 4' => %w[],
116
+ 'Commodore VIC-20' => %w[],
117
+ 'Fujitsu FM Towns Marty' => %w[],
118
+ 'GCE Vectrex' => %w[],
119
+ 'Nuon' => %w[],
120
+ 'Mega Duck' => %w[],
121
+ 'Sharp X68000' => %w[],
122
+ 'Tandy TRS-80' => %w[],
123
+ 'Elektronika BK' => %w[],
124
+ 'Epoch Game Pocket Computer' => %w[],
125
+ 'Funtech Super Acan' => %w[],
126
+ 'GamePark GP32' => %w[],
127
+ 'Hartung Game Master' => %w[],
128
+ 'Interton VC 4000' => %w[],
129
+ 'MUGEN' => %w[],
130
+ 'OpenBOR' => %w[],
131
+ 'Philips VG 5000' => %w[],
132
+ 'Philips Videopac+' => %w[],
133
+ 'RCA Studio II' => %w[],
134
+ 'ScummVM' => %w[],
135
+ 'Sega Dreamcast VMU' => %w[],
136
+ 'Sega SC-3000' => %w[],
137
+ 'Sega ST-V' => %w[],
138
+ 'Sinclair ZX-81' => %w[],
139
+ 'Sord M5' => %w[],
140
+ 'Texas Instruments TI 99/4A' => %w[],
141
+ 'Pinball' => %w[],
142
+ 'VTech CreatiVision' => %w[],
143
+ 'Watara Supervision' => %w[],
144
+ 'WoW Action Max' => %w[],
145
+ 'ZiNc' => %w[],
146
+ 'Nintendo Famicom Disk System' => %w[],
147
+ 'NEC PC-FX' => %w[],
148
+ 'PC Engine SuperGrafx' => %w[],
149
+ 'NEC TurboGrafx-CD' => %w[],
150
+ 'TRS-80 Color Computer' => %w[],
151
+ 'Nintendo Game & Watch' => %w[],
152
+ 'SNK Neo Geo CD' => %w[],
153
+ 'Nintendo Satellaview' => %w[],
154
+ 'Taito Type X' => %w[],
155
+ 'XaviXPORT' => %w[],
156
+ 'Mattel HyperScan' => %w[],
157
+ 'Game Wave Family Entertainment System' => %w[],
158
+ 'Sega CD 32X' => %w[],
159
+ 'Aamber Pegasus' => %w[],
160
+ 'Apogee BK-01' => %w[],
161
+ 'Commodore MAX Machine' => %w[],
162
+ 'Commodore PET' => %w[],
163
+ 'Exelvision EXL 100' => %w[],
164
+ 'Exidy Sorcerer' => %w[],
165
+ 'Fujitsu FM-7' => %w[],
166
+ 'Hector HRX' => %w[],
167
+ 'Matra and Hachette Alice' => %w[],
168
+ 'Microsoft MSX2' => %w[],
169
+ 'Microsoft MSX2+' => %w[],
170
+ 'NEC PC-8801' => %w[],
171
+ 'NEC PC-9801' => %w[],
172
+ 'Nintendo 64DD' => %w[],
173
+ 'Nintendo Pokemon Mini' => %w[],
174
+ 'Othello Multivision' => %w[],
175
+ 'VTech Socrates' => %w[],
176
+ 'Vector-06C' => %w[],
177
+ 'Tomy Tutor' => %w[],
178
+ 'Spectravideo' => %w[],
179
+ 'Sony PSP Minis' => %w[],
180
+ 'Sony PocketStation' => %w[],
181
+ 'Sharp X1' => %w[],
182
+ 'Sharp MZ-2500' => %w[],
183
+ 'Sega Triforce' => %w[],
184
+ 'Sega Hikaru' => %w[],
185
+ 'SNK Neo Geo MVS' => %w[],
186
+ 'Nintendo Switch' => %w[nsp xci],
187
+ 'Windows 3.X' => %w[],
188
+ 'Nokia N-Gage' => %w[],
189
+ 'GameWave' => %w[],
190
+ 'Linux' => %w[],
191
+ 'Sony Playstation 5' => %w[],
192
+ 'PICO-8' => %w[],
193
+ 'VTech V.Smile' => %w[],
194
+ 'Microsoft Xbox Series X/S' => %w[]
195
+ }.freeze
196
+
197
+ PLATFORM_NAMES_TO_IGNORE = [
198
+ 'Atari 2600', 'Atari 5200', 'Atari 7800', 'Atari XEGS', 'Sega CD', 'Sega Master System',
199
+ 'Atari ST', 'Sega System 32', 'Sega System 16', 'Atari 800', 'Sega CD 32X'
200
+ ]
201
+
202
+ class << self
203
+ def populate_game_slugs
204
+ EivuVideoGameInfo::Models::Game.find_each do |game|
205
+ puts game.id
206
+ game.update_attribute(:slug, EivuVideoGameInfo::Models::Game.slugify_string(game.name))
207
+ end
208
+ end
209
+
210
+ def setup
211
+ setup_platform_roms_table
212
+ # add_newer_columns
213
+ # populate_game_slugs
214
+ # populate_platform_id_in_games
215
+ # clean_db_game_names
216
+ end
217
+
218
+ def populate_platform_id_in_games
219
+ EivuVideoGameInfo::Models::Platform.all.each do |platform|
220
+ EivuVideoGameInfo::Models::Game.where(platform: platform.name).update_all(platform_id: platform.id)
221
+ end
222
+ end
223
+
224
+ def populate_short_names
225
+ EivuVideoGameInfo::Models::Platform.update_all('short_name = name')
226
+ %w[Sega Nintendo Commodore Sony Microsoft SNK].each do |string|
227
+ EivuVideoGameInfo::Models::Platform
228
+ .where.not(name: PLATFORM_NAMES_TO_IGNORE)
229
+ .update_all("short_name = replace(short_name, '#{string} ', '')")
230
+ end
231
+ end
232
+
233
+ def add_newer_columns
234
+ games_info = ActiveRecord::Base.connection.execute('PRAGMA table_info(games);')
235
+ if games_info.detect { |hash| hash['name'] == 'slug' }.blank?
236
+ ActiveRecord::Base.connection.execute('ALTER TABLE "games" ADD COLUMN "slug" varchar')
237
+ end
238
+
239
+ if games_info.detect { |hash| hash['name'] == 'platform_id' }.blank?
240
+ ActiveRecord::Base.connection.execute('ALTER TABLE "games" ADD COLUMN "platform_id" varchar')
241
+ end
242
+
243
+ platforms_info = ActiveRecord::Base.connection.execute('PRAGMA table_info(platforms);')
244
+ return unless platforms_info.detect { |hash| hash['name'] == 'short_name' }.blank?
245
+
246
+ ActiveRecord::Base.connection.execute('ALTER TABLE "platforms" ADD COLUMN "short_name" varchar;')
247
+ end
248
+
249
+ def setup_platform_roms_table
250
+ platform_formats_info = ActiveRecord::Base.connection.execute('PRAGMA table_info(platform_formats);')
251
+ if platform_formats_info.blank?
252
+ ActiveRecord::Base.connection.execute('CREATE TABLE "platform_formats" ("id" integer,"platform_id" int,"format" varchar, PRIMARY KEY (id));')
253
+ end
254
+
255
+ ROM_FORMATS.each do |platform_name, formats|
256
+ next if formats.blank?
257
+
258
+ platform = EivuVideoGameInfo::Models::Platform.find_by(name: platform_name)
259
+ next if platform.blank?
260
+
261
+ formats.each do |format|
262
+ EivuVideoGameInfo::Models::PlatformFormat.find_or_create_by(platform_id: platform.id, format: format)
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
@@ -0,0 +1,21 @@
1
+ require 'active_record'
2
+
3
+ module EivuVideoGameInfo
4
+ module Models
5
+ module Concerns
6
+ module ActiveRecordable
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'lib/eivu_video_game_info/db/db.sqlite3')
11
+ end
12
+
13
+ # module InstanceMethods
14
+ # def save
15
+ # # save the record
16
+ # end
17
+ # end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,109 @@
1
+ require 'active_record'
2
+ require 'active_support/all'
3
+ require 'pry'
4
+
5
+ module EivuVideoGameInfo
6
+ module Models
7
+ class Game < ::ActiveRecord::Base
8
+ include EivuVideoGameInfo::Models::Concerns::ActiveRecordable
9
+
10
+ belongs_to :platform
11
+
12
+ # order matters for the array below
13
+ # will be run in order they are defined
14
+ SLUGIFY_RULES_LIST = [
15
+ REGEX_COUNTRY = /\(([^)]+)\)/, # replace (value)
16
+ REGEX_MISC_TAG = /\[([^)]+)\]/, # replace [value]
17
+ RULE_THE_MID = ' the '.freeze,
18
+ RULE_THE_START = /^the /,
19
+ RULE_GBS_PLAYER = /gbs player v\d+(\.\d+)? -/,
20
+ RULE_AND = ' and '.freeze,
21
+ RULE_DISNEYS = 'disney\'s'.freeze,
22
+ RULE_SPECIAL_CHARS = /[^a-z0-9]/
23
+ ].freeze
24
+
25
+ SLUGIFY_SECONDARY_RULES_LIST = [
26
+ RULE_GBS_PLAYER,
27
+ REGEX_VERSION = /v\d+(\.\d+)?[a-b]?/
28
+ ]
29
+
30
+ LEADING_DIGITS = /^(\d{4})/
31
+
32
+ class << self
33
+ def extract_country(rom_name)
34
+ case rom_name.scan(REGEX_COUNTRY).flatten&.first
35
+ when 'U'
36
+ 'USA'
37
+ when 'J'
38
+ 'Japan'
39
+ when 'E'
40
+ 'Europe'
41
+ when 'K'
42
+ 'Korea'
43
+ when nil
44
+ nil
45
+ else
46
+ 'Unknown'
47
+ end
48
+ end
49
+
50
+ def fetch_rom_info(filename)
51
+ format = File.extname(filename).delete('.')
52
+ platform_id = PlatformFormat.find_by(format:)&.platform_id
53
+ return nil if platform_id.nil?
54
+
55
+ slugs = [slugify_rom(filename), slugify_rom_xtra(filename)]
56
+ # try to find an exact match of the slug via either slug
57
+ slugs.detect do |slug|
58
+ game = Game.find_by(slug:, platform_id:)
59
+ return game if game.present?
60
+
61
+ slug.gsub!(LEADING_DIGITS, '')
62
+ Game.find_by(slug:, platform_id:)
63
+ end
64
+
65
+ # if no exact match, return a match if there is only a single partial match
66
+ slugs.detect do |slug|
67
+ matches = Game.where(platform_id:).where('slug like ?', "#{slug}%")
68
+ return matches.first if matches.size == 1
69
+
70
+ slug.gsub!(LEADING_DIGITS, '')
71
+ matches = Game.where(platform_id:).where('slug like ?', "#{slug}%")
72
+ return matches.first if matches.size == 1
73
+ end
74
+ end
75
+
76
+ def fetch_rom_info_as_json(filename)
77
+ fetch_rom_info(filename)&.as_json
78
+ end
79
+
80
+ def slugify_string(string)
81
+ value = I18n.transliterate(string.dup.downcase.gsub('_', ' '))
82
+ SLUGIFY_RULES_LIST.each { |rule| value.gsub!(rule, '') }
83
+ value
84
+ end
85
+
86
+ def slugify_string_xtra(string)
87
+ value = I18n.transliterate(string.dup.downcase.gsub('_', ' '))
88
+
89
+ (SLUGIFY_SECONDARY_RULES_LIST + SLUGIFY_RULES_LIST).each { |rule| value.gsub!(rule, '') }
90
+ value
91
+ end
92
+
93
+ def slugify_rom(rom_name)
94
+ slugify_string(File.basename(rom_name, '.*'))
95
+ end
96
+
97
+ def slugify_rom_xtra(rom_name)
98
+ slugify_string_xtra(File.basename(rom_name, '.*'))
99
+ end
100
+ end
101
+
102
+ def as_json(options = {})
103
+ response = attributes&.symbolize_keys
104
+ response[:platform] = platform.short_name
105
+ response
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,9 @@
1
+ require 'active_record'
2
+
3
+ module EivuVideoGameInfo
4
+ module Models
5
+ class Platform < ::ActiveRecord::Base
6
+ include EivuVideoGameInfo::Models::Concerns::ActiveRecordable
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ require 'active_record'
2
+ require 'pry'
3
+
4
+ module EivuVideoGameInfo
5
+ module Models
6
+ class PlatformFormat < ::ActiveRecord::Base
7
+ include EivuVideoGameInfo::Models::Concerns::ActiveRecordable
8
+
9
+ # full list including disc based systems at
10
+ # https://gist.github.com/dabobert/00f23d168a0f4c861d3d2dbea83f2b37
11
+ FORMATS = [
12
+ FORMAT_ATARI2600 = %w[a26].freeze,
13
+ FORMAT_ATARI5200 = %w[a52].freeze,
14
+ FORMAT_ATARI7800 = %w[a78].freeze,
15
+ FORMAT_COLECOVISION = %w[col].freeze,
16
+ FORMAT_FAMICOM = %w[nes].freeze,
17
+ FORMAT_GAMEBOY = %w[srm gb].freeze,
18
+ FORMAT_GAMEBOYADVANCE = %w[gba mb e+].freeze,
19
+ FORMAT_GAMEBOYCOLOR = %w[gb gbc cgb sgb].freeze,
20
+ FORMAT_GAMEGEAR = %w[gg].freeze,
21
+ FORMAT_GENESIS = %w[gen].freeze,
22
+ FORMAT_INTELLIVISION = %w[int].freeze,
23
+ FORMAT_JAGUAR = %w[jag].freeze,
24
+ FORMAT_LYNX = %w[lnx].freeze,
25
+ FORMAT_NES = %w[nes bsv].freeze,
26
+ FORMAT_NEOGEOPOCKET = %w[ngp].freeze,
27
+ FORMAT_NEOGEOPOCKETCOLOR = %w[ngc].freeze,
28
+ FORMAT_NINTENDO3DS = %w[3ds].freeze,
29
+ FORMAT_NINTENDO64 = %w[v64 z64 n64].freeze,
30
+ FORMAT_NINTENDODS = %w[nds].freeze,
31
+ FORMAT_SEGA32X = %w[32x].freeze,
32
+ FORMAT_SNES = %w[sfc smc].freeze,
33
+ FORMAT_TURBOGRAFX16 = %w[pce].freeze,
34
+ FORMAT_VIRTUALBOY = %w[vb].freeze
35
+ ].flatten.freeze
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,48 @@
1
+ require 'pry'
2
+ require 'csv'
3
+ require 'active_support/all'
4
+ module EivuVideoGameInfo
5
+ class Utils
6
+ class << self
7
+ def clean_db_game_names
8
+ EivuVideoGameInfo::Models::Game.find_each do |game|
9
+ puts game.id
10
+ game.update_attribute(:slug, EivuVideoGameInfo::Models::Game.slugify_string(game.name))
11
+ end
12
+ end
13
+
14
+ def inspect_library(path_to_roms = '/Users/jinx/eivu/roms')
15
+ timestamp = Time.now.to_f
16
+ log_path = "logs/roms_status_library.#{timestamp}.csv"
17
+ missing_path = "logs/missing_library.#{timestamp}.csv"
18
+ CSV.open(log_path, 'w+') do |log|
19
+ Dir.glob("#{path_to_roms}/**/*").each do |path_to_rom|
20
+ next if path_to_rom.starts_with?('.') || File.directory?(path_to_rom)
21
+
22
+ slug = EivuVideoGameInfo::Models::Game.slugify_rom(path_to_rom)
23
+ game = EivuVideoGameInfo::Models::Game.fetch_rom_info(path_to_rom)
24
+ status = game.nil? ? 'not found' : game.id
25
+ puts "#{status} - #{game&.platform_id}:#{slug} - #{path_to_rom}"
26
+ log << [File.basename(path_to_rom), game&.platform_id, slug, status]
27
+ end
28
+ end
29
+ `cat #{log_path} | grep 'not found' > #{missing_path}`
30
+ `wc -l #{missing_path}`
31
+ end
32
+
33
+ def extract_all(path_to_roms``)
34
+ timestamp = Time.now.to_f
35
+ log_path = "logs/extractision.#{timestamp}.csv"
36
+ file = File.open(log_path, 'w+')
37
+ Dir.glob("#{path_to_roms}/**/*").each do |path_to_rom|
38
+ next unless path_to_rom.ends_with?('.zip') || path_to_rom.ends_with?('.7z')
39
+
40
+ line = `unar -f -o "#{File.dirname(path_to_rom)}" "#{path_to_rom}"`
41
+ print line
42
+ file.write(line)
43
+ end
44
+ file.close
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EivuVideoGameInfo
4
+ VERSION = "1.1.1"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "eivu_video_game_info/version"
4
+
5
+ require 'zeitwerk'
6
+ loader = Zeitwerk::Loader.for_gem
7
+ loader.setup # ready!
8
+
9
+
10
+
11
+ module EivuVideoGameInfo
12
+ class Error < StandardError; end
13
+
14
+ # def self.greeting
15
+ # "Hello from EivuVideoGameInfo!"
16
+ # end
17
+ end
@@ -0,0 +1,4 @@
1
+ module EivuVideoGameInfo
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eivu_video_game_info
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Rob Jenkins
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-03-23 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 6.1.4
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '8.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: 6.1.4
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '8.0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: nokogiri
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '1.17'
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.17.2
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.17'
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 1.17.2
52
+ - !ruby/object:Gem::Dependency
53
+ name: rspec
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: '3.13'
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '3.13'
66
+ - !ruby/object:Gem::Dependency
67
+ name: rubocop
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.57'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.57.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.57'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.57.2
86
+ - !ruby/object:Gem::Dependency
87
+ name: sqlite3
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '2.0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.0.2
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.0'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.0.2
106
+ - !ruby/object:Gem::Dependency
107
+ name: zeitwerk
108
+ requirement: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '2.6'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.6.12
116
+ type: :runtime
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '2.6'
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 2.6.12
126
+ description: |2
127
+ ruby client for parsing data sourced from [https://www.launchbox-app.com/](https://www.launchbox-app.com/)
128
+
129
+ Only Supporting Cartridges for Rom format matching, Disc based system are all .bin, .cue, and .iso.
130
+ Not only impossible to distinguish but is not supported on the browser rom emulator
131
+ email:
132
+ - 384403+dabobert@users.noreply.github.com
133
+ executables: []
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - ".releaserc.json"
138
+ - ".rspec"
139
+ - ".rubocop.yml"
140
+ - CHANGELOG.md
141
+ - CODE_OF_CONDUCT.md
142
+ - LICENSE.txt
143
+ - README.md
144
+ - Rakefile
145
+ - lib/eivu_video_game_info.rb
146
+ - lib/eivu_video_game_info/db/db.sqlite3
147
+ - lib/eivu_video_game_info/loader.rb
148
+ - lib/eivu_video_game_info/models/concerns/active_recordable.rb
149
+ - lib/eivu_video_game_info/models/game.rb
150
+ - lib/eivu_video_game_info/models/platform.rb
151
+ - lib/eivu_video_game_info/models/platform_format.rb
152
+ - lib/eivu_video_game_info/utils.rb
153
+ - lib/eivu_video_game_info/version.rb
154
+ - sig/eivu_video_game_info.rbs
155
+ homepage: https://github.com/eivu/video-game-info-ruby
156
+ licenses:
157
+ - MIT
158
+ metadata:
159
+ homepage_uri: https://github.com/eivu/video-game-info-ruby
160
+ source_code_uri: https://github.com/eivu/video-game-info-ruby
161
+ rubygems_mfa_required: 'true'
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: 3.2.5
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubygems_version: 3.6.6
177
+ specification_version: 4
178
+ summary: Ruby gem to retrieve video game info of video game roms
179
+ test_files: []