pry-github 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pry-github.rb +7 -5
- data/lib/pry-github/version.rb +1 -1
- metadata +2 -3
data/lib/pry-github.rb
CHANGED
@@ -6,6 +6,7 @@ require 'launchy'
|
|
6
6
|
|
7
7
|
require 'uri'
|
8
8
|
require 'net/http'
|
9
|
+
require 'open3'
|
9
10
|
|
10
11
|
module PryGithub
|
11
12
|
module GithubHelpers
|
@@ -26,7 +27,7 @@ module PryGithub
|
|
26
27
|
search_line = meth.source.lines.first.strip
|
27
28
|
_, start_line = code.lines.to_a.each_with_index.find { |v, i| v.strip == search_line }
|
28
29
|
|
29
|
-
raise "Can't find #{args[0]} in the repo. Perhaps it hasn't been committed yet." unless start_line
|
30
|
+
raise Pry::CommandError, "Can't find #{args[0]} in the repo. Perhaps it hasn't been committed yet." unless start_line
|
30
31
|
|
31
32
|
start_line
|
32
33
|
[Pry.new(:input => StringIO.new(code.lines.to_a[start_line..-1].join)).r(target), start_line + 1]
|
@@ -38,12 +39,13 @@ module PryGithub
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def find_git_root(dir)
|
41
|
-
git_root =
|
42
|
+
git_root = nil
|
42
43
|
Dir.chdir dir do
|
43
|
-
git_root =
|
44
|
+
git_root, _ = Open3.capture2e("git rev-parse --show-toplevel")
|
45
|
+
git_root = git_root.chomp
|
44
46
|
end
|
45
47
|
|
46
|
-
raise "No
|
48
|
+
raise Pry::CommandError, "No git repository found in #{dir}" if git_root =~ /fatal:/
|
47
49
|
git_root
|
48
50
|
end
|
49
51
|
|
@@ -51,7 +53,7 @@ module PryGithub
|
|
51
53
|
remote_urls = repo.remotes.map { |remote| repo.config["remote.#{remote.name.split('/')[0]}.url"] }
|
52
54
|
gh_url = remote_urls.find { |url| url =~ /github\.com/ }
|
53
55
|
|
54
|
-
raise "No GitHub remote found!" unless gh_url
|
56
|
+
raise Pry::CommandError, "No GitHub remote found!" unless gh_url
|
55
57
|
gh_url
|
56
58
|
end
|
57
59
|
|
data/lib/pry-github/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -115,4 +115,3 @@ signing_key:
|
|
115
115
|
specification_version: 3
|
116
116
|
summary: Make pry play nice with GitHub
|
117
117
|
test_files: []
|
118
|
-
has_rdoc:
|