vpr 1.0.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +32 -0
- data/.github/workflows/standardrb.yml +20 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +28 -2
- data/Gemfile.lock +39 -12
- data/README.md +3 -0
- data/Rakefile +7 -6
- data/exe/vpr +1 -2
- data/lib/vpr.rb +6 -5
- data/lib/vpr/cli.rb +43 -19
- data/lib/vpr/configuration.rb +26 -0
- data/lib/vpr/git_parser.rb +35 -13
- data/lib/vpr/services.rb +6 -0
- data/lib/vpr/services/bitbucket.rb +39 -0
- data/lib/vpr/services/github.rb +44 -0
- data/lib/vpr/url.rb +33 -17
- data/lib/vpr/version.rb +1 -1
- data/vpr.gemspec +22 -21
- metadata +42 -9
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4392e553d246cbcdc5eae1a5f1489adf327b487ff6bbc9804cfbe2c84ee69bb
|
4
|
+
data.tar.gz: a855bdaf9bc749e169b8c088d64de873749bf0ba6012f24f4a57965d5cdad303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553418872ac7f362acfafa88f54a5674c9bcade97e7e1315a7914cb4fb9322789e3aa48404fb0196b7506468cc4dddbf70cda558c9daabcf494df65667d72901
|
7
|
+
data.tar.gz: 7ca2e72a8062ee6c3ba139c35c5f8538052e1301d1b3d1e7b1f1b5706922111f7186d541552ae754a12d7c2748343db7ff8e67c451bd2156acb4d851cabfec6e
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
branches: [ master ]
|
5
|
+
push:
|
6
|
+
branches: [ master ]
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby_version: [ '2.5', '2.6', '2.7' ]
|
13
|
+
steps:
|
14
|
+
- name: Checkout
|
15
|
+
uses: actions/checkout@v2
|
16
|
+
- name: Setup ruby ${{ matrix.ruby_version }}
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby_version }}
|
20
|
+
- name: Setup cache key and directory for gems cache
|
21
|
+
uses: actions/cache@v1
|
22
|
+
with:
|
23
|
+
path: vendor/bundle
|
24
|
+
key: ${{ runner.os }}-gem-use-ruby-${{ matrix.ruby_version }}-${{ hashFiles('**/Gemfile.lock') }}
|
25
|
+
- name: Bundle install
|
26
|
+
run: |
|
27
|
+
gem install bundler
|
28
|
+
bundle config path vendor/bundle
|
29
|
+
bundle install --jobs 4 --retry 3
|
30
|
+
- name: Run tests
|
31
|
+
run: |
|
32
|
+
bundle exec rspec --format progress
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: StandardRB
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
standard:
|
13
|
+
name: StandardRB Check Action
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@master
|
17
|
+
- name: Standard
|
18
|
+
uses: CultureHQ/actions-bundler@master
|
19
|
+
with:
|
20
|
+
args: install && bundle exec standardrb --format progress
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,36 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/
|
3
|
+
## [2.0.0](https://github.com/JuanCrg90/vpr/tree/2.0.0) (2019-11-09)
|
4
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/v1.0.0...2.0.0)
|
5
5
|
|
6
6
|
**Merged pull requests:**
|
7
7
|
|
8
|
+
- Bump version 2 [\#31](https://github.com/JuanCrg90/vpr/pull/31) ([JuanCrg90](https://github.com/JuanCrg90))
|
9
|
+
- Add support vpr branch in bitbucket https://github.com/JuanCrg90/vpr/issues/18 [\#30](https://github.com/JuanCrg90/vpr/pull/30) ([n8chz](https://github.com/n8chz))
|
10
|
+
- Add vendor to gitignore [\#28](https://github.com/JuanCrg90/vpr/pull/28) ([JuanCrg90](https://github.com/JuanCrg90))
|
11
|
+
- Add test for search page url [\#27](https://github.com/JuanCrg90/vpr/pull/27) ([JuanCrg90](https://github.com/JuanCrg90))
|
12
|
+
- Bitbucket Pulls Command [\#26](https://github.com/JuanCrg90/vpr/pull/26) ([pathway27](https://github.com/pathway27))
|
13
|
+
- per "https://github.com/JuanCrg90/vpr/issues/20" corrected pathname f… [\#25](https://github.com/JuanCrg90/vpr/pull/25) ([n8chz](https://github.com/n8chz))
|
14
|
+
- Add standardrb checks to default rake task [\#24](https://github.com/JuanCrg90/vpr/pull/24) ([schmidt](https://github.com/schmidt))
|
15
|
+
- Allow to use vpr even if you are not in the root directory [\#23](https://github.com/JuanCrg90/vpr/pull/23) ([schmidt](https://github.com/schmidt))
|
16
|
+
- Allow pull command for Bitbucket repos [\#22](https://github.com/JuanCrg90/vpr/pull/22) ([pathway27](https://github.com/pathway27))
|
17
|
+
- Fix test suite [\#21](https://github.com/JuanCrg90/vpr/pull/21) ([EduardoGHdez](https://github.com/EduardoGHdez))
|
18
|
+
- Remove .travis.yml [\#16](https://github.com/JuanCrg90/vpr/pull/16) ([JuanCrg90](https://github.com/JuanCrg90))
|
19
|
+
- Add circle CI badge [\#15](https://github.com/JuanCrg90/vpr/pull/15) ([JuanCrg90](https://github.com/JuanCrg90))
|
20
|
+
- add standardrb [\#14](https://github.com/JuanCrg90/vpr/pull/14) ([andrewmcodes](https://github.com/andrewmcodes))
|
21
|
+
- Support to select remote branch to visit [\#13](https://github.com/JuanCrg90/vpr/pull/13) ([EduardoGHdez](https://github.com/EduardoGHdez))
|
22
|
+
- Add vpr --version command [\#11](https://github.com/JuanCrg90/vpr/pull/11) ([andrewmcodes](https://github.com/andrewmcodes))
|
23
|
+
- Update circle ci config [\#7](https://github.com/JuanCrg90/vpr/pull/7) ([JuanCrg90](https://github.com/JuanCrg90))
|
24
|
+
- Add basic circle ci configuration [\#6](https://github.com/JuanCrg90/vpr/pull/6) ([JuanCrg90](https://github.com/JuanCrg90))
|
25
|
+
- Add support for bitbucket in visit method [\#5](https://github.com/JuanCrg90/vpr/pull/5) ([JuanCrg90](https://github.com/JuanCrg90))
|
26
|
+
|
27
|
+
## [v1.0.0](https://github.com/JuanCrg90/vpr/tree/v1.0.0) (2019-07-12)
|
28
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/v0.2.0...v1.0.0)
|
29
|
+
|
30
|
+
**Merged pull requests:**
|
31
|
+
|
32
|
+
- Bump version 1.0.0 [\#4](https://github.com/JuanCrg90/vpr/pull/4) ([JuanCrg90](https://github.com/JuanCrg90))
|
33
|
+
- Add changelog [\#3](https://github.com/JuanCrg90/vpr/pull/3) ([JuanCrg90](https://github.com/JuanCrg90))
|
8
34
|
- Add regular GitHub project actions [\#2](https://github.com/JuanCrg90/vpr/pull/2) ([JuanCrg90](https://github.com/JuanCrg90))
|
9
35
|
|
10
36
|
## [v0.2.0](https://github.com/JuanCrg90/vpr/tree/v0.2.0) (2019-07-10)
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vpr (
|
5
|
-
git (~> 1.
|
4
|
+
vpr (2.2.1)
|
5
|
+
git (~> 1.7)
|
6
6
|
launchy (~> 2.4)
|
7
7
|
thor (~> 0.20)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (6.0.3.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
17
18
|
addressable (2.6.0)
|
18
19
|
public_suffix (>= 2.0.2, < 4.0)
|
19
|
-
|
20
|
+
ast (2.4.0)
|
21
|
+
concurrent-ruby (1.1.6)
|
20
22
|
diff-lcs (1.3)
|
21
23
|
faraday (0.15.4)
|
22
24
|
multipart-post (>= 1.2, < 3)
|
23
25
|
faraday-http-cache (2.0.0)
|
24
26
|
faraday (~> 0.8)
|
25
|
-
git (1.
|
27
|
+
git (1.7.0)
|
28
|
+
rchardet (~> 1.8)
|
26
29
|
github_changelog_generator (1.14.3)
|
27
30
|
activesupport
|
28
31
|
faraday-http-cache
|
@@ -31,18 +34,23 @@ GEM
|
|
31
34
|
rainbow (>= 2.1)
|
32
35
|
rake (>= 10.0)
|
33
36
|
retriable (~> 2.1)
|
34
|
-
i18n (1.
|
37
|
+
i18n (1.8.2)
|
35
38
|
concurrent-ruby (~> 1.0)
|
39
|
+
jaro_winkler (1.5.3)
|
36
40
|
launchy (2.4.3)
|
37
41
|
addressable (~> 2.3)
|
38
|
-
minitest (5.
|
42
|
+
minitest (5.14.1)
|
39
43
|
multi_json (1.13.1)
|
40
44
|
multipart-post (2.1.1)
|
41
45
|
octokit (4.14.0)
|
42
46
|
sawyer (~> 0.8.0, >= 0.5.3)
|
47
|
+
parallel (1.17.0)
|
48
|
+
parser (2.6.5.0)
|
49
|
+
ast (~> 2.4.0)
|
43
50
|
public_suffix (3.1.1)
|
44
51
|
rainbow (3.0.0)
|
45
|
-
rake (
|
52
|
+
rake (13.0.1)
|
53
|
+
rchardet (1.8.0)
|
46
54
|
retriable (2.1.0)
|
47
55
|
rspec (3.8.0)
|
48
56
|
rspec-core (~> 3.8.0)
|
@@ -57,23 +65,42 @@ GEM
|
|
57
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
66
|
rspec-support (~> 3.8.0)
|
59
67
|
rspec-support (3.8.2)
|
68
|
+
rspec_junit_formatter (0.4.1)
|
69
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
70
|
+
rubocop (0.72.0)
|
71
|
+
jaro_winkler (~> 1.5.1)
|
72
|
+
parallel (~> 1.10)
|
73
|
+
parser (>= 2.6)
|
74
|
+
rainbow (>= 2.2.2, < 4.0)
|
75
|
+
ruby-progressbar (~> 1.7)
|
76
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
77
|
+
rubocop-performance (1.4.1)
|
78
|
+
rubocop (>= 0.71.0)
|
79
|
+
ruby-progressbar (1.10.1)
|
60
80
|
sawyer (0.8.2)
|
61
81
|
addressable (>= 2.3.5)
|
62
82
|
faraday (> 0.8, < 2.0)
|
83
|
+
standard (0.1.4)
|
84
|
+
rubocop (~> 0.72.0)
|
85
|
+
rubocop-performance (~> 1.4.0)
|
63
86
|
thor (0.20.3)
|
64
87
|
thread_safe (0.3.6)
|
65
|
-
tzinfo (1.2.
|
88
|
+
tzinfo (1.2.7)
|
66
89
|
thread_safe (~> 0.1)
|
90
|
+
unicode-display_width (1.6.0)
|
91
|
+
zeitwerk (2.3.0)
|
67
92
|
|
68
93
|
PLATFORMS
|
69
94
|
ruby
|
70
95
|
|
71
96
|
DEPENDENCIES
|
72
|
-
bundler (~> 2.
|
97
|
+
bundler (~> 2.1)
|
73
98
|
github_changelog_generator (~> 1.14)
|
74
|
-
rake (~>
|
99
|
+
rake (~> 13.0)
|
75
100
|
rspec (~> 3.0)
|
101
|
+
rspec_junit_formatter (~> 0.4)
|
102
|
+
standard
|
76
103
|
vpr!
|
77
104
|
|
78
105
|
BUNDLED WITH
|
79
|
-
2.
|
106
|
+
2.1.4
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
|
-
require
|
3
|
+
require "github_changelog_generator/task"
|
4
|
+
require "standard/rake"
|
4
5
|
|
5
6
|
RSpec::Core::RakeTask.new(:spec)
|
6
7
|
|
7
|
-
task :
|
8
|
+
task default: [:standard, :spec]
|
8
9
|
|
9
10
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
10
|
-
config.user =
|
11
|
-
config.project =
|
12
|
-
config.since_tag =
|
13
|
-
config.future_release =
|
11
|
+
config.user = "JuanCrg90"
|
12
|
+
config.project = "vpr"
|
13
|
+
config.since_tag = "0.1.0"
|
14
|
+
config.future_release = "2.0.0"
|
14
15
|
end
|
data/exe/vpr
CHANGED
data/lib/vpr.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
1
|
#:nodoc:
|
3
2
|
module Vpr
|
4
|
-
autoload :
|
5
|
-
autoload :
|
6
|
-
autoload :
|
7
|
-
autoload :
|
3
|
+
autoload :VERSION, "vpr/version"
|
4
|
+
autoload :Configuration, "vpr/configuration"
|
5
|
+
autoload :GitParser, "vpr/git_parser"
|
6
|
+
autoload :Url, "vpr/url"
|
7
|
+
autoload :CLI, "vpr/cli"
|
8
|
+
autoload :Services, "vpr/services"
|
8
9
|
end
|
data/lib/vpr/cli.rb
CHANGED
@@ -1,47 +1,71 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "thor"
|
2
|
+
require "launchy"
|
3
|
+
require "vpr/url"
|
4
|
+
require "vpr/configuration"
|
5
|
+
require "vpr/version"
|
4
6
|
|
5
7
|
module Vpr
|
6
8
|
class CLI < Thor
|
7
|
-
|
9
|
+
def initialize(args = [], local_options = {}, config = {})
|
10
|
+
super
|
11
|
+
select_remote
|
12
|
+
@url = Url.new
|
13
|
+
end
|
14
|
+
|
15
|
+
map "--version" => :version
|
16
|
+
class_option :remote, default: :origin
|
17
|
+
|
18
|
+
desc "home", "visit the project page in github"
|
8
19
|
def home
|
9
|
-
Launchy.open(
|
20
|
+
Launchy.open(url.home_url)
|
10
21
|
end
|
11
22
|
|
12
|
-
desc
|
23
|
+
desc "pulls", "visit the project pull requests page in github"
|
13
24
|
def pulls
|
14
|
-
Launchy.open(
|
25
|
+
Launchy.open(url.pulls_url)
|
15
26
|
end
|
16
27
|
|
17
|
-
desc
|
28
|
+
desc "issues", "visit the project issues page in github"
|
18
29
|
def issues
|
19
|
-
Launchy.open(
|
30
|
+
Launchy.open(url.issues_url)
|
20
31
|
end
|
21
32
|
|
22
|
-
desc
|
33
|
+
desc "branches", "visit the project branches page in github"
|
23
34
|
def branches
|
24
|
-
Launchy.open(
|
35
|
+
Launchy.open(url.branches_url)
|
25
36
|
end
|
26
37
|
|
27
|
-
desc
|
38
|
+
desc "branch", "visit the current branch in github"
|
28
39
|
def branch
|
29
|
-
Launchy.open(
|
40
|
+
Launchy.open(url.branch_url)
|
30
41
|
end
|
31
42
|
|
32
|
-
desc
|
43
|
+
desc "pull", "visit the pull request for the current branch (if exist) in github"
|
33
44
|
def pull
|
34
|
-
Launchy.open(
|
45
|
+
Launchy.open(url.pull_url)
|
35
46
|
end
|
36
47
|
|
37
|
-
desc
|
48
|
+
desc "visit COMMIT", "visit the commit in github"
|
38
49
|
def visit(commit)
|
39
|
-
Launchy.open(
|
50
|
+
Launchy.open(url.commit_url(commit))
|
40
51
|
end
|
41
52
|
|
42
|
-
desc
|
53
|
+
desc "search COMMIT", "search the commit in github"
|
43
54
|
def search(commit)
|
44
|
-
Launchy.open(
|
55
|
+
Launchy.open(url.search_url(commit))
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "version", "show the gem version"
|
59
|
+
def version
|
60
|
+
puts Vpr::VERSION
|
45
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def select_remote
|
66
|
+
Configuration.remote = options[:remote].to_sym
|
67
|
+
end
|
68
|
+
|
69
|
+
attr_reader :url
|
46
70
|
end
|
47
71
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "singleton"
|
2
|
+
|
3
|
+
module Vpr
|
4
|
+
class Configuration
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
attr_accessor :remote
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def method_missing method, *args
|
11
|
+
instance.send(method, *args)
|
12
|
+
rescue NoMethodError
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def respond_to_missing?(method_name, include_private = false)
|
17
|
+
["remote"].include?(method_name) || super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
super
|
23
|
+
@remote = :origin
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/vpr/git_parser.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require "git"
|
2
|
+
require "vpr/configuration"
|
2
3
|
|
3
4
|
module Vpr
|
4
5
|
class GitParser
|
@@ -12,24 +13,45 @@ module Vpr
|
|
12
13
|
(?<repo>[^/.]+)
|
13
14
|
}x.freeze
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
class << self
|
17
|
+
def repo_url
|
18
|
+
remote_uri = remotes[Configuration.remote]
|
19
|
+
matched = remote_uri.match(REGEXP)
|
17
20
|
|
18
|
-
|
19
|
-
git.remotes.each do |remote|
|
20
|
-
remotes[remote.name.to_sym] = remote.url
|
21
|
+
File.join("https://#{matched[:host]}", matched[:owner], matched[:repo])
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
+
def current_branch
|
25
|
+
git = Git.open(git_dir)
|
26
|
+
git.current_branch
|
27
|
+
end
|
24
28
|
|
25
|
-
|
29
|
+
def host
|
30
|
+
remote_uri = remotes[Configuration.remote]
|
31
|
+
matched = remote_uri.match(REGEXP)
|
26
32
|
|
27
|
-
|
28
|
-
|
33
|
+
matched[:host]
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def remotes
|
39
|
+
git = Git.open(git_dir)
|
40
|
+
git.remotes.map { |remote| [remote.name.to_sym, remote.url] }.to_h
|
41
|
+
end
|
42
|
+
|
43
|
+
def git_dir
|
44
|
+
dir = Dir.pwd
|
45
|
+
|
46
|
+
loop do
|
47
|
+
return dir if File.directory?(File.join(dir, ".git"))
|
29
48
|
|
30
|
-
|
31
|
-
|
32
|
-
|
49
|
+
parent = File.dirname(dir)
|
50
|
+
return dir if parent == dir # we're at the root
|
51
|
+
|
52
|
+
dir = parent
|
53
|
+
end
|
54
|
+
end
|
33
55
|
end
|
34
56
|
end
|
35
57
|
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,44 @@
|
|
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
|
+
base_url = "#{GitParser.repo_url}/pull"
|
28
|
+
current_branch = GitParser.current_branch
|
29
|
+
|
30
|
+
base_url.concat("/new") if current_branch.match?(/\d+\/.+/)
|
31
|
+
|
32
|
+
"#{base_url}/#{current_branch}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.commit_url(commit)
|
36
|
+
"#{GitParser.repo_url}/commit/#{commit}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.search_url(commit)
|
40
|
+
"#{GitParser.repo_url}/search?q=#{commit}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/vpr/url.rb
CHANGED
@@ -1,37 +1,53 @@
|
|
1
|
-
require
|
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
|
-
|
10
|
+
def home_url
|
11
|
+
service.home_url
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
-
|
14
|
+
def pulls_url
|
15
|
+
service.pulls_url
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
|
18
|
+
def issues_url
|
19
|
+
service.issues_url
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
22
|
+
def branches_url
|
23
|
+
service.branches_url
|
23
24
|
end
|
24
25
|
|
25
|
-
def
|
26
|
-
|
26
|
+
def branch_url
|
27
|
+
service.branch_url
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
-
|
30
|
+
def pull_url
|
31
|
+
service.pull_url
|
31
32
|
end
|
32
33
|
|
33
|
-
def
|
34
|
-
|
34
|
+
def commit_url(commit)
|
35
|
+
service.commit_url(commit)
|
35
36
|
end
|
37
|
+
|
38
|
+
def search_url(commit)
|
39
|
+
service.search_url(commit)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def services
|
45
|
+
{
|
46
|
+
'github.com': Vpr::Services::GitHub,
|
47
|
+
'bitbucket.org': Vpr::Services::Bitbucket,
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
attr_reader :service
|
36
52
|
end
|
37
53
|
end
|
data/lib/vpr/version.rb
CHANGED
data/vpr.gemspec
CHANGED
@@ -1,35 +1,36 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require "vpr/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
6
|
+
spec.name = "vpr"
|
7
|
+
spec.version = Vpr::VERSION
|
8
|
+
spec.authors = ["Juan Carlos Ruiz"]
|
9
|
+
spec.email = ["JuanCrg90@gmail.com"]
|
11
10
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
11
|
+
spec.summary = "A CLI to visit quickly commits in github"
|
12
|
+
spec.description = "Visit the github PR using the Commit SHA-1"
|
13
|
+
spec.homepage = "https://github.com/JuanCrg90/vpr"
|
14
|
+
spec.license = "MIT"
|
16
15
|
|
17
16
|
# Specify which files should be added to the gem when it is released.
|
18
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files
|
18
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
20
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
20
|
end
|
22
21
|
|
23
|
-
spec.bindir =
|
22
|
+
spec.bindir = "exe"
|
24
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = [
|
24
|
+
spec.require_paths = ["lib"]
|
26
25
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
27
|
+
spec.add_development_dependency "github_changelog_generator", "~> 1.14"
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4"
|
31
|
+
spec.add_development_dependency "standard"
|
31
32
|
|
32
|
-
spec.add_runtime_dependency
|
33
|
-
spec.add_runtime_dependency
|
34
|
-
spec.add_runtime_dependency
|
33
|
+
spec.add_runtime_dependency "git", "~> 1.7"
|
34
|
+
spec.add_runtime_dependency "launchy", "~> 2.4"
|
35
|
+
spec.add_runtime_dependency "thor", "~> 0.20"
|
35
36
|
end
|
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:
|
4
|
+
version: 2.2.1
|
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:
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: github_changelog_generator
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +66,48 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec_junit_formatter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: git
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - "~>"
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
103
|
+
version: '1.7'
|
76
104
|
type: :runtime
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
110
|
+
version: '1.7'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: launchy
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,9 +144,10 @@ executables:
|
|
116
144
|
extensions: []
|
117
145
|
extra_rdoc_files: []
|
118
146
|
files:
|
147
|
+
- ".github/workflows/ci.yml"
|
148
|
+
- ".github/workflows/standardrb.yml"
|
119
149
|
- ".gitignore"
|
120
150
|
- ".rspec"
|
121
|
-
- ".travis.yml"
|
122
151
|
- CHANGELOG.md
|
123
152
|
- CODE_OF_CONDUCT.md
|
124
153
|
- Gemfile
|
@@ -131,7 +160,11 @@ files:
|
|
131
160
|
- exe/vpr
|
132
161
|
- lib/vpr.rb
|
133
162
|
- lib/vpr/cli.rb
|
163
|
+
- lib/vpr/configuration.rb
|
134
164
|
- lib/vpr/git_parser.rb
|
165
|
+
- lib/vpr/services.rb
|
166
|
+
- lib/vpr/services/bitbucket.rb
|
167
|
+
- lib/vpr/services/github.rb
|
135
168
|
- lib/vpr/url.rb
|
136
169
|
- lib/vpr/version.rb
|
137
170
|
- vpr.gemspec
|