RubyGems Clone Plugin
A RubyGems plugin that allows you to clone gem repositories using ghq based on gem metadata.
Installation
gem install rubygems-clone
Or build and install locally:
gem build rubygems-clone.gemspec
gem install rubygems-clone-0.1.0.gem
Prerequisites
This plugin requires ghq to be installed and available in your PATH.
# Install ghq (example for macOS)
brew install ghq
# Or install via Go
go install github.com/x-motemen/ghq@latest
Usage
# Clone a gem repository
gem clone sinatra
# Clone with verbose output
gem clone rails --verbose
The command will:
- Fetch gem metadata from RubyGems.org API
- Extract repository URL from:
source_code_urimetadatahomepage_uri(if it looks like a repository URL)project_uri(if it looks like a repository URL)
- Use
ghq getto clone the repository
Examples
$ gem clone sinatra
Executing: ghq get https://github.com/sinatra/sinatra
Successfully cloned repository: https://github.com/sinatra/sinatra
$ gem clone rails --verbose
Fetching gem metadata for 'rails'...
Found repository URL: https://github.com/rails/rails
Executing: ghq get https://github.com/rails/rails
Successfully cloned repository: https://github.com/rails/rails
Development
After checking out the repo, run tests and build the gem:
gem build rubygems-clone.gemspec
gem install rubygems-clone-0.1.0.gem
License
The gem is available as open source under the terms of the MIT License.