[katello-devel] katello install discovering rails engines

Ohad Levy ohadlevy at redhat.com
Thu Apr 11 07:38:14 UTC 2013



----- Original Message -----
| Ivan,
| 
| Have you done anything in foreman along the lines of loading additional rails
| engines after rpm-install of foreman?
| 
| What I wrote today [1] is to have katello perform two additional steps at
| startup:
| 1) Load Engines.in, a file equivalent to Gemfile.in, where engine gems would
| be listed for loading by bundler_ext
| 2) Load engine_routes.rb from routes.rb to mount the engines (eg. mount
| SomeEngine::Engine => '/mypath')

IMHO you should not use mountable engines within katello and foreman.
mountable engines mean that its a rails engine that can be used within different rails app, I dont think this is the target case here.

instead, you should use full engines, that simply extend the app.

you can find an example of an engine that i played with at [1]

Ohad

[1] - https://github.com/ohadlevy/stacker/tree/engine
| 
| Has foreman already done something similar?
| 
| Thanks!
| Tom
| 
| 
| 
| [1] https://github.com/thomasmckay/katello/compare/engine-load
| 
| diff --git a/src/config/application.rb b/src/config/application.rb
| index c9db60f..db157d5 100644
| --- a/src/config/application.rb
| +++ b/src/config/application.rb
| @@ -22,6 +22,10 @@
|    require 'bundler_ext'
|    BundlerExt.system_require(File.expand_path('../../Gemfile.in', __FILE__),
|    :all)
|  
| +  if File.exist?(File.expand_path('../../Engines.in', __FILE__))
| +    BundlerExt.system_require(File.expand_path('../../Engines.in',
| __FILE__), :all)
| +  end
| +
|    # Webmock rubygem have very strong default setting - it blocks all HTTP
|    connections
|    # after it is required. Therefore we want to turn off this behavior for
|    all environments
|    # except test since with bundler_ext we load ALL groups by default.
| diff --git a/src/config/routes.rb b/src/config/routes.rb
| index 2784db6..fb923c7 100644
| --- a/src/config/routes.rb
| +++ b/src/config/routes.rb
| @@ -820,6 +820,9 @@ def matches?(request)
|  
|    match 'about', :to => "application_info#about", :as => "about"
|  
| +  # Load engines
| +  require File.expand_path('../engine_routes.rb', __FILE__) if
| File.exist?(File.expand_path('../engine_routes.rb', __FILE__))
| +
|    #Last route in routes.rb - throws routing error for everything not handled
|    match '*a', :to => 'errors#routing'
| 
| _______________________________________________
| katello-devel mailing list
| katello-devel at redhat.com
| https://www.redhat.com/mailman/listinfo/katello-devel
| 




More information about the katello-devel mailing list