File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1
1
Gem ::Specification . new do |s |
2
2
s . authors = [ 'Scott Chacon' ]
3
- s . date = '2015-01-13'
3
+ s . date = '2015-01-13'
4
4
s . email = 'schacon@gmail.com'
5
5
s . homepage = 'http://github.com/schacon/ruby-git'
6
6
s . license = 'MIT'
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
s . add_development_dependency 'rake'
16
16
s . add_development_dependency 'rdoc'
17
17
s . add_development_dependency 'test-unit' , '>=2' , '< 4'
18
-
18
+
19
19
s . extra_rdoc_files = [ 'README.md' ]
20
20
s . rdoc_options = [ '--charset=UTF-8' ]
21
21
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
'lib/git/stashes.rb' ,
44
44
'lib/git/status.rb' ,
45
45
'lib/git/version.rb' ,
46
- 'lib/git/working_directory.rb'
46
+ 'lib/git/working_directory.rb' ,
47
+ 'lib/git/utils.rb'
47
48
]
48
49
end
Original file line number Diff line number Diff line change 20
20
require 'git/stash'
21
21
require 'git/stashes'
22
22
require 'git/working_directory'
23
+ require 'git/utils'
23
24
24
25
lib = Git ::Lib . new ( nil , nil )
25
26
unless lib . meets_required_version?
Original file line number Diff line number Diff line change
1
+ require 'uri'
2
+
3
+ module Git
4
+ class Utils
5
+ def self . url_to_ssh ( url )
6
+ uri = URI ( url )
7
+ "git@#{ uri . host } :#{ uri . path [ 1 ..-1 ] } "
8
+ end
9
+ end
10
+ end
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+
3
+ require File . dirname ( __FILE__ ) + '/../test_helper'
4
+
5
+ class TestUtils < Test ::Unit ::TestCase
6
+
7
+ def test_uri_to_ssh
8
+ assert_equal ( 'git@github.com:user/repo.git' , Git ::Utils . url_to_ssh ( 'https://github.com/user/repo.git' ) )
9
+ assert_equal ( 'git@bitbucket.org:user/repo.git' , Git ::Utils . url_to_ssh ( 'https://bitbucket.org/user/repo.git' ) )
10
+ end
11
+
12
+ end
You can’t perform that action at this time.
0 commit comments