I have been working on a heavily simplified plugin interface so its a lot easier for people to get started with extending Discourse.
For example:
Say you wanted to extend Discourse and add Ubuntu SSO to the dialog.
Place a file called plugin.rb
in the directory plugins/ubuntu_sso
###plugins/ubuntu_sso/plugin.rb
# name: discourse-ubuntu
# about: ubuntu login support for Discourse
# version: 0.1
# authors: Sam Saffron, Marco Ceppi
auth_provider :title => 'with Ubuntu',
:authenticator => Auth::OpenIdAuthenticator.new('ubuntu','https://login.ubuntu.com', trusted: true),
:message => 'Authenticating with Ubuntu (make sure pop up blockers are not enbaled)',
:frame_width => 1000, # the frame size used for the pop up window, overrides default
:frame_height => 800
register_css <<CSS
.btn-social.ubuntu {
background: #dd4814;
}
.btn-social.ubuntu:before {
font-family: Ubuntu;
content: "U";
}
CSS
Run bundle exec rake assets:precompile
Restart you services.
Done, you have working Ubuntu SSO.
This interface is still not complete, as I finalize it I will be adding more examples here.
The /plugins
directory is ignored by git so you can place your extensions there safely.
Longer term plans
- Possibly use a Rails::Engine for greater flexibility
- More hooks
- Admin UI to enable or disable plugins (with multisite support)
- Central plugin repo
- External gem dependencies
If you are interested in extending the interface etc, let me know.
cc @marcoceppi