Coder Social home page Coder Social logo

adamsanderson / qwandry Goto Github PK

View Code? Open in Web Editor NEW
332.0 5.0 13.0 218 KB

Qwandry gives you a single way to easily open all your projects and libraries.

Home Page: http://endofline.wordpress.com/2010/12/30/qwandry-0-1-0-now-supporting-more-languages/

Ruby 100.00%

qwandry's Introduction

Qwandry, a questionable tool

Why spend time trying to remember where libraries, projects, and packages are lurking when your computer can do it faster?

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

Installation

Qwandry is a standard ruby gem, on any system with ruby installed already simply install with:

gem install qwandry

Usage

Just type qw and the first few letters of what you're looking for. By default Qwandry is set up for locating and editing ruby libraries.

qw date # opens ruby's date library

Want to use Qwandry with Python, Perl, or other languages?

qw --customize 

Editor Selection

Qwandry uses environment variables to launch your configured editor. The following env variables are checked, in this order. The first value found is used.

QWANDRY_EDITOR
VISUAL
EDITOR

Setting QWANDRY_EDITOR allows you to specify an editor to be used with Qwandry only.

Contact

Adam Sanderson, [email protected]

Issues and Source: https://github.com/adamsanderson/qwandry

qwandry's People

Contributors

adamsanderson avatar bradland avatar bwiklund avatar coffeejunk avatar jaylevitt avatar krohrbaugh avatar ricktessner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

qwandry's Issues

Error: can't convert nil into String

This looks pretty cool, but I installed the gem and I'm getting nothing but the following error, no matter what I do:

    $ qw qw  
    /Library/Ruby/Gems/1.8/gems/qwandry-0.0.1/bin/../lib/qwandry/launcher.rb:67:in `system': can't convert nil into String (TypeError)  
        from /Library/Ruby/Gems/1.8/gems/qwandry-0.0.1/bin/../lib/qwandry/launcher.rb:67:in `launch'
        from /Library/Ruby/Gems/1.8/gems/qwandry-0.0.1/bin/qw:87
        from /usr/bin/qw:19:in `load'
        from /usr/bin/qw:19

This is on a MacBook Pro. Thanks.

Subcommand to just show the location of a package

Hi,

I use bundle show a lot to find a gem's location (so I can subsequently cd into it and grep). It'd nice to be able to do the same in qwandry.

qw show some_gem
# Prints the gem's location

Let me know if this is acceptable, I'll try sending a PR. Thanks.

executable name does not match gem name

I install the qwadry gem and expect to run the qwandry command, only to be surprised that it does not exist. Please rename the qw executable to qwandry (shortform names like qw are really meant to be personal shell aliases IMHO) or rename this project to qw so that there's no confusion for new users. Thanks for your consideration.

can this app be performed on windows?

i got this error

c:/Ruby200/lib/ruby/gems/2.0.0/gems/qwandry-0.1.5/lib/qwandry/configuration.rb:8
7:in `block in repositories': Unknown Repository type 'gem' (ArgumentError)
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/qwandry-0.1.5/lib/qwandry/confi
guration.rb:85:in `each'
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/qwandry-0.1.5/lib/qwandry/confi
guration.rb:85:in `repositories'
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/qwandry-0.1.5/lib/qwandry/launc
her.rb:16:in `find'
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/qwandry-0.1.5/bin/qw:70:in `<to
p (required)>'
        from c:/Ruby200/bin/qw:23:in `load'
        from c:/Ruby200/bin/qw:23:in `<main>'

Customization Documentation

Is there any documentation about customization? If no, please make some. I use a special library manager for Ruby during development. It would super cool to tie qw into it.

Thanks.

Error: require.paths is removed.

In node.js 0.6.x the require.paths has been removed.

