如何在vim编辑器中使用bundler打开gem源代码

时间:2021-02-15 00:19:09

Trying to open a gem source code with bundle open command, according to official documentation and instruction.

根据官方文档和说明,尝试使用bundle open命令打开gem源代码。

So, I exported editor like this in .profile:

所以,我在.profile中导出了这样的编辑器:

export BUNDLER_EDITOR=vi
export EDITOR=vi 

And try to open e.g. rails source code using console:

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

bundle open rails 

and getting error Could not locale Gemfile

并获得错误无法定位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] 
[~/]
 $: 

What is missing in this steps ? How do open rails source code using bundler.

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

4 个解决方案

#1


1  

There's a gem called qwandry. With this you can run

有一种名为qwandry的宝石。有了它,你可以运行

qw qwandry

to open up the qwandry source code in your editor (also configurable with the -e parameter). It also knows how to load up python, perl and node packages.

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

#2


15  

Do this from within a directory that contains a Gemfile:

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

vim `bundle show GEM_NAME`

#3


3  

It's probably better to set your preferred editor in your .bash_profile and then just use bundle open GEMNAME

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

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

#4


0  

Using bundler you need a Gemfile to manage your gems.

使用bundler,你需要一个Gemfile来管理你的宝石。

You can try to use this other gem to do this:

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

https://github.com/adamsanderson/open_gem

https://github.com/adamsanderson/open_gem

#1


1  

There's a gem called qwandry. With this you can run

有一种名为qwandry的宝石。有了它,你可以运行

qw qwandry

to open up the qwandry source code in your editor (also configurable with the -e parameter). It also knows how to load up python, perl and node packages.

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

#2


15  

Do this from within a directory that contains a Gemfile:

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

vim `bundle show GEM_NAME`

#3


3  

It's probably better to set your preferred editor in your .bash_profile and then just use bundle open GEMNAME

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

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

#4


0  

Using bundler you need a Gemfile to manage your gems.

使用bundler,你需要一个Gemfile来管理你的宝石。

You can try to use this other gem to do this:

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

https://github.com/adamsanderson/open_gem

https://github.com/adamsanderson/open_gem