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

本文是小编为大家收集整理的关于查看宝石的源代码的处理方法,想解了查看宝石的源代码的问题怎么解决?查看宝石的源代码问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

这里不熟悉生态系统的 Ruby 涉猎者/新手,如果这是那些超级无聊的问题之一,我们深表歉意.

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

$ gem install sass

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

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

我想知道 gem install 命令在我的系统上放置了什么.我可以运行一个命令来查看 gem 安装的 all 文件吗?

经过一番谷歌搜索,man gem 和 gem help commands,我发现了 contents 命令.

$ gem 内容 sass

然而,当我使用上述 sass gem 运行此命令时,我得到以下结果

.../.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

但是,这个列表似乎不完整,因为我知道有文件在

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

为什么 contents 不显示来自 lib 的文件?

gem 安装程序是否可以在 gems 文件夹之外安装文件?

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

推荐答案

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

gem unpack rake
ls rake-0.4.3/

本文地址:https://www.itbaoku.cn/post/786403.html