$ qw -r node express

Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
    at Function.Object.defineProperty.get (module.js:388:11)
    at Object.<anonymous> (/home/m/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/qwandry-0.1.5/lib/qwandry/configuration/probe_node.js:4:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3
No packages matched 'express'
$ node --version
v0.10.21

Differentiate multiple similar matches

For instance if both ruby and python were being searched, and both had a 'math' library. The user should see something like:

  1. math (ruby)
  2. math (python)

Make repository searching case insensitive

Perl has modules like WWW, it would probably be preferable to be able to do qw www. This could either always be the case (probably fine) or it could be a repository option like the file accept/reject options.

TypeError Exception when no editor is set

Hi Adam

I got this issue when i try 'qw'.

 qwandry-0.0.1/lib/qwandry/launcher.rb:67:in `system': can't convert nil into String (TypeError)

the reason could be because I haven't set any environment variables with my editor informations.

cheers

zastav

Doesn't Seem to Do Anything

I installed qwandry, and when executing any qw commands, I simply am returned to my command prompt without anything being opened in Textmate. What other information can I provide to help figure out what is going wrong? I'm using Ruby 1.9.3-p194 via RVM. It looks like qwandry version 0.1.4 is installed. See below:

[-ruby-1.9.3-p194] master $ gem install qwandry
Fetching: qwandry-0.1.4.gem (100%)
Successfully installed qwandry-0.1.4
1 gem installed
[-ruby-1.9.3-p194] master $ qw rails
[-ruby-1.9.3-p194] master $ qw matrix
[-ruby-1.9.3-p194] master $ echo $EDITOR
/usr/local/bin/mate

Add support for auto discovering node.js libraries

We have nice 1 liners for grabbing perl and python's load paths. It looks like they are available in require.paths

> SnappySalmon:qwandry adam$ node
> require.paths
[ '/Users/adam/.node_libraries'
, '/usr/local/Cellar/node/0.2.5/lib/node'
]

Can't convert Hash into String

$ qw date
Warning: error in configuration file: "/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration/default.rb"
Exception: can't convert Hash into String
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:26:in system' /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:26:inpresent?'
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:21:in register_if_present' /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration/default.rb:12:inload_configuration'
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:68:in eval' /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:53:inload_configuration'
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:68:in load_configuration_files' /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:67:ineach'
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/../lib/qwandry/configuration.rb:67:in load_configuration_files' /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/gems/qwandry-0.1.2/bin/qw:11 /Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/bin/qw:19:inload'
/Users/ScottMessinger/.rvm/gems/ree-1.8.7-2010.02@mongocc/bin/qw:19
No packages matched 'date'

Any ideas what's going on?

editor

vi complain "~/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/date" is a directory when I try "qw date -e vi"

Should QW `cd` into target directory before opening editor

Using Vim, the correct directory is opened, but the current working directory (cwd) is not changed, which means things like NERDTree and Ack/Grep work in the context of the old cwd and not the directory of the target gem.

Thanks!

More natural matching for sub directories

Right now if you want to open net/http you have to do qw net, and you get all of net. Perhaps Qwandry could be a bit smarter about it and match net and open the sub directory.

Support opening specific files / subdirectories from libraries

Just found this awesome tool, but was disappointed that it only seems to support opening the root folder of a given library (unless I'm missing something). It would be great to be able to also specify files or subdirectories inside a library.

Let's take the class Rake::Task as an example, this would be specified on the command line as rake/task, and qwandry could then try to find the file as follows:

input = 'rake/task'

begin
  require input
  $".grep(/#{input}/)[0] # -> /usr/lib/ruby/2.0.0/rake/task.rb on my system
rescue LoadError
  nil
end

If this doesn't return a file, the part after the slash could be treated as a directory path and appended to the library location, so e.g. rake/ext would open the folder /usr/lib/ruby/2.0.0/rake/ext.

I'd be happy to submit this as a pull request if you can give me some pointers where this should be implemented (possibly as a new type of repository?).

Unknown Repository type 'gem' (ArgumentError) in rubinius 1.2.1dev

$> rvm info

rbx-head:

system:
uname:       "Linux maynard 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 2010 x86_64 GNU/Linux"
bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
rvm:
version:      "rvm 1.1.6 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]"

ruby:
interpreter:  "rubinius"
version:      "1.2.1dev"
date:         "rubinius 1.2.1dev (1.8.7 6208c85b 2010-12-21 JI) [x86_64-unknown-linux-gnu]"
platform:     "x86_64-unknown-linux-gnu"
patchlevel:   "1.8.7 6208c85b 2010-12-21 JI"
full_version: "rubinius 1.2.1dev (1.8.7 6208c85b 2010-12-21 JI) [x86_64-unknown-linux-gnu]"

homes:
gem:          "/home/jesse/.rvm/gems/rbx-head"
ruby:         "/home/jesse/.rvm/rubies/rbx-head"

binaries:
ruby:         "/home/jesse/.rvm/rubies/rbx-head/bin/ruby"
irb:          "/home/jesse/.rvm/rubies/rbx-head/bin/irb"
gem:          "/home/jesse/.rvm/rubies/rbx-head/bin/gem"
rake:         "/home/jesse/.rvm/gems/rbx-head/bin/rake"

environment:
PATH:         "/home/jesse/.rvm/gems/rbx-head/bin:/home/jesse/.rvm/gems/rbx-head@global/bin:/home/jesse/.rvm/rubies/rbx-head/bin:/home/jesse/.rvm/bin:/home/jesse/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME:     "/home/jesse/.rvm/gems/rbx-head"
GEM_PATH:     "/home/jesse/.rvm/gems/rbx-head:/home/jesse/.rvm/gems/rbx-head@global"
MY_RUBY_HOME: "/home/jesse/.rvm/rubies/rbx-head"
IRBRC:        "/home/jesse/.rvm/rubies/rbx-head/.irbrc"
RUBYOPT:      ""
gemset:       ""

$> qw timeout
An exception occurred running /home/jesse/.rvm/gems/rbx-head/bin/qw
Unknown Repository type 'gem' (ArgumentError)

Backtrace:
{ } in Qwandry::Configuration.repositories at .rvm/gems/rbx-head/gems
                                           /qwandry-0.1.2/lib/qwandry
                                           /configuration.rb:85
                        Array#each at kernel/bootstrap/array.rb:71
Qwandry::Configuration.repositories at .rvm/gems/rbx-head/gems/qwandry-0.1.2
                                     /lib/qwandry/configuration.rb:83
           Qwandry::Launcher#find at .rvm/gems/rbx-head/gems/qwandry-0.1.2
                                     /lib/qwandry/launcher.rb:16
                  main.__script__ at .rvm/gems/rbx-head/gems/qwandry-0.1.2
                                     /bin/qw:60
               Kernel(Object)#load at kernel/common/kernel.rb:684
                   main.__script__ at .rvm/gems/rbx-head/bin/qw:19
  Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:67
  Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:91
           Rubinius::Loader#script at kernel/loader.rb:521
             Rubinius::Loader#main at kernel/loader.rb:619
             Rubinius::Loader.main at kernel/loader.rb:658
                 Object#__script__ at kernel/loader.rb:669

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.