2013-10-14 02:36:58 +00:00
|
|
|
---
|
2012-07-03 08:09:36 +00:00
|
|
|
title: Rubygems
|
2015-11-24 05:02:17 +00:00
|
|
|
category: Ruby
|
2020-07-03 12:47:47 +00:00
|
|
|
intro: |
|
|
|
|
A quick reference to common [rubygems](https://rubygems.org) CLI commands.
|
2013-10-14 02:36:58 +00:00
|
|
|
---
|
2012-07-03 08:09:36 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### Building and publishing
|
2014-04-28 10:57:58 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```sh
|
|
|
|
gem build *.gemspec # Build a gem
|
|
|
|
gem install *.gem # Install locally
|
|
|
|
gem push *.gem # Upload to rubygems.org
|
|
|
|
gem yank foogem -v 0.0.1 # Take it back
|
|
|
|
```
|
2012-07-03 08:09:36 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### Querying
|
2012-07-03 08:09:36 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```sh
|
|
|
|
gem owner foogem -a rico@ricostacruz.com
|
2012-07-03 08:09:36 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
gem list # List local gems
|
|
|
|
gem which rake # Point to where lib/rake.rb is
|
|
|
|
gem search -r rails # [remote] Search for gems
|
|
|
|
```
|
|
|
|
|
|
|
|
### Opening a gem
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# https://github.com/fnando/gem-open
|
|
|
|
gem open foogem
|
|
|
|
GEM_EDITOR="vim" gem open foogem
|
|
|
|
```
|
|
|
|
|
|
|
|
### Changing to a directory
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cd $(basename `gem which rake`) # Go to a gem's path
|
|
|
|
```
|