If I download a .gem file to a folder in my computer, can I install it later using gem install
?
如果我将一个.gem文件下载到我的计算机的文件夹中,我可以使用gem安装之后安装它吗?
7 个解决方案
#1
267
Yup, when you do gem install
, it will search the current directory first, so if your .gem file is there, it will pick it up. I found it on the gem reference, which you may find handy as well:
是的,当你进行gem安装时,它会先搜索当前目录,所以如果你的。gem文件在那里,它会把它捡起来。我在宝石参考上找到了它,你也会发现它很方便:
gem install will install the named gem. It will attempt a local installation (i.e. a .gem file in the current directory), and if that fails, it will attempt to download and install the most recent version of the gem you want.
gem安装将安装命名的gem。它将尝试本地安装(即当前目录中的.gem文件),如果失败,它将尝试下载并安装您想要的最新版本的gem。
#2
307
Also, you can use gem install --local path_to_gem/filename.gem
此外,还可以使用gem安装——本地path_to_gem/filename.gem。
This will skip the usual gem repository scan that happens when you leave off --local
.
这将跳过通常的gem存储库扫描——本地的。
You can find other magic with gem install --help
.
你可以通过gem安装找到其他的魔法——帮助。
#3
55
you can also use the full filename to your gem file:
您也可以使用完整的文件名到您的gem文件:
gem install /full/path/to/your.gem
this works as well -- it's probably the easiest way
这也行得通——这可能是最简单的方法。
#4
31
If you create your gems with bundler:
如果你用bundler创造你的宝石:
# do this in the proper directory
bundle gem foobar
You can install them with rake after they are written:
你可以在它们写完后用耙子把它们安装好:
# cd into your gem directory
rake install
Chances are, that your downloaded gem will know rake install
, too.
很有可能,您下载的gem也会知道rake安装。
#5
10
if you download the project file from github or other scm host site, use gem build to build the project first, so you can get a whatever.gem file in current directory. Then gem install it!
如果您从github或其他scm主机站点下载项目文件,请使用gem build首先构建项目,这样您就可以获得任何东西。当前目录中的gem文件。然后gem安装它!
#6
6
If you want to work on a locally modified fork of a gem, the best way to do so is
如果你想在一个本地修改的宝石叉上工作,最好的方法是。
gem 'pry', path: './pry'
宝石“撬”,路径:“。/撬”
in a Gemfile.
Gemfile。
... where ./pry
would be the clone of your repository. Simply run bundle install
once, and any changes in the gem sources you make are immediately reflected. With gem install pry/pry.gem
, the sources are still moved into GEM_PATH
and you'll always have to run both bundle gem pry
and gem update
to test.
…其中。/pry将是存储库的克隆。简单地运行bundle安装一次,您所做的gem源的任何更改都会立即反映出来。与宝石安装撬/撬。gem,源仍然被移动到GEM_PATH中,你将总是需要运行两个bundle gem pry和gem更新来测试。
#7
4
Go to the path in where the gem is and call gem install -l gemname.gem
到gem所在的路径,调用gem安装-l gemname.gem。
#1
267
Yup, when you do gem install
, it will search the current directory first, so if your .gem file is there, it will pick it up. I found it on the gem reference, which you may find handy as well:
是的,当你进行gem安装时,它会先搜索当前目录,所以如果你的。gem文件在那里,它会把它捡起来。我在宝石参考上找到了它,你也会发现它很方便:
gem install will install the named gem. It will attempt a local installation (i.e. a .gem file in the current directory), and if that fails, it will attempt to download and install the most recent version of the gem you want.
gem安装将安装命名的gem。它将尝试本地安装(即当前目录中的.gem文件),如果失败,它将尝试下载并安装您想要的最新版本的gem。
#2
307
Also, you can use gem install --local path_to_gem/filename.gem
此外,还可以使用gem安装——本地path_to_gem/filename.gem。
This will skip the usual gem repository scan that happens when you leave off --local
.
这将跳过通常的gem存储库扫描——本地的。
You can find other magic with gem install --help
.
你可以通过gem安装找到其他的魔法——帮助。
#3
55
you can also use the full filename to your gem file:
您也可以使用完整的文件名到您的gem文件:
gem install /full/path/to/your.gem
this works as well -- it's probably the easiest way
这也行得通——这可能是最简单的方法。
#4
31
If you create your gems with bundler:
如果你用bundler创造你的宝石:
# do this in the proper directory
bundle gem foobar
You can install them with rake after they are written:
你可以在它们写完后用耙子把它们安装好:
# cd into your gem directory
rake install
Chances are, that your downloaded gem will know rake install
, too.
很有可能,您下载的gem也会知道rake安装。
#5
10
if you download the project file from github or other scm host site, use gem build to build the project first, so you can get a whatever.gem file in current directory. Then gem install it!
如果您从github或其他scm主机站点下载项目文件,请使用gem build首先构建项目,这样您就可以获得任何东西。当前目录中的gem文件。然后gem安装它!
#6
6
If you want to work on a locally modified fork of a gem, the best way to do so is
如果你想在一个本地修改的宝石叉上工作,最好的方法是。
gem 'pry', path: './pry'
宝石“撬”,路径:“。/撬”
in a Gemfile.
Gemfile。
... where ./pry
would be the clone of your repository. Simply run bundle install
once, and any changes in the gem sources you make are immediately reflected. With gem install pry/pry.gem
, the sources are still moved into GEM_PATH
and you'll always have to run both bundle gem pry
and gem update
to test.
…其中。/pry将是存储库的克隆。简单地运行bundle安装一次,您所做的gem源的任何更改都会立即反映出来。与宝石安装撬/撬。gem,源仍然被移动到GEM_PATH中,你将总是需要运行两个bundle gem pry和gem更新来测试。
#7
4
Go to the path in where the gem is and call gem install -l gemname.gem
到gem所在的路径,调用gem安装-l gemname.gem。