gitable 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/README.rdoc +21 -0
- data/gitable.gemspec +1 -1
- data/lib/gitable/uri.rb +20 -0
- data/spec/gitable_spec.rb +15 -0
- metadata +13 -12
data/.travis.yml
ADDED
data/README.rdoc
CHANGED
@@ -16,12 +16,33 @@ Works with any valid Git URI, because Addressable doesn't.
|
|
16
16
|
# Maintain the same url format.
|
17
17
|
uri.to_s # => 'git@github.com:martinemde/gitable.git'
|
18
18
|
|
19
|
+
# Uses ssh?
|
20
|
+
uri.ssh? # => true
|
21
|
+
|
22
|
+
# scp format?
|
23
|
+
uri.scp? # => true
|
24
|
+
|
19
25
|
# If it can't guess the name, you named your repository wrong.
|
20
26
|
uri.project_name # => 'gitable'
|
21
27
|
|
28
|
+
# Will this uri require authentication?
|
29
|
+
uri.authenticated? # => true
|
30
|
+
|
31
|
+
# Will I have to interactively type something into git (a password)?
|
32
|
+
uri.interactive_authenticated? # => false
|
33
|
+
|
34
|
+
# Matching public to private git uris?
|
35
|
+
uri.equivalent?('git://github.com/martinemde/gitable.git') # => true
|
36
|
+
uri.equivalent?('https://martinemde@github.com/martinemde/gitable.git') # => true
|
37
|
+
|
22
38
|
# Inherited from Addressable::URI
|
23
39
|
uri.kind_of?(Addressable::URI) # => true
|
24
40
|
|
41
|
+
# Teenage Mutant Ninja Urls (mutable uris like Addressable, if you want)
|
42
|
+
uri.path = 'someotheruser/gitable.git'
|
43
|
+
uri.basename = 'umm.git'
|
44
|
+
uri.to_s # => 'git@github.com:someotheruser/umm.git'
|
45
|
+
|
25
46
|
== heuristic_parse
|
26
47
|
|
27
48
|
You can use Gitable::URI.heuristic_parse to take user input.
|
data/gitable.gemspec
CHANGED
data/lib/gitable/uri.rb
CHANGED
@@ -26,6 +26,19 @@ module Gitable
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
##
|
30
|
+
# Parse a git repository URI into a URI object.
|
31
|
+
# Rescue parse errors and return nil if uri is not parseable.
|
32
|
+
#
|
33
|
+
# @param [Addressable::URI, #to_str] uri URI of a git repository.
|
34
|
+
#
|
35
|
+
# @return [Gitable::URI, nil] The parsed uri, or nil if not parseable.
|
36
|
+
def self.parse_when_valid(uri)
|
37
|
+
parse(uri)
|
38
|
+
rescue TypeError, Gitable::URI::InvalidURIError
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
29
42
|
##
|
30
43
|
# Attempts to make a copied URL bar into a git repository URI.
|
31
44
|
#
|
@@ -153,6 +166,13 @@ module Gitable
|
|
153
166
|
false
|
154
167
|
end
|
155
168
|
|
169
|
+
# Dun da dun da dun, Inspector Gadget.
|
170
|
+
#
|
171
|
+
# @return [String] I'll get you next time Gadget, NEXT TIME!
|
172
|
+
def inspect
|
173
|
+
"#<#{self.class.to_s} #{to_s}>"
|
174
|
+
end
|
175
|
+
|
156
176
|
# Set an extension name, replacing one if it exists.
|
157
177
|
#
|
158
178
|
# If there is no basename (i.e. no words in the path) this method call will
|
data/spec/gitable_spec.rb
CHANGED
@@ -90,6 +90,10 @@ describe Gitable::URI do
|
|
90
90
|
}.should raise_error(TypeError)
|
91
91
|
end
|
92
92
|
|
93
|
+
it "returns nil with bad type on parse_when_valid" do
|
94
|
+
Gitable::URI.parse_when_valid(42).should be_nil
|
95
|
+
end
|
96
|
+
|
93
97
|
context "(bad uris)" do
|
94
98
|
[
|
95
99
|
"http://", # nothing but scheme
|
@@ -102,6 +106,10 @@ describe Gitable::URI do
|
|
102
106
|
Gitable::URI.parse(uri)
|
103
107
|
}.should raise_error(Gitable::URI::InvalidURIError)
|
104
108
|
end
|
109
|
+
|
110
|
+
it "returns nil on parse_when_valid with #{uri.inspect}" do
|
111
|
+
Gitable::URI.parse_when_valid(uri).should be_nil
|
112
|
+
end
|
105
113
|
end
|
106
114
|
|
107
115
|
context "scp uris" do
|
@@ -458,6 +466,7 @@ describe Gitable::URI do
|
|
458
466
|
|
459
467
|
describe_uri "/path/to/repo.git/" do
|
460
468
|
it { subject.to_s.should == @uri }
|
469
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
461
470
|
it { subject.should be_equivalent(@uri) }
|
462
471
|
it { subject.should be_equivalent('/path/to/repo.git') }
|
463
472
|
it { subject.should be_equivalent('file:///path/to/repo.git') }
|
@@ -476,6 +485,7 @@ describe Gitable::URI do
|
|
476
485
|
|
477
486
|
describe_uri "file:///path/to/repo.git/" do
|
478
487
|
it { subject.to_s.should == @uri }
|
488
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
479
489
|
it { subject.should be_equivalent(@uri) }
|
480
490
|
it { subject.should be_equivalent('/path/to/repo.git') }
|
481
491
|
it { subject.should be_equivalent('file:///path/to/repo.git') }
|
@@ -494,6 +504,7 @@ describe Gitable::URI do
|
|
494
504
|
|
495
505
|
describe_uri "ssh://git@github.com/martinemde/gitable.git" do
|
496
506
|
it { subject.to_s.should == @uri }
|
507
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
497
508
|
it { subject.should be_equivalent(@uri) }
|
498
509
|
it { subject.should be_equivalent('git://github.com/martinemde/gitable.git') }
|
499
510
|
it { subject.should be_equivalent('git@github.com:martinemde/gitable.git') }
|
@@ -521,6 +532,7 @@ describe Gitable::URI do
|
|
521
532
|
|
522
533
|
describe_uri "https://github.com/martinemde/gitable.git" do
|
523
534
|
it { subject.to_s.should == @uri }
|
535
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
524
536
|
it { subject.should be_equivalent(@uri) }
|
525
537
|
it { subject.should be_equivalent('ssh://git@github.com/martinemde/gitable.git') }
|
526
538
|
it { subject.should be_equivalent('git://github.com/martinemde/gitable.git') }
|
@@ -546,6 +558,7 @@ describe Gitable::URI do
|
|
546
558
|
|
547
559
|
describe_uri "https://martinemde@github.com/martinemde/gitable.git" do
|
548
560
|
it { subject.to_s.should == @uri }
|
561
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
549
562
|
it { subject.should be_equivalent(@uri) }
|
550
563
|
it { subject.should be_equivalent('ssh://git@github.com/martinemde/gitable.git') }
|
551
564
|
it { subject.should be_equivalent('git://github.com/martinemde/gitable.git') }
|
@@ -574,6 +587,7 @@ describe Gitable::URI do
|
|
574
587
|
|
575
588
|
describe_uri "git://github.com/martinemde/gitable.git" do
|
576
589
|
it { subject.to_s.should == @uri }
|
590
|
+
it { subject.inspect.should =~ %r|^#<Gitable::URI #{@uri}>$| }
|
577
591
|
it { subject.should be_equivalent(@uri) }
|
578
592
|
it { subject.should be_equivalent('ssh://git@github.com/martinemde/gitable.git') }
|
579
593
|
it { subject.should be_equivalent('git@github.com:martinemde/gitable.git') }
|
@@ -601,6 +615,7 @@ describe Gitable::URI do
|
|
601
615
|
|
602
616
|
describe_uri "git@github.com:martinemde/gitable.git" do
|
603
617
|
it { subject.to_s.should == @uri }
|
618
|
+
it { subject.inspect.should =~ %r|^#<Gitable::ScpURI #{@uri}>$| }
|
604
619
|
it { subject.should be_equivalent(@uri) }
|
605
620
|
it { subject.should be_equivalent('ssh://git@github.com/martinemde/gitable.git') }
|
606
621
|
it { subject.should be_equivalent('git://github.com/martinemde/gitable.git') }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
16
|
-
requirement: &
|
16
|
+
requirement: &70120045559900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70120045559900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70120045559360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70120045559360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70120045558940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70120045558940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &70120045558480 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70120045558480
|
58
58
|
description: Addressable::URI for Git URIs with special handling for scp-style URIs
|
59
59
|
that Addressable doesn't like.
|
60
60
|
email:
|
@@ -67,6 +67,7 @@ extra_rdoc_files:
|
|
67
67
|
files:
|
68
68
|
- .document
|
69
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
70
71
|
- Gemfile
|
71
72
|
- LICENSE
|
72
73
|
- README.rdoc
|
@@ -93,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
94
|
version: '0'
|
94
95
|
segments:
|
95
96
|
- 0
|
96
|
-
hash:
|
97
|
+
hash: -3667744996364921328
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
none: false
|
99
100
|
requirements:
|
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
version: '0'
|
103
104
|
segments:
|
104
105
|
- 0
|
105
|
-
hash:
|
106
|
+
hash: -3667744996364921328
|
106
107
|
requirements: []
|
107
108
|
rubyforge_project:
|
108
109
|
rubygems_version: 1.8.10
|