URI::SshGit

Parse and build git repository url via ssh protocol.
See: Popular use case packsaddle/ruby-git_clone_url
require 'uri/ssh_git'
url = URI::SshGit.parse('git@github.com:packsaddle/ruby-uri-ssh_git.git')
url.scheme
url.userinfo
url.user
url.password
url.host
url.port
url.registry
url.path
url.opaque
url.query
url.fragment
URI::SshGit::Generic.build(
userinfo: 'git',
host: 'github.com',
path: 'packsaddle/ruby-uri-ssh_git.git'
).to_s
VS.
url = URI.parse('git@github.com:schacon/ticgit.git')
URI::InvalidURIError: bad URI(is not URI?): git@github.com:schacon/ticgit.git
url = Addressable::URI.parse('git@github.com:schacon/ticgit.git')
url.path
url.scheme
url.host
url.userinfo
url.user
url.port
API
details.
Installation
Add this line to your application's Gemfile:
gem 'uri-ssh_git'
And then execute:
$ bundle
Or install it yourself as:
$ gem install uri-ssh_git
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/packsaddle/ruby-uri-ssh_git/fork )
- Create your feature branch (
git checkout -b my-new-feature
)
- Commit your changes (
git commit -am 'Add some feature'
)
- Push to the branch (
git push origin my-new-feature
)
- Create a new Pull Request