Conditionally require gems in Gemfile based on Rails or Sinatra framework? -
I am writing a gem which can be used with both sinatra and rail, however, gem dependency is different The framework on which the developer is using the gem.
If this is a rail app, then we need 'saas-rail' and 'coffee-rail'. If it is a seam app, then we need 'asus' and' coffee-scripts. '
Ideally the bundler will install only the necessary gems on which this gem is being loaded, but I do not seem to understand how to specify conditional reliance.
Suggestions will be highly appreciated.
I would suggest you not do this. This hack will be unbelievable.
What you can do though is division and win! Make a generic version of your gem, which is an agnostic and handles only logic, let's call it yourgem-core
, you can make two other gems on the basis of that first, Which is yourgem-rail
and yourgems-sinatra
.
It is much better, only logic and logic test in yourgem-core
, only rail integration testing yourgem-rails
, yourgem-sinatra Only Sinatra integration test in
Comments
Post a Comment