vpr 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/vpr.rb +1 -0
- data/lib/vpr/cli.rb +11 -8
- data/lib/vpr/services.rb +6 -0
- data/lib/vpr/services/bitbucket.rb +39 -0
- data/lib/vpr/services/github.rb +39 -0
- data/lib/vpr/url.rb +29 -36
- data/lib/vpr/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f2b50b7f24767c045785625093f2899cf4f73e8d72fe2274d8024a1e0288d17
|
4
|
+
data.tar.gz: 6fa5994c36cdb70e5d2b463e5a1bc46881e42e4d815a24495defda8c9b342d0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2a03178f51fe9c5e5ec57004cfce96ca220268e124bc50f3354139d8aea02b2a6f4d236d7a5dd85587ce0ac2baafb6d8a2943a248fe239010c956f7b57bdb41
|
7
|
+
data.tar.gz: 2e873e016ba661bbba0974d94da5bcfadf2815e9561e9c2905ec01a04404a38731d114d638723fe2ee3348439f8228bf52b1301beb423619c621822a8fd7a91c
|
data/Gemfile.lock
CHANGED
data/lib/vpr.rb
CHANGED
data/lib/vpr/cli.rb
CHANGED
@@ -9,6 +9,7 @@ module Vpr
|
|
9
9
|
def initialize(args = [], local_options = {}, config = {})
|
10
10
|
super
|
11
11
|
select_remote
|
12
|
+
@url = Url.new
|
12
13
|
end
|
13
14
|
|
14
15
|
map "--version" => :version
|
@@ -16,42 +17,42 @@ module Vpr
|
|
16
17
|
|
17
18
|
desc "home", "visit the project page in github"
|
18
19
|
def home
|
19
|
-
Launchy.open(
|
20
|
+
Launchy.open(url.home_url)
|
20
21
|
end
|
21
22
|
|
22
23
|
desc "pulls", "visit the project pull requests page in github"
|
23
24
|
def pulls
|
24
|
-
Launchy.open(
|
25
|
+
Launchy.open(url.pulls_url)
|
25
26
|
end
|
26
27
|
|
27
28
|
desc "issues", "visit the project issues page in github"
|
28
29
|
def issues
|
29
|
-
Launchy.open(
|
30
|
+
Launchy.open(url.issues_url)
|
30
31
|
end
|
31
32
|
|
32
33
|
desc "branches", "visit the project branches page in github"
|
33
34
|
def branches
|
34
|
-
Launchy.open(
|
35
|
+
Launchy.open(url.branches_url)
|
35
36
|
end
|
36
37
|
|
37
38
|
desc "branch", "visit the current branch in github"
|
38
39
|
def branch
|
39
|
-
Launchy.open(
|
40
|
+
Launchy.open(url.branch_url)
|
40
41
|
end
|
41
42
|
|
42
43
|
desc "pull", "visit the pull request for the current branch (if exist) in github"
|
43
44
|
def pull
|
44
|
-
Launchy.open(
|
45
|
+
Launchy.open(url.pull_url)
|
45
46
|
end
|
46
47
|
|
47
48
|
desc "visit COMMIT", "visit the commit in github"
|
48
49
|
def visit(commit)
|
49
|
-
Launchy.open(
|
50
|
+
Launchy.open(url.commit_url(commit))
|
50
51
|
end
|
51
52
|
|
52
53
|
desc "search COMMIT", "search the commit in github"
|
53
54
|
def search(commit)
|
54
|
-
Launchy.open(
|
55
|
+
Launchy.open(url.search_url(commit))
|
55
56
|
end
|
56
57
|
|
57
58
|
desc "version", "show the gem version"
|
@@ -64,5 +65,7 @@ module Vpr
|
|
64
65
|
def select_remote
|
65
66
|
Configuration.remote = options[:remote].to_sym
|
66
67
|
end
|
68
|
+
|
69
|
+
attr_reader :url
|
67
70
|
end
|
68
71
|
end
|
data/lib/vpr/services.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "vpr/git_parser"
|
2
|
+
|
3
|
+
module Vpr
|
4
|
+
module Services
|
5
|
+
class Bitbucket
|
6
|
+
def self.home_url
|
7
|
+
GitParser.repo_url
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.pulls_url
|
11
|
+
"#{GitParser.repo_url}/pull-requests"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.issues_url
|
15
|
+
"#{GitParser.repo_url}/issues"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.branches_url
|
19
|
+
"#{GitParser.repo_url}/branches"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.branch_url
|
23
|
+
"#{GitParser.repo_url}/branch/#{GitParser.current_branch}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.pull_url
|
27
|
+
"#{GitParser.repo_url}/pull-requests/new?source=#{GitParser.current_branch}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.commit_url(commit)
|
31
|
+
"#{GitParser.repo_url}/commits/#{commit}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.search_url(commit)
|
35
|
+
"#{GitParser.repo_url}/commits/all?search=#{commit}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "vpr/git_parser"
|
2
|
+
|
3
|
+
module Vpr
|
4
|
+
module Services
|
5
|
+
class GitHub
|
6
|
+
def self.home_url
|
7
|
+
GitParser.repo_url
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.pulls_url
|
11
|
+
"#{GitParser.repo_url}/pulls"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.issues_url
|
15
|
+
"#{GitParser.repo_url}/issues"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.branches_url
|
19
|
+
"#{GitParser.repo_url}/branches"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.branch_url
|
23
|
+
"#{GitParser.repo_url}/tree/#{GitParser.current_branch}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.pull_url
|
27
|
+
"#{GitParser.repo_url}/pull/#{GitParser.current_branch}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.commit_url(commit)
|
31
|
+
"#{GitParser.repo_url}/commit/#{commit}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.search_url(commit)
|
35
|
+
"#{GitParser.repo_url}/search?q=#{commit}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/vpr/url.rb
CHANGED
@@ -1,60 +1,53 @@
|
|
1
1
|
require "vpr/git_parser"
|
2
|
+
require "vpr/services"
|
2
3
|
|
3
4
|
module Vpr
|
4
5
|
class Url
|
5
|
-
def
|
6
|
-
GitParser.
|
6
|
+
def initialize
|
7
|
+
@service = services[GitParser.host.to_sym]
|
7
8
|
end
|
8
9
|
|
9
|
-
def
|
10
|
-
|
11
|
-
'github.com': "pulls",
|
12
|
-
'bitbucket.org': "pull-requests",
|
13
|
-
}
|
14
|
-
|
15
|
-
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}"
|
10
|
+
def home_url
|
11
|
+
service.home_url
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
|
14
|
+
def pulls_url
|
15
|
+
service.pulls_url
|
20
16
|
end
|
21
17
|
|
22
|
-
def
|
23
|
-
|
18
|
+
def issues_url
|
19
|
+
service.issues_url
|
24
20
|
end
|
25
21
|
|
26
|
-
def
|
27
|
-
|
28
|
-
'github.com': "tree",
|
29
|
-
'bitbucket.org': "branch",
|
30
|
-
}
|
31
|
-
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}/#{GitParser.current_branch}"
|
22
|
+
def branches_url
|
23
|
+
service.branches_url
|
32
24
|
end
|
33
25
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
'bitbucket.org': "pull-requests/new?source=#{GitParser.current_branch}",
|
38
|
-
}
|
26
|
+
def branch_url
|
27
|
+
service.branch_url
|
28
|
+
end
|
39
29
|
|
40
|
-
|
30
|
+
def pull_url
|
31
|
+
service.pull_url
|
41
32
|
end
|
42
33
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
'bitbucket.org': "commits",
|
47
|
-
}
|
34
|
+
def commit_url(commit)
|
35
|
+
service.commit_url(commit)
|
36
|
+
end
|
48
37
|
|
49
|
-
|
38
|
+
def search_url(commit)
|
39
|
+
service.search_url(commit)
|
50
40
|
end
|
51
41
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
42
|
+
private
|
43
|
+
|
44
|
+
def services
|
45
|
+
{
|
46
|
+
'github.com': Vpr::Services::GitHub,
|
47
|
+
'bitbucket.org': Vpr::Services::Bitbucket,
|
56
48
|
}
|
57
|
-
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}#{commit}"
|
58
49
|
end
|
50
|
+
|
51
|
+
attr_reader :service
|
59
52
|
end
|
60
53
|
end
|
data/lib/vpr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Carlos Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,6 +162,9 @@ files:
|
|
162
162
|
- lib/vpr/cli.rb
|
163
163
|
- lib/vpr/configuration.rb
|
164
164
|
- lib/vpr/git_parser.rb
|
165
|
+
- lib/vpr/services.rb
|
166
|
+
- lib/vpr/services/bitbucket.rb
|
167
|
+
- lib/vpr/services/github.rb
|
165
168
|
- lib/vpr/url.rb
|
166
169
|
- lib/vpr/version.rb
|
167
170
|
- vpr.gemspec
|