For a project I used the gem 'event_calendar'. However, there were a
couple things I had to manually change within the gem source to suit my
needs.
How would I go about to deploy this in production 'the rails way'? Right
now I have just replaced the sourcecode of the gem installed on my
production environment. This is ofcourse unmanageble over time if I ever
have to reinstall (bundle install) on a new production environment
The best is to get your patches merged by upstream. Of course, this
might ask rework of your local changes. Once merged, you will have less
maintenance work and others might benefit from your changes.
If it's really not possible (which I tend to not believe), the way to
maintain and deploy your own gems depends on the number of systems where
you have to deploy it.
If you're using bundler (which you should be), then you can:
1) Fork the gem and checkout that fork
2) Make your modifications to your fork (include tests if possible)
and push back to origin.
3) Update bundler to pull from your forked repository instead of
rubygems for that particular gem:
This way you have an authoritative version of your changes to the gem
on github that your project can answer, and you can use the power of
git to merge in upstream changes, etc. as you go along. And if it
makes sense you can make a Pull Request so you no longer need to
maintain the code.
A side note, since your fork is public if you want to do more local
integration testing in #2 before pushing it back to origin you can
point bundler at a local git repository too:
For a project I used the gem 'event_calendar'. However, there were a
couple things I had to manually change within the gem source to suit my
needs.
How would I go about to deploy this in production 'the rails way'?
A few choices:
* Vendorize it
* Package your own gem from the altered code
* Monkey-patch the gem in your lib folder
There's probably more options.
Thanks for all the replies. I decided to go with vendorizing the gem,
since the changes were so application specific I did not want to deploy
the modified gem apart from the application.
Running into the following problem now though. Whenever I load the model
that uses some of the gem functionality, I get this error:
NoMethodError: undefined method `has_event_calendar' for
#<Class:0x45e2308>
The line in the gemfile reads:
gem 'event-calendar', :require => 'event_calendar', :path =>
'vendor/gems/event-calendar-2.3.3'
When I go into the console, I do seem to have access to the gem's
namespace (for example, EventCalendar module is known)