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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0000410ddbf37ac304f869cbcd58b2653fed4fab
4
- data.tar.gz: 9c8a6d23f2bd2ce5eb996b32a78ec3897a672ba3
3
+ metadata.gz: c99ac26bd832d2ea814347f20c95c46e64223fd5
4
+ data.tar.gz: fd8429a7d948dc645724632047bd558f6e375634
5
5
  SHA512:
6
- metadata.gz: be31597850685a59a1a9457be8e2929cda5b2ea8636e13c9f7ab3dda8e46097c7c69c9e96523d61c430e6c78c2ef4fcc58698e12184a91ec36ac1b65d9031155
7
- data.tar.gz: 33b6659eb43856145493df8e1447ed7b437b144524e0adaad7bbee068abd8eee3fc8965cea6986774bf6d68d8548c7522a09926525bc8623ab31ce3366154f13
6
+ metadata.gz: ba2ac27c31f803106e196416fcf619a6652b4b55fd305b4a161104e98f856e917e3be25f4e6f74187d7694a3bf2d21dbffe615516b93a28160988d4886bfc294
7
+ data.tar.gz: 90df9d1b741be8b0f9df8e9832dcc245ecd2708bcca0c461ecf07a3d15c368af745bfaf312a07df3470401f93fc127f011a2f6051bac2c4877894b0701a5e845
@@ -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
- regex = /.*:(.*)\/.*/
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
+
@@ -1,3 +1,3 @@
1
1
  module Instapusher
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-18 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashr