【问题标题】:How to open a gem source code with bundler in vim editor如何在 vim 编辑器中使用 bundler 打开 gem 源代码
【发布时间】:2014-03-08 19:17:12
【问题描述】:

尝试使用bundle open 命令打开gem 源代码,according to official documentation and instruction

所以,我在exported 编辑器中这样.profile

export BUNDLER_EDITOR=vi
export EDITOR=vi 

并尝试打开例如rails源码使用控制台:

bundle open rails 

并得到错误Could not locale Gemfile

[ruby-2.1.1] 
[~/]
 $: rails -v 
Rails 4.0.3
[ruby-2.1.1] 
[~/]
 $: bundle -v 
Bundler version 1.5.3
[ruby-2.1.1] 
[~/]
 $: bundle open rails 
Could not locate Gemfile
[ruby-2.1.1] 
[~/]
 $: 

此步骤中缺少什么?如何使用 bundler 打开 rails 源代码。

【问题讨论】:

  • 从具有包含该 gem 的 Gemfile 的目录运行 bundle open ...

标签: ruby-on-rails ruby bundler


【解决方案1】:

在包含 Gemfile 的目录中执行此操作:

vim `bundle show GEM_NAME`

【讨论】:

    【解决方案2】:

    最好在.bash_profile 中设置首选编辑器 然后就用bundle open GEMNAME

      export EDITOR=/usr/bin/vim    # OR /usr/local/bin/subl
      bundle open whatever_gem
    

    【讨论】:

      【解决方案3】:

      有一个名为qwandry 的宝石。有了这个你可以运行

      qw qwandry
      

      在编辑器中打开 qwandry 源代码(也可以使用 -e 参数进行配置)。它还知道如何加载 python、perl 和 node 包。

      【讨论】:

        【解决方案4】:

        使用 bundler 你需要一个 Gemfile 来管理你的 gem。

        您可以尝试使用其他 gem 来执行此操作:

        https://github.com/adamsanderson/open_gem

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-09-29
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多