问题
I am trying to install eventmachine
Gem, however a line needs to be commented out in the source for this to work on Ruby 2.0 on Windows x64.
I have tried modifying the Gem source in the Ruby build folder but each time I run gem install eventmachine
it overwrites my changes. From the command line help there does not appear to be a way to rebuild the gem without unpacking fresh source, however there may be a workaround.
Is there a way to build my slightly tweaked source for this Gem?
回答1:
Don't install the gem like that. Instead, build your own version and install that instead by specifying the path to the .gem
file that is produced as part of the build process.
I've found the easiest way to get this right is to create a fork, set the fork's git
path in your Gemfile
, and bundle install
which will take care of compiling things and installing them correctly.
回答2:
Ok figured it out thanks to help from @tadman.
Ended up just installing locally from source rather than tweaking the official source downloaded by gem
and preventing it from being overwritten. These are the exact steps ...
- Clone locally from Github (or wherever)
- Make your changes to the source
- If there is a
.gemspec
file in the root directory- Open terminal in the directory and enter
gem build GEMNAME.gemspec
- Finally enter
gem install GEMNAME-VERSION.gem
- Open terminal in the directory and enter
- If there is not
.gemspec
but there is a file called "gem" or "build" or something similar , then you may have to build usingrake
according to this reply
来源:https://stackoverflow.com/questions/16310793/how-to-avoid-the-source-being-overwritten-when-compiling-a-gem