-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension support #11
Comments
I don't know. We should figure that our probably. |
Branch: extension |
@xbony2 We should finish up the two extensions we started supporting, because I'd really like to be able to interact with the new Tilesheets API and the upcoming OreDict API. |
@elifoster I don't think we really have to finish this for 2.0.0. We're both waiting on 2.0.0 features that aren't this, and doing this will probably take a long time. |
Yeah I've been thinking this too. It won't break any existing things to add this feature so it should be fine as 2.1 or whatever. |
Just thought of a nice way to automatically handle the loading of extension modules in # ...
get_all_extensions.each do |extension_name|
include MediaWiki::Extensions::Object.const_get(extension_name.delete(' '))
end
# ... or something along those lines. |
@xbony2 For how to enable modules, what do you think about # lib/mediawiki/butt.rb
module MediaWiki
class Butt
...
def enable_extension(ext_module)
if ext_module.include?(MediaWiki::Extensions::ExtensionModule)
extend(ext_module)
else
raise NotAnExtensionModuleError.new(ext_module)
end
end
end
end
# lib/mediawiki/extensions/extension_module.rb
module MediaWiki
module Extensions
class ExtensionModule
end
end
end
# lib/mediawiki/extensions/oredict.rb
require_relative 'extension_module'
module MediaWiki
module Extensions
module OreDict
include MediaWiki::Extensions::ExtensionModule
def get_oredict_whatever_stub; end
end
end
end
# script.rb
require 'mediawiki/butt'
require 'mediawiki/extensions/oredict'
@mw = MediaWiki::Butt.new(...)
@mw.enable_extension(MediaWiki::Extensions::OreDict)
@mw.get_oredict_whatever_stub |
Seems fine to me |
Extensions are now enableable by calling MediaWiki::Butt#enable_extension which takes a single argument, a module which includes the ExtensionModule module. Passing anything that does not include that module will cause an error. This was described last week in #11 issuecomment 553074600.
I think it may be better to split extensions up into their own separate gems, but can still be in this repo. So instead of getting every extension imaginable when you download the gem you only download the ones you actually need. It would also mean all the base gem needs is native support for enabling extensions (which it already has in the extension branch). Extension APIs could be created as we need them and the rest, well if someone needs them they can create them. The basic implementation we have would basically stay the same, except you would need to add the extension to your Gemfile and our dir tree would look like
How this would interact with our docs I'm not sure. |
How are we going to deal with the support of extensions? I'd like to be able to stuff like this.
Eli edit:
Here are all the extensions we should support by the first release including this feature. It was a combined list of all the extensions on FTB, Wikipedia, and MediaWiki. I have removed all extensions (and skins) with no API. Many of the CurseGamepedia extensions have no docs, so I'm not sure if they have APIs or not. I'll ask Alexia when we get to them
The text was updated successfully, but these errors were encountered: