查看宝石的源代码 [英] Viewing a Gem's Source Code

查看:114
本文介绍了查看宝石的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,Ruby对于生态系统不熟悉的Dabbler / newbie很抱歉,如果这是超级问题之一。



有没有办法查看所有由gem安装的文件和/或源代码?也就是说,我只是跑了

  $ gem install sass 

而sass gem现在是我本地系统的一部分
$ b $

  $ gem list --local 
...
sass(3.1.16,3.1.2)
...

我想知道我的系统上放置了什么 gem install 命令。有没有可以运行的命令来查看gem安装的文件 all

经过一些Google搜寻之后, man gem gem帮助命令,我发现了内容命令。



$ gem contents sass



然而,当我运行此命令前面提到的sass gem,我得到了以下结果:

$ $ $ code $ ... rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / engine_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / functions_test。 rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / extend_test.rb
... /。rvm / gems / ruby-1.9.2-p180 / gems / sass-3.1.16 / test / sass / logger_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1。 16 / test / sass / css2sass_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / conversion_test.rb
。 ../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/script_test.rb
... /。rvm / gems / ruby​​-1.9.2- p180 / gems / sass-3.1.16 / test / sass / util / subset_map_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / util / multibyte_string_scanner_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / callbacks_tes t.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / importer_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / scss / css_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / scss / scss_test.rb
... / .rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / scss / rx_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / util_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / script_conversion_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass- 3.1.16 / test / sass / less_conversion_test.rb
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / cache_test.rb
... / .rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / test / sass / plugin_test.rb
... /。rvm / gems / ruby​​-1.9。 2-p180 / gems / sass-3.1.16 / bin / sass
... / .rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / bin / sass-convert
... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1.16 / bin / scss

然而,这个清单似乎并不完整,因为我知道那里

  ... /。rvm / gems / ruby​​-1.9.2-p180 / gems / sass-3.1中的文件。 2 / lib / 

为什么内容不是显示来自 lib



的文件是否可以为 gem 安装程序在gem文件夹以外安装文件?



是否有可以显示由gem安装的所有内容的命令?

解决方案

gem有一个解压命令: http://guides.rubygems.org/command-reference/#gem-unpack

  gem unpack rake 
ls rake-0.4.3 /


Ruby dabbler/newbie here who's not familiar with the ecosystem, so apologies if this is one of those super duh questions.

Is there a way to view all the files and/or source code installed by a gem? That is, I just ran

$ gem install sass

And the sass gem is now a part of my local system

$ gem list --local
...
sass (3.1.16, 3.1.2)
...

I want to know what the gem install command put on my system. Is there a command I can run to see all the files installed by the gem?

After some googling, man gem and gem help commands, I discovered the contents command.

$ gem contents sass

However, when I run this command with the aforementioned sass gem, I get the following results

.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/engine_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/functions_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/extend_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/logger_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/css2sass_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/conversion_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/script_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/util/subset_map_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/util/multibyte_string_scanner_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/callbacks_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/importer_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/scss/css_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/scss/scss_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/scss/rx_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/util_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/script_conversion_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/less_conversion_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/cache_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/test/sass/plugin_test.rb
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/bin/sass
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/bin/sass-convert
.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.16/bin/scss

However, this list seems incomplete as I know there are files in

.../.rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.2/lib/

Why does contents not show the files from lib?

Is it possible for a gem installer to install files outside of the gems folder?

Is there a command that can show everything installed by a gem?

解决方案

gem has an unpack command: http://guides.rubygems.org/command-reference/#gem-unpack

gem unpack rake
ls rake-0.4.3/

这篇关于查看宝石的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