开发者

How to Look at a Gem's Code

开发者 https://www.devze.com 2023-03-10 04:53 出处:网络
I have a Gem that I found at RubyForge and want to peek inside to see what code it contains. Is it possible to do this without installing the Gem on my system?

I have a Gem that I found at RubyForge and want to peek inside to see what code it contains. Is it possible to do this without installing the Gem on my system?

Also,开发者_如何学运维 if I use RVM on Mac OS X, does that at all change how my gems get installed (assuming I have one gemset)?


gem unpack unpacks the gem without installing it.


Gems on RubyGems usually have a link to the source code (most often on GitHub), in which case you can easily browse the code (I use this A LOT).

The "homepage" link also tends to link to the repository.

If all else fails, go to GitHub and search for the name of the gem (you may need to match up the authors to ensure it's the right repository for the gem).

Edit:

Just noticed that you asked about gems on Rubyforge. In which case my first step would be to check RubyGems. But otherwise you will need to download the gem and peek inside it (it's just a compressed archive so you can open it up in something like 7-zip).


Many gems have their source freely readable. The way that always works is to install it.

If you just want to browse the source; go to the gem on http://rubygems.org find your gem and use the "Source code" link.

In case of RubyForge you can find the links under the SCM link in the menu.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号