uri-ssh_git 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +18 -18
- data/example/simple.rb +0 -19
- data/lib/uri/ssh_git.rb +0 -8
- data/lib/uri/ssh_git/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9facd61c5f6b68e85e35b2dd61020b9af938a50c
|
4
|
+
data.tar.gz: cca70a7dd3fc346010500a4dd6c1c9750805bce6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dbf5ad7bcd4fb6873b41907b5f2ef1355351369261fa65c9b81309b783583938ffab83c0d7c62dd3c0ff72ce7b58d1c7707f1bdc73951aa921dccd9322cfc3b
|
7
|
+
data.tar.gz: f887deb4d55c63bb00495b712b3aa8ff8ddd628e282e63373ae5e2ddc64d4df08ffcc21b0e833c60ea46c184c89d0258e474f94713bde90487c60076c6f33cf2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -27,25 +27,25 @@ URI::SshGit.build(
|
|
27
27
|
path: '/packsaddle/ruby-uri-ssh_git.git'
|
28
28
|
).to_s
|
29
29
|
#=> 'git@github.com:packsaddle/ruby-uri-ssh_git.git'
|
30
|
+
```
|
31
|
+
|
32
|
+
## VS.
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
::URI
|
38
|
-
::URI
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
parsed.host
|
48
|
-
parsed.path
|
34
|
+
```ruby
|
35
|
+
# URI
|
36
|
+
url = URI.parse('git@github.com:schacon/ticgit.git')
|
37
|
+
URI::InvalidURIError: bad URI(is not URI?): git@github.com:schacon/ticgit.git
|
38
|
+
|
39
|
+
# Addressable
|
40
|
+
url = Addressable::URI.parse('git@github.com:schacon/ticgit.git')
|
41
|
+
#=> #<Addressable::URI:0x3fedf48fb430 URI:git@github.com:schacon/ticgit.git>
|
42
|
+
url.path #=> "schacon/ticgit.git"
|
43
|
+
url.scheme #=> "git@github.com"
|
44
|
+
|
45
|
+
url.host #=> nil
|
46
|
+
url.userinfo #=> nil
|
47
|
+
url.user #=> nil
|
48
|
+
url.port #=> nil
|
49
49
|
```
|
50
50
|
|
51
51
|
## Installation
|
data/example/simple.rb
CHANGED
@@ -23,22 +23,3 @@ URI::SshGit.build(
|
|
23
23
|
path: '/packsaddle/ruby-uri-ssh_git.git'
|
24
24
|
).to_s
|
25
25
|
#=> 'git@github.com:packsaddle/ruby-uri-ssh_git.git'
|
26
|
-
|
27
|
-
# Utility method
|
28
|
-
ssh_protocol = 'git@github.com:packsaddle/ruby-uri-ssh_git.git'
|
29
|
-
git_protocol = 'git://github.com/packsaddle/ruby-uri-ssh_git.git'
|
30
|
-
|
31
|
-
::URI::SshGit.ssh_protocol?(ssh_protocol) #=> true
|
32
|
-
::URI::SshGit.git_protocol?(ssh_protocol) #=> false
|
33
|
-
::URI::SshGit.ssh_protocol?(git_protocol) #=> false
|
34
|
-
::URI::SshGit.git_protocol?(git_protocol) #=> true
|
35
|
-
|
36
|
-
# Usage
|
37
|
-
git_clone_url = '...'
|
38
|
-
if ::URI::SshGit.ssh_protocol?(git_clone_url)
|
39
|
-
parsed = URI::SshGit.parse(git_clone_url)
|
40
|
-
else
|
41
|
-
parsed = URI.passe(git_clone_url)
|
42
|
-
end
|
43
|
-
parsed.host
|
44
|
-
parsed.path
|
data/lib/uri/ssh_git.rb
CHANGED
@@ -11,13 +11,5 @@ module URI
|
|
11
11
|
path_part = '/' + path_part unless path_part.start_with?('/')
|
12
12
|
Generic.build(userinfo: userinfo, host: host, path: path_part)
|
13
13
|
end
|
14
|
-
|
15
|
-
def self.ssh_protocol?(url_string)
|
16
|
-
url_string.include?('@')
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.git_protocol?(url_string)
|
20
|
-
!ssh_protocol?(url_string)
|
21
|
-
end
|
22
14
|
end
|
23
15
|
end
|
data/lib/uri/ssh_git/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-ssh_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|