代码拉取完成,页面将自动刷新
# KISS yet powerful gem / gemset management for rbenv
rbenv-gemset plugs in to the [goodness of rbenv](https://github.com/sstephenson/rbenv/wiki/Why-rbenv%3F),
and brings you gem management that is at once simple, easy to understand and set up (just one file with the simplest format ever!)
and then use to do pretty much everything that you really need to with gemsets.
**New with v0.4.0: Project gemsets!** install gems into a sub-folder in your project directory for easy cleanup later! (or easy customization, or testing)
rbenv-gemset is an extension for the [rbenv][rbenv] ruby version manager that
allows you to use "gemsets", sandboxed collections of gems. This lets you have
multiple collections of gems installed in different sandboxes, and specify (on
a per-application basis) which sets of gems should be used.
**Error reports and Bug reports:** [How to ensure that you get help](http://www.catb.org/~esr/faqs/smart-questions.html#intro),
a.k.a. "How To Ask Questions The Smart Way"
[*Special Note for RubyMine users!*](#special-note-for-rubymine-users)
## Table of Contents
* [Installation](#installation)
* [GitHub](#github)
* [\*u\*\* Homebrew](#c-homebrew)
* [Special note for RubyMine users](#special-note-for-rubymine-users)
* [Usage](#usage)
* [Usage (the advanced, "neckbeard" version](#usage-the-advanced-neckbeard-version)
* [How to Report Issues](#how-to-report-issues)
* [History](#history)
* [License](#license)
## Installation
### GitHub
Download and extract the [latest release](https://github.com/jf/rbenv-gemset/releases/latest) (v0.5.10 now!) or clone rbenv-gemset to your `$HOME/.rbenv/plugins` directory:
$ git clone https://github.com/jf/rbenv-gemset.git $HOME/.rbenv/plugins/rbenv-gemset
### \*\*c\* Homebrew
[\*\*\*k Homebrew](https://github.com/jf/rbenv-gemset/issues/93). This maintainer and this project will not bend to external pressure to change license from people who are not involved in the project. Just use git! **It works**, and is perfectly fine.
### Special note for RubyMine users
[RubyMine 8 now supports rbenv-gemset](https://youtrack.jetbrains.com/issue/RUBY-12839#comment=27-1179455). Thanks, guys!
## Usage
Running ``rbenv gemset`` will give you the following help:
rbenv gemset [command] [options]
possible commands are:
active
create [version] [gemset]
delete [version] [gemset]
file
init [gemset]
list
version
Here is a basic example:
```shell
cd my-project
# Set up a default gemset for your project.
# Also will create a `.rbenv-gemsets` file in the current directory.
# NOTE: this will create the gemset under the current ruby version.
rbenv gemset init
# Alternatively, you can provide `rbenv gemset init` with the name of a gemset:
rbenv gemset init [gemset]
# To create a gemset under a specific ruby version:
rbenv gemset create [version] [gemset]
# You can list the existing gemsets by using the following command:
# This should include the most recent gemset you just created.
rbenv gemset list
# You can delete a gemset with the following command:
rbenv gemset delete [version] [gemset]
```
## Usage (the advanced, "neckbeard" version)
In your application directory, create a file named `.rbenv-gemsets`, with the
names of the gemsets that you want to use on separate lines, or separated
by whitespace. The first gemset in the list will be the primary gemset, where
new gems will be installed.
$ echo -e "my-gemset\nanother-gemset" > .rbenv-gemsets
Now all commands involving gems will use the gemsets that you've specified.
To have gems install into a sub-folder in your project directory for easy removal later (`rm -rf project_dir`!) / editing / testing,
you can use a project gemset. A project gemset has a '.' ("dot") as the first character:
$ echo '.gems' > .rbenv-gemsets
Your gems will then get installed in `project/.gems`.
If you don't want to use a "dot directory" to house your gems but still want to use a project gemset,
then do something like this instead:
$ echo './gems' > .rbenv-gemsets
Your gems will then get installed in `project/gems`.
To see your currently active gemsets, try `rbenv gemset active`. If you're wondering about that gemset called `global` at the end, see https://github.com/jf/rbenv-gemset/issues/59#issuecomment-38264174.
**TL;DR:** if you don't have any actual gemset called `global`, forget about it! `global` will not affect you at all.
If you just don't like seeing that `global` at the end, you can add a `-global` ("minus gemset") to your `.rbenv-gemsets` file.
The gemset plugin will cause rbenv to search for the `.rbenv-gemsets` file in
the current directory, as well as in all ancestor directories, until either a
config file is found or it has gone all the way up to `/`. If, along the way, a
`.ruby-gemset` file is found instead of `.rbenv-gemsets`, `.ruby-gemset` will be
used.
**Special environment variable tips and tricks**
*RBENV_GEMSETS*:
You can use this environment variable when you want to work with a certain gemset (or gemset list!). For a quick install into a certain gemset, for example:
$ RBENV_GEMSETS="global" gem install thin
*RBENV_GEMSET_FILE*:
You have to know what you're doing, but you can set RBENV_GEMSET_FILE to the absolute path of a gemset file if you want to use another gemset file that isn't in any of your ancestor directories.
*Note that you have to be using the same version of ruby for this to work as expected!*
$ RBENV_GEMSET_FILE="$HOME/hplabs/project1/.rbenv-gemsets" rails new newproject
## How to Report Issues
See http://www.catb.org/~esr/faqs/smart-questions.html#intro.
## History
Jamis Buck started the project in 2011, and Joe Fiorini took over as maintainer in May 2012. Jeffrey 'jf' Lim is now the current maintainer, and took over in July 2013.
## License
This code is placed in the public domain by the author, Jamis Buck. Use it as
you wish. Please prefer good over evil.
[rbenv]: http://github.com/sstephenson/rbenv
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。