gitable 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +23 -0
- data/Gemfile +16 -0
- data/LICENSE +20 -0
- data/README.rdoc +20 -0
- data/Rakefile +67 -0
- data/VERSION.yml +5 -0
- data/gitable.gemspec +55 -0
- data/lib/gitable/scp_uri.rb +31 -0
- data/lib/gitable/uri.rb +32 -0
- data/lib/gitable.rb +4 -0
- data/spec/gitable_spec.rb +380 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +70 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'http://gemcutter.org'
|
2
|
+
|
3
|
+
bin_path 'gbin'
|
4
|
+
disable_system_gems
|
5
|
+
|
6
|
+
gem 'addressable', :require_as => 'addressable/uri'
|
7
|
+
|
8
|
+
only :test do
|
9
|
+
gem 'jeweler'
|
10
|
+
gem 'bundler'
|
11
|
+
gem 'rspec', :require_as => 'spec'
|
12
|
+
gem 'ZenTest'
|
13
|
+
gem 'rake'
|
14
|
+
gem 'rcov'
|
15
|
+
gem 'ruby-debug'
|
16
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Martin Emde
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= Gitable
|
2
|
+
|
3
|
+
Like Addressable::URI but for Git
|
4
|
+
|
5
|
+
require 'gitable/uri'
|
6
|
+
uri = Gitable::URI.parse('git@github.com:martinemde/gitable.git')
|
7
|
+
|
8
|
+
uri.path # => 'martinemde/gitable.git'
|
9
|
+
uri.user # => 'git'
|
10
|
+
uri.host # => 'github.com'
|
11
|
+
|
12
|
+
Works with any valid Git uri.
|
13
|
+
|
14
|
+
== That's it?
|
15
|
+
|
16
|
+
yep. What else did you expect?
|
17
|
+
|
18
|
+
== Copyright
|
19
|
+
|
20
|
+
Copyright (c) 2010 Martin Emde. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "gitable"
|
8
|
+
gem.summary = %Q{Like Addressable::URI but for Git}
|
9
|
+
gem.description = %Q{Use this like an Addressable::URI that understands the various git URI formats.}
|
10
|
+
gem.email = "martin.emde@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/martinemde/gitable"
|
12
|
+
gem.authors = ["Martin Emde"]
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'spec/rake/spectask'
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
21
|
+
spec.libs << 'lib' << 'spec'
|
22
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
23
|
+
end
|
24
|
+
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
28
|
+
spec.rcov = true
|
29
|
+
end
|
30
|
+
|
31
|
+
task :spec => :check_dependencies
|
32
|
+
|
33
|
+
begin
|
34
|
+
require 'reek/adapters/rake_task'
|
35
|
+
Reek::RakeTask.new do |t|
|
36
|
+
t.fail_on_error = true
|
37
|
+
t.verbose = false
|
38
|
+
t.source_files = 'lib/**/*.rb'
|
39
|
+
end
|
40
|
+
rescue LoadError
|
41
|
+
task :reek do
|
42
|
+
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
require 'roodi'
|
48
|
+
require 'roodi_task'
|
49
|
+
RoodiTask.new do |t|
|
50
|
+
t.verbose = false
|
51
|
+
end
|
52
|
+
rescue LoadError
|
53
|
+
task :roodi do
|
54
|
+
abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
task :default => :spec
|
59
|
+
|
60
|
+
begin
|
61
|
+
require 'yard'
|
62
|
+
YARD::Rake::YardocTask.new
|
63
|
+
rescue LoadError
|
64
|
+
task :yardoc do
|
65
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
66
|
+
end
|
67
|
+
end
|
data/gitable.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{gitable}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Martin Emde"]
|
12
|
+
s.date = %q{2010-01-12}
|
13
|
+
s.description = %q{Use this like an Addressable::URI that understands the various git URI formats.}
|
14
|
+
s.email = %q{martin.emde@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION.yml",
|
27
|
+
"gitable.gemspec",
|
28
|
+
"lib/gitable.rb",
|
29
|
+
"lib/gitable/scp_uri.rb",
|
30
|
+
"lib/gitable/uri.rb",
|
31
|
+
"spec/gitable_spec.rb",
|
32
|
+
"spec/spec.opts",
|
33
|
+
"spec/spec_helper.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/martinemde/gitable}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
39
|
+
s.summary = %q{Like Addressable::URI but for Git}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/gitable_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
else
|
51
|
+
end
|
52
|
+
else
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'gitable/uri'
|
2
|
+
|
3
|
+
module Gitable
|
4
|
+
class ScpURI < Gitable::URI
|
5
|
+
# Keep URIs like this relative:
|
6
|
+
#
|
7
|
+
# git@github.com:martinemde/gitable.git
|
8
|
+
#
|
9
|
+
# Without breaking URIs like these:
|
10
|
+
#
|
11
|
+
# git@host.com:/home/martinemde/gitable.git
|
12
|
+
#
|
13
|
+
def path=(new_path)
|
14
|
+
super
|
15
|
+
if new_path[0..0] != "/"
|
16
|
+
@path = path.sub(%r|^/|,'')
|
17
|
+
end
|
18
|
+
path
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
@uri_string ||= begin
|
23
|
+
uri_string = "#{authority}:#{path.to_s}"
|
24
|
+
if uri_string.respond_to?(:force_encoding)
|
25
|
+
uri_string.force_encoding(Encoding::UTF_8)
|
26
|
+
end
|
27
|
+
uri_string
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/gitable/uri.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
|
3
|
+
module Gitable
|
4
|
+
class URI < Addressable::URI
|
5
|
+
SCP_URI_REGEXP = /^([^:\/?#]+):([^?#]*)$/
|
6
|
+
|
7
|
+
def self.parse(uri)
|
8
|
+
return uri if uri.nil? || uri.kind_of?(self)
|
9
|
+
|
10
|
+
# addressable::URI.parse always returns an instance of Addressable::URI.
|
11
|
+
add = super(uri) # >:(
|
12
|
+
|
13
|
+
scan = uri.scan(SCP_URI_REGEXP)
|
14
|
+
fragments = scan[0]
|
15
|
+
authority = fragments && fragments[0]
|
16
|
+
|
17
|
+
if add.host.nil? && authority
|
18
|
+
Gitable::ScpURI.new(
|
19
|
+
:authority => authority,
|
20
|
+
:path => add.path
|
21
|
+
)
|
22
|
+
else
|
23
|
+
new(add.omit(:password,:query,:fragment).to_hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# guesses a project name
|
28
|
+
def project_name
|
29
|
+
basename.sub(/\.git$/,'')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/gitable.rb
ADDED
@@ -0,0 +1,380 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Gitable::URI do
|
4
|
+
before do
|
5
|
+
@uri = "ssh://git@github.com/martinemde/gitable.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.describe_uri(uri, &block)
|
9
|
+
describe "with uri: #{uri.inspect}" do
|
10
|
+
before { @uri = uri }
|
11
|
+
subject { Gitable::URI.parse(@uri) }
|
12
|
+
URIChecker.new(self, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class URIChecker
|
17
|
+
def initialize(example_group, &block)
|
18
|
+
@example_group = example_group
|
19
|
+
instance_eval(&block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def it_sets(parts)
|
23
|
+
parts.each do |part, value|
|
24
|
+
it "sets #{part} to #{value.inspect}" do
|
25
|
+
subject.send(part).should == value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def method_missing(*args, &block)
|
31
|
+
@example_group.send(*args, &block)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Valid Git URIs according to git-clone documentation at this url:
|
36
|
+
# http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#_git_urls_a_id_urls_a
|
37
|
+
#
|
38
|
+
# rsync://host.xz/path/to/repo.git/
|
39
|
+
# http://host.xz[:port]/path/to/repo.git/
|
40
|
+
# https://host.xz[:port]/path/to/repo.git/
|
41
|
+
# git://host.xz[:port]/path/to/repo.git/
|
42
|
+
# git://host.xz[:port]/~user/path/to/repo.git/
|
43
|
+
# ssh://[user@]host.xz[:port]/path/to/repo.git/
|
44
|
+
# ssh://[user@]host.xz/path/to/repo.git/
|
45
|
+
# ssh://[user@]host.xz/~user/path/to/repo.git/
|
46
|
+
# ssh://[user@]host.xz/~/path/to/repo.git
|
47
|
+
#
|
48
|
+
# (from the git docs)
|
49
|
+
# SSH is the default transport protocol over the network. You can optionally specify which user to log-in as, and an alternate, scp-like syntax is also supported. Both syntaxes support username expansion, as does the native git protocol, but only the former supports port specification. The following three are identical to the last three above, respectively:
|
50
|
+
#
|
51
|
+
# [user@]host.xz:/path/to/repo.git/
|
52
|
+
# [user@]host.xz:~user/path/to/repo.git/
|
53
|
+
# [user@]host.xz:path/to/repo.git
|
54
|
+
#
|
55
|
+
# To sync with a local directory, you can use:
|
56
|
+
#
|
57
|
+
# /path/to/repo.git/
|
58
|
+
# file:///path/to/repo.git/
|
59
|
+
#
|
60
|
+
expected = {
|
61
|
+
:user => nil,
|
62
|
+
:password => nil,
|
63
|
+
:host => "host.xz",
|
64
|
+
:port => nil,
|
65
|
+
:path => "/path/to/repo.git/",
|
66
|
+
:basename => "repo.git",
|
67
|
+
:query => nil,
|
68
|
+
:fragment => nil,
|
69
|
+
:project_name => "repo"
|
70
|
+
}
|
71
|
+
|
72
|
+
describe ".parse" do
|
73
|
+
it "returns a Gitable::URI" do
|
74
|
+
Gitable::URI.parse(@uri).should be_a_kind_of(Gitable::URI)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "returns nil when passed a nil uri" do
|
78
|
+
Gitable::URI.parse(nil).should be_nil
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns the same uri when passed a Gitable::URI" do
|
82
|
+
gitable = Gitable::URI.parse(@uri)
|
83
|
+
Gitable::URI.parse(gitable).should be_eql(gitable)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "raises a TypeError on bad type" do
|
87
|
+
lambda {
|
88
|
+
Gitable::URI.parse(5)
|
89
|
+
}.should raise_error(TypeError)
|
90
|
+
end
|
91
|
+
|
92
|
+
describe_uri "rsync://host.xz/path/to/repo.git/" do
|
93
|
+
it { subject.to_s.should == @uri }
|
94
|
+
it_sets expected.merge({
|
95
|
+
:scheme => "rsync",
|
96
|
+
:project_name => "repo"
|
97
|
+
})
|
98
|
+
end
|
99
|
+
|
100
|
+
describe_uri "rsync://host.xz/path/to/repo.git/" do
|
101
|
+
it { subject.to_s.should == @uri }
|
102
|
+
it_sets expected.merge({
|
103
|
+
:scheme => "rsync",
|
104
|
+
})
|
105
|
+
end
|
106
|
+
|
107
|
+
describe_uri "http://host.xz/path/to/repo.git/" do
|
108
|
+
it { subject.to_s.should == @uri }
|
109
|
+
it_sets expected.merge({
|
110
|
+
:scheme => "http",
|
111
|
+
})
|
112
|
+
end
|
113
|
+
|
114
|
+
describe_uri "http://host.xz:8888/path/to/repo.git/" do
|
115
|
+
it { subject.to_s.should == @uri }
|
116
|
+
it_sets expected.merge({
|
117
|
+
:scheme => "http",
|
118
|
+
:port => 8888,
|
119
|
+
})
|
120
|
+
end
|
121
|
+
|
122
|
+
describe_uri "https://host.xz/path/to/repo.git/" do
|
123
|
+
it { subject.to_s.should == @uri }
|
124
|
+
it_sets expected.merge({
|
125
|
+
:scheme => "https",
|
126
|
+
})
|
127
|
+
end
|
128
|
+
|
129
|
+
describe_uri "https://host.xz:8888/path/to/repo.git/" do
|
130
|
+
it { subject.to_s.should == @uri }
|
131
|
+
it_sets expected.merge({
|
132
|
+
:scheme => "https",
|
133
|
+
:port => 8888,
|
134
|
+
})
|
135
|
+
end
|
136
|
+
|
137
|
+
describe_uri "git://host.xz/path/to/repo.git/" do
|
138
|
+
it { subject.to_s.should == @uri }
|
139
|
+
it_sets expected.merge({
|
140
|
+
:scheme => "git",
|
141
|
+
})
|
142
|
+
end
|
143
|
+
|
144
|
+
describe_uri "git://host.xz:8888/path/to/repo.git/" do
|
145
|
+
it { subject.to_s.should == @uri }
|
146
|
+
it_sets expected.merge({
|
147
|
+
:scheme => "git",
|
148
|
+
:port => 8888,
|
149
|
+
})
|
150
|
+
end
|
151
|
+
|
152
|
+
describe_uri "git://host.xz/~user/path/to/repo.git/" do
|
153
|
+
it { subject.to_s.should == @uri }
|
154
|
+
it_sets expected.merge({
|
155
|
+
:scheme => "git",
|
156
|
+
:path => "/~user/path/to/repo.git/",
|
157
|
+
})
|
158
|
+
end
|
159
|
+
|
160
|
+
describe_uri "git://host.xz:8888/~user/path/to/repo.git/" do
|
161
|
+
it { subject.to_s.should == @uri }
|
162
|
+
it_sets expected.merge({
|
163
|
+
:scheme => "git",
|
164
|
+
:path => "/~user/path/to/repo.git/",
|
165
|
+
:port => 8888,
|
166
|
+
})
|
167
|
+
end
|
168
|
+
|
169
|
+
describe_uri "ssh://host.xz/path/to/repo.git/" do
|
170
|
+
it { subject.to_s.should == @uri }
|
171
|
+
it_sets expected.merge({
|
172
|
+
:scheme => "ssh",
|
173
|
+
})
|
174
|
+
end
|
175
|
+
|
176
|
+
describe_uri "ssh://user@host.xz/path/to/repo.git/" do
|
177
|
+
it { subject.to_s.should == @uri }
|
178
|
+
it_sets expected.merge({
|
179
|
+
:scheme => "ssh",
|
180
|
+
:user => "user",
|
181
|
+
})
|
182
|
+
end
|
183
|
+
|
184
|
+
describe_uri "ssh://host.xz/path/to/repo.git/" do
|
185
|
+
it { subject.to_s.should == @uri }
|
186
|
+
it_sets expected.merge({
|
187
|
+
:scheme => "ssh",
|
188
|
+
})
|
189
|
+
end
|
190
|
+
|
191
|
+
describe_uri "ssh://host.xz:8888/path/to/repo.git/" do
|
192
|
+
it { subject.to_s.should == @uri }
|
193
|
+
it_sets expected.merge({
|
194
|
+
:scheme => "ssh",
|
195
|
+
:port => 8888,
|
196
|
+
})
|
197
|
+
end
|
198
|
+
|
199
|
+
describe_uri "ssh://user@host.xz/path/to/repo.git/" do
|
200
|
+
it { subject.to_s.should == @uri }
|
201
|
+
it_sets expected.merge({
|
202
|
+
:user => "user",
|
203
|
+
:scheme => "ssh",
|
204
|
+
})
|
205
|
+
end
|
206
|
+
|
207
|
+
describe_uri "ssh://user@host.xz:8888/path/to/repo.git/" do
|
208
|
+
it { subject.to_s.should == @uri }
|
209
|
+
it_sets expected.merge({
|
210
|
+
:scheme => "ssh",
|
211
|
+
:user => "user",
|
212
|
+
:port => 8888,
|
213
|
+
})
|
214
|
+
end
|
215
|
+
|
216
|
+
describe_uri "ssh://host.xz/~user/path/to/repo.git/" do
|
217
|
+
it { subject.to_s.should == @uri }
|
218
|
+
it_sets expected.merge({
|
219
|
+
:scheme => "ssh",
|
220
|
+
:user => nil,
|
221
|
+
:path => "/~user/path/to/repo.git/",
|
222
|
+
})
|
223
|
+
end
|
224
|
+
|
225
|
+
describe_uri "ssh://user@host.xz/~user/path/to/repo.git/" do
|
226
|
+
it { subject.to_s.should == @uri }
|
227
|
+
it_sets expected.merge({
|
228
|
+
:scheme => "ssh",
|
229
|
+
:user => "user",
|
230
|
+
:path => "/~user/path/to/repo.git/",
|
231
|
+
})
|
232
|
+
end
|
233
|
+
|
234
|
+
describe_uri "ssh://host.xz/~/path/to/repo.git" do
|
235
|
+
it { subject.to_s.should == @uri }
|
236
|
+
it_sets expected.merge({
|
237
|
+
:scheme => "ssh",
|
238
|
+
:path => "/~/path/to/repo.git",
|
239
|
+
})
|
240
|
+
end
|
241
|
+
|
242
|
+
describe_uri "ssh://user@host.xz/~/path/to/repo.git" do
|
243
|
+
it { subject.to_s.should == @uri }
|
244
|
+
it_sets expected.merge({
|
245
|
+
:scheme => "ssh",
|
246
|
+
:user => "user",
|
247
|
+
:path => "/~/path/to/repo.git",
|
248
|
+
})
|
249
|
+
end
|
250
|
+
|
251
|
+
describe_uri "host.xz:/path/to/repo.git/" do
|
252
|
+
it { subject.to_s.should == @uri }
|
253
|
+
it_sets expected.merge({
|
254
|
+
:scheme => nil,
|
255
|
+
:user => nil,
|
256
|
+
:path => "/path/to/repo.git/",
|
257
|
+
})
|
258
|
+
end
|
259
|
+
|
260
|
+
describe_uri "user@host.xz:/path/to/repo.git/" do
|
261
|
+
it { subject.to_s.should == @uri }
|
262
|
+
it_sets expected.merge({
|
263
|
+
:scheme => nil,
|
264
|
+
:user => "user",
|
265
|
+
:path => "/path/to/repo.git/",
|
266
|
+
})
|
267
|
+
end
|
268
|
+
|
269
|
+
describe_uri "host.xz:~user/path/to/repo.git/" do
|
270
|
+
it { subject.to_s.should == @uri }
|
271
|
+
it_sets expected.merge({
|
272
|
+
:scheme => nil,
|
273
|
+
:user => nil,
|
274
|
+
:path => "~user/path/to/repo.git/",
|
275
|
+
})
|
276
|
+
end
|
277
|
+
|
278
|
+
describe_uri "user@host.xz:~user/path/to/repo.git/" do
|
279
|
+
it { subject.to_s.should == @uri }
|
280
|
+
it_sets expected.merge({
|
281
|
+
:scheme => nil,
|
282
|
+
:user => "user",
|
283
|
+
:path => "~user/path/to/repo.git/",
|
284
|
+
})
|
285
|
+
end
|
286
|
+
|
287
|
+
describe_uri "host.xz:path/to/repo.git" do
|
288
|
+
it { subject.to_s.should == @uri }
|
289
|
+
it_sets expected.merge({
|
290
|
+
:scheme => nil,
|
291
|
+
:user => nil,
|
292
|
+
:path => "path/to/repo.git",
|
293
|
+
})
|
294
|
+
end
|
295
|
+
|
296
|
+
describe_uri "user@host.xz:path/to/repo.git" do
|
297
|
+
it { subject.to_s.should == @uri }
|
298
|
+
it_sets expected.merge({
|
299
|
+
:scheme => nil,
|
300
|
+
:user => "user",
|
301
|
+
:path => "path/to/repo.git",
|
302
|
+
})
|
303
|
+
end
|
304
|
+
|
305
|
+
describe_uri "/path/to/repo.git/" do
|
306
|
+
it { subject.to_s.should == @uri }
|
307
|
+
it_sets expected.merge({
|
308
|
+
:scheme => nil,
|
309
|
+
:host => nil,
|
310
|
+
:path => "/path/to/repo.git/",
|
311
|
+
})
|
312
|
+
end
|
313
|
+
|
314
|
+
describe_uri "file:///path/to/repo.git/" do
|
315
|
+
it { subject.to_s.should == @uri }
|
316
|
+
it_sets expected.merge({
|
317
|
+
:scheme => "file",
|
318
|
+
:host => "", # I don't really like this but it doesn't hurt anything.
|
319
|
+
:path => "/path/to/repo.git/",
|
320
|
+
})
|
321
|
+
end
|
322
|
+
|
323
|
+
describe_uri "ssh://git@github.com/martinemde/gitable.git" do
|
324
|
+
it { subject.to_s.should == @uri }
|
325
|
+
it_sets({
|
326
|
+
:scheme => "ssh",
|
327
|
+
:user => "git",
|
328
|
+
:password => nil,
|
329
|
+
:host => "github.com",
|
330
|
+
:port => nil,
|
331
|
+
:path => "/martinemde/gitable.git",
|
332
|
+
:fragment => nil,
|
333
|
+
:basename => "gitable.git",
|
334
|
+
})
|
335
|
+
end
|
336
|
+
|
337
|
+
describe_uri "http://github.com/martinemde/gitable.git" do
|
338
|
+
it { subject.to_s.should == @uri }
|
339
|
+
it_sets({
|
340
|
+
:scheme => "http",
|
341
|
+
:user => nil,
|
342
|
+
:password => nil,
|
343
|
+
:host => "github.com",
|
344
|
+
:port => nil,
|
345
|
+
:path => "/martinemde/gitable.git",
|
346
|
+
:fragment => nil,
|
347
|
+
:basename => "gitable.git",
|
348
|
+
})
|
349
|
+
end
|
350
|
+
|
351
|
+
describe_uri "git://github.com/martinemde/gitable.git" do
|
352
|
+
it { subject.to_s.should == @uri }
|
353
|
+
it_sets({
|
354
|
+
:scheme => "git",
|
355
|
+
:user => nil,
|
356
|
+
:password => nil,
|
357
|
+
:host => "github.com",
|
358
|
+
:port => nil,
|
359
|
+
:path => "/martinemde/gitable.git",
|
360
|
+
:fragment => nil,
|
361
|
+
:basename => "gitable.git",
|
362
|
+
})
|
363
|
+
end
|
364
|
+
|
365
|
+
describe_uri "git@github.com:martinemde/gitable.git" do
|
366
|
+
it { subject.to_s.should == @uri }
|
367
|
+
it_sets({
|
368
|
+
:scheme => nil,
|
369
|
+
:user => "git",
|
370
|
+
:password => nil,
|
371
|
+
:host => "github.com",
|
372
|
+
:port => nil,
|
373
|
+
:path => "martinemde/gitable.git",
|
374
|
+
:fragment => nil,
|
375
|
+
:basename => "gitable.git",
|
376
|
+
:project_name => "gitable",
|
377
|
+
})
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Emde
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-12 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Use this like an Addressable::URI that understands the various git URI formats.
|
17
|
+
email: martin.emde@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- Gemfile
|
29
|
+
- LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
- Rakefile
|
32
|
+
- VERSION.yml
|
33
|
+
- gitable.gemspec
|
34
|
+
- lib/gitable.rb
|
35
|
+
- lib/gitable/scp_uri.rb
|
36
|
+
- lib/gitable/uri.rb
|
37
|
+
- spec/gitable_spec.rb
|
38
|
+
- spec/spec.opts
|
39
|
+
- spec/spec_helper.rb
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://github.com/martinemde/gitable
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --charset=UTF-8
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.3.5
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: Like Addressable::URI but for Git
|
68
|
+
test_files:
|
69
|
+
- spec/gitable_spec.rb
|
70
|
+
- spec/spec_helper.rb
|