手机
当前位置:查字典教程网 >脚本专栏 >ruby专题 >源代码快速定位工具-qwandry使用指南
源代码快速定位工具-qwandry使用指南
摘要:GitHub地址:https://github.com/adamsanderson/qwandryqwandry能快速定位到我们需要找到库文...

GitHub地址:https://github.com/adamsanderson/qwandry

qwandry 能快速定位到我们需要找到 库文件, 项目 的工具。

Ruby中实现快速定位的方法有好多种,我知道的有三个:

cd `bundle show active_record`

通过tag方法(tag 定位更精确,可以定位到方法级别)

或者通过 qwandry

安装

gem install qwandry

使用

qw matrix # opens ruby's matrix class in your editor qw rails # will ask you which version of rails you want to open qw activerec 3.1 # will find the gem activerecord 3.1 and open it You can also use Qwandry with other common languages: qw -r python numpy # opens python's numpy library qw -r perl URI # open perl's URI library qw -r node express # open express if it is installed for node

指定编辑器打开

EDITOR=subl qw activerecord 3.2.14

如何自定义?

touch ~/.qwandry/init.rb

然后copy如下内容到文件中

register 'projects' do add 'your project path' end default :ruby, :gem, :projects

解释

register 方法是 将指定的目录打包

add 将目录加入到搜索中

default 是设置默认的搜索范围

实现的基本原理

通过配置 config 将很多目录打包成 Package, 然后将 Package 打包成 Repository(仓库)

初始化一个Launcher(有Editor等)

根据输入的名称找到对应的Repository中的package(实际上是一个目录地址)

执行系统命令: editor(vim) path

【源代码快速定位工具-qwandry使用指南】相关文章:

Ruby定义私有方法(private)的两种办法

ruby will_paginate的用法

深入讲解Ruby中Block代码快的用法

优化Ruby代码使程序运行速度提高的例子

浅析Ruby的源代码布局及其编程风格

Ruby中XML格式数据处理库REXML的使用方法指南

Ruby中一些常用的文件操作方法小结

Ruby on Rails框架程序连接MongoDB的教程

编写Ruby代码注释时需要注意的一些问题

浅析Ruby中的Profiling工具的用法

精品推荐
分类导航