gh-contrib 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -3
- data/Gemfile +1 -0
- data/Gemfile.lock +35 -2
- data/README.md +22 -4
- data/gh-contrib.gemspec +1 -0
- data/lib/gh/contrib/cli.rb +20 -12
- data/lib/gh/contrib/version.rb +1 -1
- data/script/test.sh +3 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b461e7ed40823baa2cbecf0fe7a25d354e678089cef57adf19fe1f4286a013a
|
4
|
+
data.tar.gz: 9f9ebbbfcd9719894bfdb7a5696b514efae4d9d1f9a56ab0795cf9ddac51d347
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b960eabf170476fa4fe552a0511c8b95ceb5c1db13fddb16d5ae69d7b39ac077203ff860f87c87b771942fb9282882a8bd856853135688e8dca08264784df18c
|
7
|
+
data.tar.gz: 4fe4b17264bc20478e03a29116ab041f707299aed542a98684a8d7d6ddf3f4983e018b97407b3ebc805b62274d8228b14b703642e43f5e86f28e40a063e6036c
|
data/.circleci/config.yml
CHANGED
@@ -1,10 +1,30 @@
|
|
1
1
|
version: 2
|
2
2
|
jobs:
|
3
|
-
|
3
|
+
test2.3.0:
|
4
4
|
docker:
|
5
|
-
- image:
|
5
|
+
- image: ruby:2.3.0
|
6
6
|
working_directory: /home/circleci/gh-contirb
|
7
7
|
steps:
|
8
8
|
- checkout
|
9
|
-
- run: bundle install
|
10
9
|
- run: ./script/test.sh
|
10
|
+
test2.4.0:
|
11
|
+
docker:
|
12
|
+
- image: ruby:2.4.0
|
13
|
+
working_directory: /home/circleci/gh-contirb
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
- run: ./script/test.sh
|
17
|
+
test2.5.0:
|
18
|
+
docker:
|
19
|
+
- image: ruby:2.5.0
|
20
|
+
working_directory: /home/circleci/gh-contirb
|
21
|
+
steps:
|
22
|
+
- checkout
|
23
|
+
- run: ./script/test.sh
|
24
|
+
workflows:
|
25
|
+
version: 2
|
26
|
+
test_multiple ruby version:
|
27
|
+
jobs:
|
28
|
+
- test2.3.0
|
29
|
+
- test2.4.0
|
30
|
+
- test2.5.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gh-contrib (0.
|
4
|
+
gh-contrib (0.2.0)
|
5
5
|
thor
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
aruba (0.14.6)
|
11
|
+
childprocess (>= 0.6.3, < 0.10.0)
|
12
|
+
contracts (~> 0.9)
|
13
|
+
cucumber (>= 1.3.19)
|
14
|
+
ffi (~> 1.9.10)
|
15
|
+
rspec-expectations (>= 2.99)
|
16
|
+
thor (~> 0.19)
|
17
|
+
backports (3.11.4)
|
18
|
+
builder (3.2.3)
|
19
|
+
childprocess (0.9.0)
|
20
|
+
ffi (~> 1.0, >= 1.0.11)
|
21
|
+
contracts (0.16.0)
|
22
|
+
cucumber (3.1.2)
|
23
|
+
builder (>= 2.1.2)
|
24
|
+
cucumber-core (~> 3.2.0)
|
25
|
+
cucumber-expressions (~> 6.0.1)
|
26
|
+
cucumber-wire (~> 0.0.1)
|
27
|
+
diff-lcs (~> 1.3)
|
28
|
+
gherkin (~> 5.1.0)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
multi_test (>= 0.1.2)
|
31
|
+
cucumber-core (3.2.0)
|
32
|
+
backports (>= 3.8.0)
|
33
|
+
cucumber-tag_expressions (~> 1.1.0)
|
34
|
+
gherkin (>= 5.0.0)
|
35
|
+
cucumber-expressions (6.0.1)
|
36
|
+
cucumber-tag_expressions (1.1.1)
|
37
|
+
cucumber-wire (0.0.1)
|
10
38
|
diff-lcs (1.3)
|
39
|
+
ffi (1.9.25)
|
40
|
+
gherkin (5.1.0)
|
41
|
+
multi_json (1.13.1)
|
42
|
+
multi_test (0.1.2)
|
11
43
|
rake (10.5.0)
|
12
44
|
rspec (3.8.0)
|
13
45
|
rspec-core (~> 3.8.0)
|
@@ -28,10 +60,11 @@ PLATFORMS
|
|
28
60
|
ruby
|
29
61
|
|
30
62
|
DEPENDENCIES
|
63
|
+
aruba (~> 0.14.6)
|
31
64
|
bundler (~> 1.16)
|
32
65
|
gh-contrib!
|
33
66
|
rake (~> 10.0)
|
34
67
|
rspec (~> 3.0)
|
35
68
|
|
36
69
|
BUNDLED WITH
|
37
|
-
1.16.
|
70
|
+
1.16.4
|
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Gh::Contrib
|
2
2
|
[![CircleCI](https://circleci.com/gh/chaspy/gh-contrib/tree/master.svg?style=svg)][status]
|
3
|
+
[![GitHub release](https://img.shields.io/github/release/chaspy/gh-contrib/all.svg?style=flat-square)][release]
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/gh-contrib.svg)][gem]
|
5
|
+
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
|
3
6
|
|
4
7
|
[status]: https://circleci.com/gh/chaspy/gh-contrib
|
8
|
+
[release]: https://github.com/chaspy/gh-contrib/releases
|
9
|
+
[gem]: https://badge.fury.io/rb/gh-contrib
|
10
|
+
[license]: https://github.com/chaspy/gh-contrib/blob/master/LICENSE
|
5
11
|
|
6
|
-
|
7
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gh/contrib`. To experiment with that code, run `bin/console` for an interactive prompt.
|
8
|
-
|
9
|
-
TODO: Delete this and the text above, and describe your gem
|
12
|
+
Show your contribution for a specific time period.
|
10
13
|
|
11
14
|
## Installation
|
12
15
|
|
@@ -32,6 +35,21 @@ If you get the report includes the private repository, please set environment va
|
|
32
35
|
|
33
36
|
$ export GHCONTRIB_TOKEN="<your access token>"
|
34
37
|
|
38
|
+
## Example
|
39
|
+
|
40
|
+
```
|
41
|
+
$ gh-contrib report -u chaspy -s 2018-09-13 -e 2018-09-14
|
42
|
+
Hi chaspy, this is your contribution report :tada: in 2018-09-13..2018-09-14
|
43
|
+
# Pull Request
|
44
|
+
your created and merged pull request is 2!!
|
45
|
+
|
46
|
+
Add badges
|
47
|
+
https://github.com/chaspy/gh-contrib/pull/11
|
48
|
+
|
49
|
+
Exit when get abnormal status code
|
50
|
+
https://github.com/chaspy/gh-contrib/pull/10
|
51
|
+
```
|
52
|
+
|
35
53
|
## Development
|
36
54
|
|
37
55
|
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.
|
data/gh-contrib.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "aruba"
|
27
28
|
|
28
29
|
spec.add_dependency "thor"
|
29
30
|
end
|
data/lib/gh/contrib/cli.rb
CHANGED
@@ -4,24 +4,16 @@ require 'net/https'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
class CLI < Thor
|
7
|
-
desc "report your contribution","
|
7
|
+
desc "report your contribution","--user <user name> --start <YYYY-MM-DD> --end <YYYY-MM-DD>"
|
8
8
|
option :user, type: :string, aliases: '-u', desc: 'GitHub user name'
|
9
9
|
option :start, type: :string, aliases: '-s', desc: 'Start date to get your contribution'
|
10
10
|
option :end, type: :string, aliases: '-e', desc: 'End date to get your contribution'
|
11
11
|
def report
|
12
|
-
# validate arguments
|
13
12
|
u = options[:user]
|
14
13
|
s = options[:start]
|
15
14
|
e = options[:end]
|
16
|
-
|
17
|
-
|
18
|
-
elsif !s.match(/\d{4}-\d{2}-\d{2}/)
|
19
|
-
return false
|
20
|
-
elsif !e.match(/\d{4}-\d{2}-\d{2}/)
|
21
|
-
return false
|
22
|
-
else
|
23
|
-
true
|
24
|
-
end
|
15
|
+
|
16
|
+
exit if !validate(u,s,e)
|
25
17
|
|
26
18
|
terms = "#{s}"+".."+"#{e}"
|
27
19
|
path = "/search/issues?q=type:pr+in:body+is:merged+merged:#{terms}+author:#{u}&per_page=100"
|
@@ -34,6 +26,12 @@ class CLI < Thor
|
|
34
26
|
http.request(req)
|
35
27
|
}
|
36
28
|
|
29
|
+
if response.code != "200" then
|
30
|
+
puts "Get error from GitHub"
|
31
|
+
puts "#{response.code} #{response.message}"
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
37
35
|
result = JSON.parse(response.body)
|
38
36
|
|
39
37
|
puts "Hi #{u}, this is your contribution report :tada: in #{terms}"
|
@@ -46,6 +44,16 @@ class CLI < Thor
|
|
46
44
|
puts i['html_url']
|
47
45
|
puts ""
|
48
46
|
}
|
49
|
-
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def validate(u,s,e)
|
51
|
+
if !s.match(/^\d{4}-\d{2}-\d{2}$/)
|
52
|
+
return false
|
53
|
+
elsif !e.match(/^\d{4}-\d{2}-\d{2}$/)
|
54
|
+
return false
|
55
|
+
else
|
56
|
+
true
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
data/lib/gh/contrib/version.rb
CHANGED
data/script/test.sh
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kondo takeshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: thor
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|