vpr 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +54 -0
- data/.github/workflows/standardrb.yml +20 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +27 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +102 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +15 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/vpr +5 -0
- data/lib/vpr.rb +8 -0
- data/lib/vpr/cli.rb +67 -0
- data/lib/vpr/configuration.rb +26 -0
- data/lib/vpr/git_parser.rb +57 -0
- data/lib/vpr/url.rb +60 -0
- data/lib/vpr/version.rb +3 -0
- data/vpr.gemspec +36 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4516c709e0285fa6e52594f71e1e27c817c74b718fefb8706c8eeadfce5cd632
|
4
|
+
data.tar.gz: 95aed1a43e03d35813b25861b2a92dd83a46153556f9cea87e640ff4e3a5e4b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cb0ae8e22c48bb54f241e1c5c503a6f86e8afdcff676319333a851ca39fe4dd66b6a0fb5781f4a5eb3ccd160a147b70f38da21b0d6e0a6b42feb422bea02c7e
|
7
|
+
data.tar.gz: 36e8af20c55e5fbf89061e57bace2313b32b333c9886791319bae979f5baa71a2ed1a9a2075a054aa73702a5f22c9389ba9fae30fbd70f30735a702d2a5c207a
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.6.4
|
11
|
+
|
12
|
+
working_directory: ~/repo
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
# Download and cache dependencies
|
18
|
+
- restore_cache:
|
19
|
+
keys:
|
20
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
21
|
+
# fallback to using the latest cache if no exact match is found
|
22
|
+
- v1-dependencies-
|
23
|
+
|
24
|
+
- run:
|
25
|
+
name: install dependencies
|
26
|
+
command: |
|
27
|
+
gem install bundler
|
28
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
29
|
+
|
30
|
+
- save_cache:
|
31
|
+
paths:
|
32
|
+
- ./vendor/bundle
|
33
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
34
|
+
|
35
|
+
# run tests!
|
36
|
+
- run:
|
37
|
+
name: run tests
|
38
|
+
command: |
|
39
|
+
mkdir /tmp/test-results
|
40
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb")"
|
41
|
+
|
42
|
+
bundle exec rspec \
|
43
|
+
--format progress \
|
44
|
+
--format RspecJunitFormatter \
|
45
|
+
--out /tmp/test-results/rspec.xml \
|
46
|
+
--format progress \
|
47
|
+
$TEST_FILES
|
48
|
+
|
49
|
+
# collect reports
|
50
|
+
- store_test_results:
|
51
|
+
path: /tmp/test-results
|
52
|
+
- store_artifacts:
|
53
|
+
path: /tmp/test-results
|
54
|
+
destination: test-results
|
@@ -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
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v1.0.0](https://github.com/JuanCrg90/vpr/tree/v1.0.0) (2019-07-12)
|
4
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/v0.2.0...v1.0.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Bump version 1.0.0 [\#4](https://github.com/JuanCrg90/vpr/pull/4) ([JuanCrg90](https://github.com/JuanCrg90))
|
9
|
+
- Add changelog [\#3](https://github.com/JuanCrg90/vpr/pull/3) ([JuanCrg90](https://github.com/JuanCrg90))
|
10
|
+
- Add regular GitHub project actions [\#2](https://github.com/JuanCrg90/vpr/pull/2) ([JuanCrg90](https://github.com/JuanCrg90))
|
11
|
+
|
12
|
+
## [v0.2.0](https://github.com/JuanCrg90/vpr/tree/v0.2.0) (2019-07-10)
|
13
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/v0.1.1...v0.2.0)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- add Launchy dependency [\#1](https://github.com/JuanCrg90/vpr/pull/1) ([JuanCrg90](https://github.com/JuanCrg90))
|
18
|
+
|
19
|
+
## [v0.1.1](https://github.com/JuanCrg90/vpr/tree/v0.1.1) (2019-07-05)
|
20
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/v0.1.0...v0.1.1)
|
21
|
+
|
22
|
+
## [v0.1.0](https://github.com/JuanCrg90/vpr/tree/v0.1.0) (2019-07-05)
|
23
|
+
[Full Changelog](https://github.com/JuanCrg90/vpr/compare/0.1.0...v0.1.0)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at JuanCrg90@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vpr (2.0.0)
|
5
|
+
git (~> 1.5)
|
6
|
+
launchy (~> 2.4)
|
7
|
+
thor (~> 0.20)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (5.2.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
addressable (2.6.0)
|
18
|
+
public_suffix (>= 2.0.2, < 4.0)
|
19
|
+
ast (2.4.0)
|
20
|
+
concurrent-ruby (1.1.5)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
faraday (0.15.4)
|
23
|
+
multipart-post (>= 1.2, < 3)
|
24
|
+
faraday-http-cache (2.0.0)
|
25
|
+
faraday (~> 0.8)
|
26
|
+
git (1.5.0)
|
27
|
+
github_changelog_generator (1.14.3)
|
28
|
+
activesupport
|
29
|
+
faraday-http-cache
|
30
|
+
multi_json
|
31
|
+
octokit (~> 4.6)
|
32
|
+
rainbow (>= 2.1)
|
33
|
+
rake (>= 10.0)
|
34
|
+
retriable (~> 2.1)
|
35
|
+
i18n (1.6.0)
|
36
|
+
concurrent-ruby (~> 1.0)
|
37
|
+
jaro_winkler (1.5.3)
|
38
|
+
launchy (2.4.3)
|
39
|
+
addressable (~> 2.3)
|
40
|
+
minitest (5.11.3)
|
41
|
+
multi_json (1.13.1)
|
42
|
+
multipart-post (2.1.1)
|
43
|
+
octokit (4.14.0)
|
44
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
45
|
+
parallel (1.17.0)
|
46
|
+
parser (2.6.5.0)
|
47
|
+
ast (~> 2.4.0)
|
48
|
+
public_suffix (3.1.1)
|
49
|
+
rainbow (3.0.0)
|
50
|
+
rake (10.5.0)
|
51
|
+
retriable (2.1.0)
|
52
|
+
rspec (3.8.0)
|
53
|
+
rspec-core (~> 3.8.0)
|
54
|
+
rspec-expectations (~> 3.8.0)
|
55
|
+
rspec-mocks (~> 3.8.0)
|
56
|
+
rspec-core (3.8.1)
|
57
|
+
rspec-support (~> 3.8.0)
|
58
|
+
rspec-expectations (3.8.4)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.8.0)
|
61
|
+
rspec-mocks (3.8.1)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.8.0)
|
64
|
+
rspec-support (3.8.2)
|
65
|
+
rspec_junit_formatter (0.4.1)
|
66
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
67
|
+
rubocop (0.72.0)
|
68
|
+
jaro_winkler (~> 1.5.1)
|
69
|
+
parallel (~> 1.10)
|
70
|
+
parser (>= 2.6)
|
71
|
+
rainbow (>= 2.2.2, < 4.0)
|
72
|
+
ruby-progressbar (~> 1.7)
|
73
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
74
|
+
rubocop-performance (1.4.1)
|
75
|
+
rubocop (>= 0.71.0)
|
76
|
+
ruby-progressbar (1.10.1)
|
77
|
+
sawyer (0.8.2)
|
78
|
+
addressable (>= 2.3.5)
|
79
|
+
faraday (> 0.8, < 2.0)
|
80
|
+
standard (0.1.4)
|
81
|
+
rubocop (~> 0.72.0)
|
82
|
+
rubocop-performance (~> 1.4.0)
|
83
|
+
thor (0.20.3)
|
84
|
+
thread_safe (0.3.6)
|
85
|
+
tzinfo (1.2.5)
|
86
|
+
thread_safe (~> 0.1)
|
87
|
+
unicode-display_width (1.6.0)
|
88
|
+
|
89
|
+
PLATFORMS
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
bundler (~> 2.0)
|
94
|
+
github_changelog_generator (~> 1.14)
|
95
|
+
rake (~> 10.0)
|
96
|
+
rspec (~> 3.0)
|
97
|
+
rspec_junit_formatter (~> 0.4)
|
98
|
+
standard
|
99
|
+
vpr!
|
100
|
+
|
101
|
+
BUNDLED WITH
|
102
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Juan Carlos Ruiz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
![StandardRB](https://github.com/JuanCrg90/vpr/workflows/StandardRB/badge.svg)
|
2
|
+
[![CircleCI](https://circleci.com/gh/JuanCrg90/vpr.svg?style=svg)](https://circleci.com/gh/JuanCrg90/vpr)
|
3
|
+
|
4
|
+
# vpr
|
5
|
+
|
6
|
+
A CLI to visit quickly github project sections
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
```
|
10
|
+
$ gem install vpr
|
11
|
+
```
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
```
|
15
|
+
$ vpr home # visit the project page in github
|
16
|
+
```
|
17
|
+
![vpr home](https://res.cloudinary.com/juancrg90/image/upload/v1562969660/vpr/vpr_home.gif)
|
18
|
+
|
19
|
+
```
|
20
|
+
$ vpr pulls # visit the project pull requests page in github
|
21
|
+
```
|
22
|
+
![vpr pulls](https://res.cloudinary.com/juancrg90/image/upload/v1562969866/vpr/vpr_pulls.gif)
|
23
|
+
|
24
|
+
```
|
25
|
+
$ vpr issues # visit the project issues page in github
|
26
|
+
```
|
27
|
+
![vpr issues](https://res.cloudinary.com/juancrg90/image/upload/v1562969959/vpr/vpr_issues.gif)
|
28
|
+
|
29
|
+
```
|
30
|
+
$ vpr branches # visit the project branches page in github
|
31
|
+
```
|
32
|
+
![vpr branches](https://res.cloudinary.com/juancrg90/image/upload/v1562970055/vpr/vpr_branches.gif)
|
33
|
+
|
34
|
+
```
|
35
|
+
$ vpr branch # 'visit the current branch in github'
|
36
|
+
```
|
37
|
+
![vpr branch](https://res.cloudinary.com/juancrg90/image/upload/v1562970153/vpr/vpr_branch.gif)
|
38
|
+
|
39
|
+
```
|
40
|
+
$ vpr pull # 'visit the pull request for the current branch (if exist) in github'
|
41
|
+
```
|
42
|
+
![vpr pull](https://res.cloudinary.com/juancrg90/image/upload/v1562970242/vpr/vpr_pull.gif)
|
43
|
+
|
44
|
+
```
|
45
|
+
$ vpr visit <commit> # visit the commit in github
|
46
|
+
```
|
47
|
+
![vpr visit](https://res.cloudinary.com/juancrg90/image/upload/v1562970485/vpr/vpr_visit.gif)
|
48
|
+
|
49
|
+
```
|
50
|
+
$ vpr search <commit> # search the commit in github
|
51
|
+
```
|
52
|
+
![vpr search](https://res.cloudinary.com/juancrg90/image/upload/v1562970606/vpr/vpr_search.gif)
|
53
|
+
|
54
|
+
## Development
|
55
|
+
|
56
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
57
|
+
|
58
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/JuanCrg90/vpr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
63
|
+
|
64
|
+
## License
|
65
|
+
|
66
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
67
|
+
|
68
|
+
## Code of Conduct
|
69
|
+
|
70
|
+
Everyone interacting in the Vpr project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/JuanCrg90/vpr/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "github_changelog_generator/task"
|
4
|
+
require "standard/rake"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task default: [:standard, :spec]
|
9
|
+
|
10
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
11
|
+
config.user = "JuanCrg90"
|
12
|
+
config.project = "vpr"
|
13
|
+
config.since_tag = "0.1.0"
|
14
|
+
config.future_release = "1.0.0"
|
15
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vpr"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/vpr
ADDED
data/lib/vpr.rb
ADDED
data/lib/vpr/cli.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "launchy"
|
3
|
+
require "vpr/url"
|
4
|
+
require "vpr/configuration"
|
5
|
+
|
6
|
+
module Vpr
|
7
|
+
class CLI < Thor
|
8
|
+
def initialize(args = [], local_options = {}, config = {})
|
9
|
+
super
|
10
|
+
select_remote
|
11
|
+
end
|
12
|
+
|
13
|
+
map "--version" => :version
|
14
|
+
class_option :remote, default: :origin
|
15
|
+
|
16
|
+
desc "home", "visit the project page in github"
|
17
|
+
def home
|
18
|
+
Launchy.open(Url.home_url)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "pulls", "visit the project pull requests page in github"
|
22
|
+
def pulls
|
23
|
+
Launchy.open(Url.pulls_url)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "issues", "visit the project issues page in github"
|
27
|
+
def issues
|
28
|
+
Launchy.open(Url.issues_url)
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "branches", "visit the project branches page in github"
|
32
|
+
def branches
|
33
|
+
Launchy.open(Url.branches_url)
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "branch", "visit the current branch in github"
|
37
|
+
def branch
|
38
|
+
Launchy.open(Url.branch_url)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "pull", "visit the pull request for the current branch (if exist) in github"
|
42
|
+
def pull
|
43
|
+
Launchy.open(Url.pull_url)
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "visit COMMIT", "visit the commit in github"
|
47
|
+
def visit(commit)
|
48
|
+
Launchy.open(Url.commit_url(commit))
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "search COMMIT", "search the commit in github"
|
52
|
+
def search(commit)
|
53
|
+
Launchy.open(Url.search_url(commit))
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "version", "show the gem version"
|
57
|
+
def version
|
58
|
+
Vpr::VERSION
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def select_remote
|
64
|
+
Configuration.remote = options[:remote].to_sym
|
65
|
+
end
|
66
|
+
end
|
67
|
+
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
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "git"
|
2
|
+
require "vpr/configuration"
|
3
|
+
|
4
|
+
module Vpr
|
5
|
+
class GitParser
|
6
|
+
REGEXP = %r{
|
7
|
+
(?<protocol>(http://|https://|git://|ssh://))*
|
8
|
+
(?<username>[^@]+@)*
|
9
|
+
(?<host>[^/]+)
|
10
|
+
[/:]
|
11
|
+
(?<owner>[^/]+)
|
12
|
+
/
|
13
|
+
(?<repo>[^/.]+)
|
14
|
+
}x.freeze
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def repo_url
|
18
|
+
remote_uri = remotes[Configuration.remote]
|
19
|
+
matched = remote_uri.match(REGEXP)
|
20
|
+
|
21
|
+
File.join("https://#{matched[:host]}", matched[:owner], matched[:repo])
|
22
|
+
end
|
23
|
+
|
24
|
+
def current_branch
|
25
|
+
git = Git.open(git_dir)
|
26
|
+
git.current_branch
|
27
|
+
end
|
28
|
+
|
29
|
+
def host
|
30
|
+
remote_uri = remotes[Configuration.remote]
|
31
|
+
matched = remote_uri.match(REGEXP)
|
32
|
+
|
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"))
|
48
|
+
|
49
|
+
parent = File.dirname(dir)
|
50
|
+
return dir if parent == dir # we're at the root
|
51
|
+
|
52
|
+
dir = parent
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/vpr/url.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require "vpr/git_parser"
|
2
|
+
|
3
|
+
module Vpr
|
4
|
+
class Url
|
5
|
+
def self.home_url
|
6
|
+
GitParser.repo_url
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.pulls_url
|
10
|
+
path = {
|
11
|
+
'github.com': "pulls",
|
12
|
+
'bitbucket.org': "pull-requests",
|
13
|
+
}
|
14
|
+
|
15
|
+
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.issues_url
|
19
|
+
"#{GitParser.repo_url}/issues"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.branches_url
|
23
|
+
"#{GitParser.repo_url}/branches"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.branch_url
|
27
|
+
path = {
|
28
|
+
'github.com': "tree",
|
29
|
+
'bitbucket.org': "branch",
|
30
|
+
}
|
31
|
+
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}/#{GitParser.current_branch}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.pull_url
|
35
|
+
path = {
|
36
|
+
'github.com': "pull/#{GitParser.current_branch}",
|
37
|
+
'bitbucket.org': "pull-requests/new?source=#{GitParser.current_branch}",
|
38
|
+
}
|
39
|
+
|
40
|
+
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.commit_url(commit)
|
44
|
+
path = {
|
45
|
+
'github.com': "commit",
|
46
|
+
'bitbucket.org': "commits",
|
47
|
+
}
|
48
|
+
|
49
|
+
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}/#{commit}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.search_url(commit)
|
53
|
+
path = {
|
54
|
+
'github.com': "search?q=",
|
55
|
+
'bitbucket.org': "commits/all?search=",
|
56
|
+
}
|
57
|
+
"#{GitParser.repo_url}/#{path[GitParser.host.to_sym]}#{commit}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/vpr/version.rb
ADDED
data/vpr.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "vpr/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "vpr"
|
7
|
+
spec.version = Vpr::VERSION
|
8
|
+
spec.authors = ["Juan Carlos Ruiz"]
|
9
|
+
spec.email = ["JuanCrg90@gmail.com"]
|
10
|
+
|
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"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "github_changelog_generator", "~> 1.14"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.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"
|
32
|
+
|
33
|
+
spec.add_runtime_dependency "git", "~> 1.5"
|
34
|
+
spec.add_runtime_dependency "launchy", "~> 2.4"
|
35
|
+
spec.add_runtime_dependency "thor", "~> 0.20"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vpr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Juan Carlos Ruiz
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: github_changelog_generator
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
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'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: git
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.5'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: launchy
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.4'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.20'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.20'
|
139
|
+
description: Visit the github PR using the Commit SHA-1
|
140
|
+
email:
|
141
|
+
- JuanCrg90@gmail.com
|
142
|
+
executables:
|
143
|
+
- vpr
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".circleci/config.yml"
|
148
|
+
- ".github/workflows/standardrb.yml"
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rspec"
|
151
|
+
- CHANGELOG.md
|
152
|
+
- CODE_OF_CONDUCT.md
|
153
|
+
- Gemfile
|
154
|
+
- Gemfile.lock
|
155
|
+
- LICENSE.txt
|
156
|
+
- README.md
|
157
|
+
- Rakefile
|
158
|
+
- bin/console
|
159
|
+
- bin/setup
|
160
|
+
- exe/vpr
|
161
|
+
- lib/vpr.rb
|
162
|
+
- lib/vpr/cli.rb
|
163
|
+
- lib/vpr/configuration.rb
|
164
|
+
- lib/vpr/git_parser.rb
|
165
|
+
- lib/vpr/url.rb
|
166
|
+
- lib/vpr/version.rb
|
167
|
+
- vpr.gemspec
|
168
|
+
homepage: https://github.com/JuanCrg90/vpr
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubygems_version: 3.0.3
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: A CLI to visit quickly commits in github
|
191
|
+
test_files: []
|