-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Muriel-Salvan/add_mo_menu
[#13] [Feature] Add a new ModOrganizer menu listing mods and running ModOrganizer
- Loading branch information
Showing
12 changed files
with
564 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#!/usr/bin/env ruby | ||
# require 'mod_organizer' | ||
require 'English' | ||
require 'modsvaskr/config' | ||
require 'modsvaskr/ui' | ||
|
||
begin | ||
Modsvaskr::Ui.new(config: Modsvaskr::Config.new('./modsvaskr.yaml')).run | ||
rescue | ||
puts "An exception has occurred: #{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}" | ||
puts 'Press Enter to exit.' | ||
$stdin.gets | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module ModsvaskrTest | ||
|
||
module MockedModOrganizer | ||
|
||
class Download | ||
|
||
attr_reader :downloaded_file_path, :downloaded_date, :nexus_file_name, :nexus_mod_id, :nexus_file_id | ||
|
||
# Constructor | ||
# | ||
# Parameters:: | ||
# * *downloaded_file_path* (String or nil): Full downloaded file path, or nil if does not exist [default: nil] | ||
# * *downloaded_date* (Time or nil): Download date of this source, or nil if no file [default: Time.now] | ||
# * *nexus_file_name* (String): Original file name from NexusMods [default: 'nexus_mods_file.7z'] | ||
# * *nexus_mod_id* (Integer): Mod ID from NexusMods [default: 42] | ||
# * *nexus_file_id* (Integer): File ID from NexusMods [default: 666] | ||
def initialize( | ||
downloaded_file_path: nil, | ||
downloaded_date: Time.now, | ||
nexus_file_name: 'nexus_mods_file.7z', | ||
nexus_mod_id: 42, | ||
nexus_file_id: 666 | ||
) | ||
@downloaded_file_path = downloaded_file_path | ||
@downloaded_date = downloaded_date | ||
@nexus_file_name = nexus_file_name | ||
@nexus_mod_id = nexus_mod_id | ||
@nexus_file_id = nexus_file_id | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'modsvaskr_test/mocked_mod_organizer/source' | ||
|
||
module ModsvaskrTest | ||
|
||
module MockedModOrganizer | ||
|
||
class Mod | ||
|
||
attr_reader :categories, :plugins, :url | ||
|
||
# Constructor | ||
# | ||
# Parameters:: | ||
# * *enabled* (Boolean): Is the mod enabled? [default: true] | ||
# * *categories* (Array<String>): List of this mod's categories [default: []] | ||
# * *plugins* (Array<String>): List of this mod's plugins [default: []] | ||
# * *sources* (Array< Hash<Symbol,Object> >): List of this mod's sources [default: []] | ||
# * *url* (String): This mod's URL [default: 'https://my_test_mod.com'] | ||
def initialize(enabled: true, categories: [], plugins: [], sources: [], url: 'https://my_test_mod.com') | ||
@enabled = enabled | ||
@categories = categories | ||
@plugins = plugins | ||
@sources = sources | ||
@url = url | ||
end | ||
|
||
# Is the mod enabled? | ||
# | ||
# Result:: | ||
# * Boolean: Is the mod enabled? | ||
def enabled? | ||
@enabled | ||
end | ||
|
||
# Return the list of sources this mod belongs to | ||
# | ||
# Result:: | ||
# * Array<MockedSource>: List of source information | ||
def sources | ||
@sources.map { |source| Source.new(**source) } | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require 'modsvaskr_test/mocked_mod_organizer/mod' | ||
|
||
module ModsvaskrTest | ||
|
||
module MockedModOrganizer | ||
|
||
class ModOrganizer | ||
|
||
attr_reader :run_called, :mods_list | ||
|
||
# Constructor | ||
# | ||
# Parameters:: | ||
# * *mods* (Hash<String, Hash<Symbol,Object>>): List of mods to mock, per mod name [default: {}] | ||
# * *enabled* (Boolean): Is the mod enabled? [default: true] | ||
# * *categories* (Array<String>): List of this mod's categories [default: []] | ||
# * *plugins* (Array<String>): List of this mod's plugins [default: []] | ||
# * *sources* (Array< Hash<Symbol,Object> >): List of this mod's sources [default: []] | ||
# * *mods_list* (Array<String>): The ordered list of mod names [default: mods.keys] | ||
# * *categories* (Hash<Integer, String>): Categories to return, or nil for default (built from mods' categories) [default: nil] | ||
def initialize( | ||
mods: {}, | ||
mods_list: mods.keys | ||
) | ||
@mods = mods | ||
@mods_list = mods_list | ||
@run_called = false | ||
end | ||
|
||
# Return mod_names | ||
# | ||
# Result:: | ||
# * Array<String>: Mod names | ||
def mod_names | ||
@mods.keys | ||
end | ||
|
||
# Return a mod of a given name | ||
# | ||
# Parameters:: | ||
# * *name* (String): Mod namd | ||
# Result:: | ||
# * MockedMod: The mocked mod | ||
def mod(name:) | ||
Mod.new(**@mods[name]) | ||
end | ||
|
||
# Run ModOrganizer | ||
def run | ||
@run_called = true | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
Oops, something went wrong.