github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mernen / completion-ruby

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Command-line completion for Ruby-related commands under Bash: rake, gem, rails, ruby, jruby — Read more

  Cancel

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Don't break when bash-completion is missing, just tone down functionality 
mernen (author)
Fri Feb 05 21:06:29 -0800 2010
commit  91c2a66d4fe8750381e38ba9f1c81a77e4ec3d19
tree    575bdd0b79011f5b36ee295f18e185ea1b816bfd
parent  7e957bee7b89e790c2275dce88459daeaf1807f3
completion-ruby /
name age
history
message
file MIT-LICENSE Sun Jul 27 17:14:13 -0700 2008 Added license file. [mernen]
file README.markdown Wed Jul 22 14:50:09 -0700 2009 Readme tweaks Most importantly, updated Git we... [mernen]
file completion-gem Thu Apr 16 19:44:55 -0700 2009 gawk by default does not support interval expre... [mernen]
file completion-jruby Sun Jun 07 22:48:43 -0700 2009 jruby: added Nailgun options, `--ng` and `--ng-... [mernen]
file completion-rails Sat Jan 24 15:06:17 -0800 2009 More stylistic, no-op changes. [mernen]
file completion-rake Fri Feb 05 21:06:29 -0800 2010 Don't break when bash-completion is missing, ju... [mernen]
file completion-ruby Fri Feb 05 21:06:29 -0800 2010 Don't break when bash-completion is missing, ju... [mernen]
file completion-ruby-all Thu Sep 17 12:15:29 -0700 2009 Fixed completions not loading if you don't have... [mernen]
README.markdown

completion-ruby: bash completion for Ruby-related commands

completion-ruby is a set of bash scripts offering command-line completion for various Ruby-related commands and tools.

Usage

Save the completion files somewhere (in the same directory) and add the following line to your ~/.bashrc or ~/.profile:

. /path/to/completion-ruby-all

The completion-ruby-all script loads all the completions it finds, but only for the commands you appear to have installed. Alternatively, you can just save the specific scripts you wish, and source them individually.

These scripts have a slight dependency on bash-completion. It should be part of pretty much any modern Linux distribution, and you can install it on OS X using MacPorts:

sudo port install bash-completion

bash-completion is a dependency of Git's completion too, so if you have that working already you should be fine.

Why yet another completion script?

Before writing my own, I'd seen about five different scripts for rake completion. None of them, though, at the same time:

  • cached the task list for fast results;
  • invalidated said cache when the rakefile was modified;
  • worked properly with namespaces; and
  • worked on subdirectories of the project

...among other minor quirks. While providing all of the above, a few other niceties were added, like command-line options completion and awareness of task arguments.

This script is not perfect (for instance, it won't update the cache if a dependency of the rakefile is updated; as a workaround, simply touch Rakefile), but it tries to cover all the most common cases without overcomplicating or overthinking the code.

License and website

Copyright © 2008 Daniel Luz.

completion-ruby is distributed under the MIT license.

The source is available in a Git repository, available at GitHub.

For up-to-date information, visit this project's permalink.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server