Content
PLUGIN GENERATOR - some advice for generating OmniAuth
Added by art vanderhoff about 10 years ago
Hello,
I have installed V4.0 and want to use the OmniAuth plugin. I hada look for v4.0 specific instructions but could not find any. I did however find the following older link
https://github.com/opf/openproject-auth_plugins
This contains the instruction
" The first step is to generate a new plugin."
I could not find a direct link but again found a page
https://community.openproject.org/news/26-openproject-plugin-generaor-released
This page contains the following instruction
Writing a new OpenProject plugin is now as easy as: bundle exec rails generate open_project:plugin <plugin name> <target folder> Just include gem "openproject-plugins", "~> 1.0.2"
Can someone give me some details on what <plugin name> <target folder>
means. IE is the target folder a sub folder of the openproject folder etc or in one of the folders below.
Then the second part…Just include in
When I search for engine.rb, I get the following list
/home/user/.gem/ruby/2.0/bundler/gems/sass-rails-0393d9e1a6e4/test/fixtures/engine_project/lib/engine_project/engine.rb /home/user/.gem/ruby/2.0/gems/arel-3.0.3/lib/arel/sql/engine.rb /home/user/.gem/ruby/2.0/gems/i18n-js-3.0.0.rc6/lib/i18n/js/engine.rb /home/user/.gem/ruby/2.0/gems/rabl-0.9.3/lib/rabl/engine.rb /home/user/.gem/ruby/2.0/gems/yard-0.8.7.2/lib/yard/templates/engine.rb /home/user/.gem/ruby/2.0/gems/livingstyleguide-1.2.0/lib/livingstyleguide/engine.rb /home/user/.gem/ruby/2.0/gems/bourbon-4.0.0/lib/bourbon/engine.rb /home/user/.gem/ruby/2.0/gems/sass-3.3.14/lib/sass/engine.rb /home/user/.gem/ruby/2.0/gems/erubis-2.7.0/lib/erubis/engine.rb /home/user/.gem/ruby/2.0/gems/railties-3.2.19/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb /home/user/.gem/ruby/2.0/gems/railties-3.2.19/lib/rails/engine.rb
Any advice or a link to getting OmniAuth up and running would be very much appreciated.
Thx
Art
Replies (2)
Hey Art,
sorry for the the late reply but here it goes:
When you generate a plugin (you need the OpenProject core for that) in will create the
engine.rb
for you.The output of the last command will be something like the following:
So here I just created the plugin in a subfolder of OpenProject. It doesn’t really matter where you put it, though.
Also, don’t ask me why but you have to have your
config/database.yml
configured with a valid connection for the plugin generator to work …Anyway, the
engine.rb
you are looking for now is in./plugins/openproject-my_auth_plugin/lib/open_project/my_auth_plugin/engine.rb
For more infos about this topic you may refer to the OmniAuth auth plugin guide “[1]”:https://community.openproject.org/projects/openproject/wiki/Developing_an_OmniAuth_Authentication_Plugin or have a look at a very simple example plugin “[2]”:https://github.com/machisuji/openproject-mock_auth I wrote.
Hope I could help a little!
If you have any further questions, don’t hesitate to ask.
~ Markus
[1] https://community.openproject.org/projects/openproject/wiki/Developing_an_OmniAuth_Authentication_Plugin
[2] https://github.com/machisuji/openproject-mock_auth
Thanks for the detailed post Markus, I am working through your steps.
Can you also point me to any tutorials on how to include html/php apps within that plugin. For example I have a php app on the same web server and would like to include that in a plugin, ;looking like this
should also be available from
thanks
Art