Forking a gem for a Rails project

后端 未结 2 845
谎友^
谎友^ 2020-12-07 09:46

I\'ve found myself twice in this situation: I install a gem on my system and start using it from my Rails project. Eventually I need to make some changes to that gem. How sh

2条回答
  •  忘掉有多难
    2020-12-07 10:31

    In all the cases the gems were at github so I would probably for it at github, clone it, make my chances and maintain my own branch. I suppose then I would install that branch directly with gem install on my server.

    If you really need to hack the actual gem source then yes, that would be the way to do it. However, it should be a last resort. You don't want to maintain the actual gem if you don't have to. Why not extend classes from the gem source whose functionality you need to change and use your classes instead of the gem classes in your Rails code?

    I find it rare that you actually need to hack 3rd party code directly to do what you need to do. Good software can be extended/easily augmented.

提交回复
热议问题