我不希望“rake install”发布到Rubygems

时间:2012-02-13 03:55:15

标签: ruby gem rake

我正在跑步:

rake install

在使用bundle gem <project_name>

构建的项目上

我已经将gem发布到Rubygems。但是,有时我在VPN上,我不希望rake install尝试将gem发布到Rubygems。

我只想在本地安装它。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:6)

当您运行rake install时,由bundler创建的rakefile不会发布您的gem。

您正在考虑rake release不要忘记您可以rake -T查看所有描述任务的列表。

$ bundle --version
Bundler version 1.0.21


$ bundle gem somegem
      create  somegem/Gemfile
      create  somegem/Rakefile
      create  somegem/.gitignore
      create  somegem/somegem.gemspec
      create  somegem/lib/somegem.rb
      create  somegem/lib/somegem/version.rb
Initializating git repo in /Users/joshuajcheek/deleteme/somegem


$ cd somegem
total 24
-rw-r--r--  1 staff    91B Feb 12 22:00 Gemfile
-rw-r--r--  1 staff    28B Feb 12 22:00 Rakefile
drwxr-xr-x  4 staff   136B Feb 12 22:00 lib/
-rw-r--r--  1 staff   793B Feb 12 22:00 somegem.gemspec


$ rake -T
rake build    # Build somegem-0.0.1.gem into the pkg directory
rake install  # Build and install somegem-0.0.1.gem into system gems
rake release  # Create tag v0.0.1 and build and push somegem-0.0.1.gem to Rubygems


$ mate . # removing TODOs from the .gemspec


$ rake install # notice this is not pushing to rubygems
somegem 0.0.1 built to pkg/somegem-0.0.1.gem
somegem (0.0.1) installed


$ gem list somegem

*** LOCAL GEMS ***

somegem (0.0.1)


$ gem search -r somegem # does not show up in rubygems list

*** REMOTE GEMS ***