简体   繁体   中英

How to modify an installed gem on Windows?

So I've installed svn2git using Ruby on Windows. Unfortunately, since git has made the change of Master branch to Main, this has broken the script. I've found the script in

C:\Ruby27-x64\lib\ruby\gems\2.7.0\gems\svn2git-2.4.0

and made the required modifications. How do I recompile / remake this so that when I run svn2git on the command line it uses my modified script?

since git has made the change of Master branch to Main, this has broken the script

I'm not sure what you mean by "broken"; perhaps you needed to rename master --> main here ? (Or even better, you could make it somehow configurable , not hardcoded?)

How do I recompile / remake

This is ruby. It's an interpreted language; you don't need to compile anything.

It would be "bad practice" to edit the gem directly on your machine, but this should still work . If you run svn2git on the command line right now, then - assuming that's the correct installation (eg you don't also have a ruby 2.6 version installed that's getting picked up?!), it should run your modified code instead.


But for a "better" long-term solution, it would be advisable to fork the project , make your change, and install your own version of the project.

You could also open a pull request with your change, in case the original author is still active and willing to release an update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM