gh_issues 0.4.2 → 0.4.3

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: 96ab8f14adbb02035f2efadbe0e99d0474846105
4
- data.tar.gz: 93a7f5282e3d85d3c5c8e3bc1bc6dfe7adcefcac
3
+ metadata.gz: 5b0d505fac7a1bb75bbf295f9e16a0d0db61ce5f
4
+ data.tar.gz: f5b56d9e41e7854f5e284e38a218c14fb87b82e3
5
5
  SHA512:
6
- metadata.gz: 1020914f4026e54c49874866304984ba0ed449dc014fe3c403c13ec3ac8b16696e8edc4fa8737ceb979d486a0faaae8599d4af688553324273d1ae30c762270d
7
- data.tar.gz: 3ba34ec88613ec8fbab82c9faee5c274c25eec25eb81f409ae53382842bee4271027a1ae3ab9aae9086368f2fced919fb2bf61a623c44ff428a9b41ac3c4496d
6
+ metadata.gz: 7cbf52e813eb6a6782de9c20d7ef07867f676f75bb20d47a75f17ff653ace4d8c55b336c4d9bf60f947da70555c2a0e4f1f4158405b6294689136056b0bc1127
7
+ data.tar.gz: ada4c8d0a0efaa8d822ee6575d961ba6f7b0b1d006fdf5e33e8dd0fe61d2b811cba6097bb74e370fb5bccd1306355a253180171f4054eafe46fd115f8daa57d3
@@ -110,6 +110,22 @@ module GhIssues
110
110
  end
111
111
  end
112
112
 
113
+ def self.in_github_repo?(url)
114
+ _rv = false
115
+ _rv = true if url =~ /\/\/github.com\//
116
+ _rv = true if url =~ /github\.com\:/
117
+ _rv
118
+ end
119
+
120
+ def self.get_repo_name(url)
121
+ return nil unless ::GhIssues.in_github_repo?(url)
122
+ https_matches = /https?\:\/\/github\.com\/(.[^\.]+)\/(.[^\.]+)/.match(url)
123
+ return "#{https_matches[1]}/#{https_matches[2]}" if https_matches
124
+ ssh_matches = /git\@github\.com\:(.[^\.]+)\/(.[^\.]+)/.match(url)
125
+ return "#{ssh_matches[1]}/#{ssh_matches[2]}" if ssh_matches
126
+ return nil
127
+ end
128
+
113
129
  def self.all_issues
114
130
  if ::GhIssues.ghi_access_available?
115
131
  open_issues = {}
@@ -95,15 +95,12 @@ module GhIssues
95
95
  def show(repo=nil, issue_number=0)
96
96
  ENV['GH_ISSUES_COLORIZE'] = '1' if options[:color]
97
97
 
98
- in_github_repo = false
99
- current_repo = nil
100
98
  origin_url=`git remote get-url origin 2>/dev/null`.strip
101
- unless origin_url.empty?
102
- in_github_repo = true if origin_url.split(':')[0] =~ /github.com/
99
+ current_repo = nil
100
+ if GhIssues.in_github_repo?(origin_url)
101
+ current_repo = GhIssues.get_repo_name(origin_url)
103
102
  end
104
103
 
105
- current_repo = origin_url.split(':')[1].split('.git')[0] if in_github_repo
106
-
107
104
  unless repo
108
105
  repo = current_repo if current_repo
109
106
  else
@@ -112,6 +109,7 @@ module GhIssues
112
109
  repo = current_repo
113
110
  end
114
111
  end
112
+
115
113
  issue_number = issue_number.to_i
116
114
 
117
115
  puts "Listing current GitHub repo: #{repo}" if repo == current_repo
@@ -1,3 +1,3 @@
1
1
  module GhIssues
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh_issues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uğur Özyılmazel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.5.1
208
+ rubygems_version: 2.5.2
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Manage your GitHub issues from command-line.