The code in your initializer is just code ... you could get your gem user to go through a set of configuration parameters and make config.gem dependencies only if these parameters are present. one way to do this would be to force them to configure global values in config environemtn for example in config / environment.rb:
CSV_EXPORTS = XML_EXPORTS = true PDF_EXPORTS = false
Then in your own stone you should write:
config.gem 'fastercsv' if defined?(CSV_EXPORTS) config.gem 'nokogiri' if defined?(XML_EXPORTS) if defined?(PDF_EXPORTS) config.gem 'prawn' config.gem 'prawn-layout' end
use "defined?" so if they are not configured at all, the gems will not try to load. It also means that you can use them as you wish.
source share