Sha256: eb719b1a6453858938a93370d3849e894397eee86eb57a162476b56565fd3eb3
Contents?: true
Size: 1.39 KB
Versions: 8
Compression:
Stored size: 1.39 KB
Contents
= Gitable == Addressable::URI for Git. Works with any valid Git URI, because Addressable doesn't. == Example!? require 'gitable/uri' uri = Gitable::URI.parse('git@github.com:martinemde/gitable.git') uri.path # => 'martinemde/gitable.git' uri.user # => 'git' uri.host # => 'github.com' # Maintain the same url format. uri.to_s # => 'git@github.com:martinemde/gitable.git' # If it can't guess the name, you named your repository wrong. uri.project_name # => 'gitable' # Inherited from Addressable::URI uri.kind_of?(Addressable::URI) # => true == heuristic_parse You can use Gitable::URI.heuristic_parse to take user input. Currently this supports the mistake of copying the url bar instead of the git uri for a few of the popular git webhosts. It also runs through Addressable's heuristic_parse so it will correct some poorly typed URIs. uri = Gitable::URI.heuristic_parse('http://github.com:martinemde/gitable') uri.to_s # => 'git://github.com/martinemde/gitable.git' heuristic_parse is currently very limited. If the url doesn't end in .git, it switches http:// to git:// and adds .git to the basename. This works fine for github.com and gitorious.org but will happily screw up other URIs. == That's it? Yep. What else did you expect? (let me know or write a patch) == Copyright Copyright (c) 2010 Martin Emde. See LICENSE for details.
Version data entries
8 entries across 8 versions & 1 rubygems