This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/modules/ruby
2012-09-06 23:17:38 -04:00
..
functions Clarify info functions descriptions 2012-09-06 23:17:38 -04:00
init.zsh
README.md [Fix #259] Add ruby-info function 2012-09-06 23:06:50 -04:00

Ruby

Configures Ruby local gem installation, loads version managers, and defines aliases.

Local Gem Installation

When a Ruby version manager is not detected, local gems are installed in ~/Library/Ruby/Gems/1.8 on Mac OS X.

RVM

An alternative to the above is to use The Ruby Version Manager (RVM), which allows for managing multiple, isolated Ruby installations and gem sets in the home directory.

Since RVM is loaded into the shell and is known to override shell commands, it may conflict with shell scripts.

rbenv

An alternative RVM is to use rbenv, which allows for switching between multiple, isolated Ruby installations in the home directory.

While it is not as feature rich as RVM, it is not loaded into the shell and is not known to cause conflicts with shell scripts.

Bundler

Manage gems that are not meant to be used as commands, such as application dependencies, with Bundler.

Aliases

General

  • rb is short for ruby.

Bundler

  • rbb manages ruby dependencies (bundle).
  • rbbe executes a script in the context of the current bundle.
  • rbbi installs the gems specified in the Gemfile in vendor/bundle.
  • rbbI installs the following:
    • gems specified in the Gemfile in vendor/bundle.
    • packages the gems into vendor/cache.
    • appends bundler directories to .gitignore.
  • rbbl lists all gems in the current bundle.
  • rbbo opens an installed gem in the editor.
  • rbbp packages gem files into vendor/cache.
  • rbbu updates gems to their latest version.

Functions

  • ruby-info exposes information about the Ruby environment via the $ruby_info associative array.

Theming

To display the name of the current Ruby version in a prompt, define the following style in the prompt_theme_setup function.

# %v - ruby version.
zstyle ':prezto:module:ruby' version 'version:%v'

Then add $ruby_info[version] to $PROMPT or $RPROMPT and call ruby-info in the prompt_theme_preexec hook function.

Authors

The authors of this module should be contacted via the issue tracker.