instapusher 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instapusher/git.rb +31 -3
- data/lib/instapusher/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: c99ac26bd832d2ea814347f20c95c46e64223fd5
|
4
|
+
data.tar.gz: fd8429a7d948dc645724632047bd558f6e375634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba2ac27c31f803106e196416fcf619a6652b4b55fd305b4a161104e98f856e917e3be25f4e6f74187d7694a3bf2d21dbffe615516b93a28160988d4886bfc294
|
7
|
+
data.tar.gz: 90df9d1b741be8b0f9df8e9832dcc245ecd2708bcca0c461ecf07a3d15c368af745bfaf312a07df3470401f93fc127f011a2f6051bac2c4877894b0701a5e845
|
data/lib/instapusher/git.rb
CHANGED
@@ -1,4 +1,33 @@
|
|
1
1
|
module Instapusher
|
2
|
+
|
3
|
+
class RepoOwnerIdentifierService
|
4
|
+
|
5
|
+
attr_reader :string
|
6
|
+
|
7
|
+
def initialize string
|
8
|
+
@string = string
|
9
|
+
end
|
10
|
+
|
11
|
+
def process
|
12
|
+
string.include?('git@github.com') ? handle_ssh_version : handle_https_version
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def handle_ssh_version
|
18
|
+
regex = /.*:(.*)\/.*/
|
19
|
+
match_data = string.match(regex)
|
20
|
+
match_data.to_a.last
|
21
|
+
end
|
22
|
+
|
23
|
+
def handle_https_version
|
24
|
+
regex = /.*:\/\/github\.com\/(.*)\/.*/
|
25
|
+
match_data = string.match(regex)
|
26
|
+
match_data.to_a.last
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
2
31
|
class Git
|
3
32
|
def current_branch
|
4
33
|
result = %x{git branch}.split("\n")
|
@@ -22,10 +51,9 @@ module Instapusher
|
|
22
51
|
|
23
52
|
def repo_owner
|
24
53
|
string = `git remote -v | grep fetch | grep origin`
|
25
|
-
|
26
|
-
match_data = string.match(regex)
|
27
|
-
match_data.to_a.last
|
54
|
+
RepoOwnerIdentifierService.new(string).process
|
28
55
|
end
|
29
56
|
|
30
57
|
end
|
31
58
|
end
|
59
|
+
|
data/lib/instapusher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instapusher
|
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
|
- Neeraj Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashr
|