kachikachi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +49 -0
- data/LICENSE.txt +21 -0
- data/README.md +79 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/kachikachi +5 -0
- data/kachikachi.gemspec +31 -0
- data/lib/kachikachi.rb +6 -0
- data/lib/kachikachi/cli.rb +24 -0
- data/lib/kachikachi/counter.rb +24 -0
- data/lib/kachikachi/git_hub.rb +45 -0
- data/lib/kachikachi/patch.rb +12 -0
- data/lib/kachikachi/patch_body.rb +37 -0
- data/lib/kachikachi/pull_request.rb +71 -0
- data/lib/kachikachi/version.rb +3 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fea95d80a5e3fca06e9613ca2513911ee4a55a137c2b80da7f8c79f43053e80c
|
4
|
+
data.tar.gz: 8ef43ab16ea8aa9fd3cbb9ac61d6984a9f52f1b9c4e3437a7e3bcce8357f1475
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 862c79c9b06a91fbc0507244f652e5619b20d34dcb857a7bae4aaff9964c4c0507e499e5ba66dd7ad2a6e44f38d5de5755fa7f4841f459d1cb8e84dd5749ee3f
|
7
|
+
data.tar.gz: a6ed2b294ac795ba34d9eaa9aa08a840921daaab72fa457ac81a58eb898a7484b96d8bc575e28ef98a2ad2ffd27bca9b8fbc141601ad48d2eea0b80b34e047c8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
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 cy11121@shibaura-it.ac.jp. 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,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kachikachi (0.1.0)
|
5
|
+
octokit
|
6
|
+
thor
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.5.2)
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
13
|
+
diff-lcs (1.3)
|
14
|
+
faraday (0.15.4)
|
15
|
+
multipart-post (>= 1.2, < 3)
|
16
|
+
multipart-post (2.0.0)
|
17
|
+
octokit (4.13.0)
|
18
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
19
|
+
public_suffix (3.0.3)
|
20
|
+
rake (10.5.0)
|
21
|
+
rspec (3.8.0)
|
22
|
+
rspec-core (~> 3.8.0)
|
23
|
+
rspec-expectations (~> 3.8.0)
|
24
|
+
rspec-mocks (~> 3.8.0)
|
25
|
+
rspec-core (3.8.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-expectations (3.8.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.8.0)
|
30
|
+
rspec-mocks (3.8.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.8.0)
|
33
|
+
rspec-support (3.8.0)
|
34
|
+
sawyer (0.8.1)
|
35
|
+
addressable (>= 2.3.5, < 2.6)
|
36
|
+
faraday (~> 0.8, < 1.0)
|
37
|
+
thor (0.20.3)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
bundler (~> 1.17)
|
44
|
+
kachikachi!
|
45
|
+
rake (~> 10.0)
|
46
|
+
rspec (~> 3.0)
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Tatsuya Kojima
|
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,79 @@
|
|
1
|
+
# Kachikachi
|
2
|
+
|
3
|
+
Kachikachi is counter of deleted lines on GitHub pull request.
|
4
|
+
|
5
|
+
```sh
|
6
|
+
$ bundle exec kachikachi count --repo=test --milestones=1.0.0
|
7
|
+
|
8
|
+
path/to/file: deleted 1 lines
|
9
|
+
path/to/file: deleted 1 lines
|
10
|
+
path/to/file: deleted 6 lines
|
11
|
+
path/to/file: deleted 150 lines
|
12
|
+
path/to/file: deleted 1 lines
|
13
|
+
👋👋👋 total 159 lines 👋👋👋
|
14
|
+
```
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'kachikachi'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install kachikachi
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
Set `KACHIKACHI_GITHUB_TOKEN` to your Github personal access token which requirs only repo scope.
|
35
|
+
|
36
|
+
```
|
37
|
+
$ export KACHIKACHI_GITHUB_TOKEN={YOUR_TOKEN}
|
38
|
+
```
|
39
|
+
|
40
|
+
Count command requires arguments `--repo` and `--milestones` or `pull-request-numbers`.
|
41
|
+
|
42
|
+
```sh
|
43
|
+
$ bundle exec kachikachi count --repo={REPO} --milestones={1.0.0 2.0.0} or pull-request-numbers={1 2 3}
|
44
|
+
```
|
45
|
+
|
46
|
+
Example output.
|
47
|
+
|
48
|
+
|
49
|
+
### Options
|
50
|
+
|
51
|
+
```sh
|
52
|
+
Options:
|
53
|
+
[--endpoint=ENDPOINT]
|
54
|
+
# Default: https://api.github.com/
|
55
|
+
[--token=TOKEN]
|
56
|
+
--repo=REPO
|
57
|
+
[--file-regexp=FILE-REGEXP]
|
58
|
+
[--milestones=one two three]
|
59
|
+
[--pull-request-numbers=one two three]
|
60
|
+
[--state=STATE]
|
61
|
+
# Default: closed
|
62
|
+
[--ignore-white-space], [--no-ignore-white-space]
|
63
|
+
# Default: true
|
64
|
+
[--ignore-comment-regexp=IGNORE-COMMENT-REGEXP]
|
65
|
+
[--base-branch=BASE-BRANCH]
|
66
|
+
[--user=USER]
|
67
|
+
```
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/komaji/kachikachi. 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.
|
72
|
+
|
73
|
+
## License
|
74
|
+
|
75
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
76
|
+
|
77
|
+
## Code of Conduct
|
78
|
+
|
79
|
+
Everyone interacting in the Kachikachi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/komaji/kachikachi/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kachikachi"
|
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/kachikachi
ADDED
data/kachikachi.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "kachikachi/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kachikachi"
|
8
|
+
spec.version = Kachikachi::VERSION
|
9
|
+
spec.authors = ["komaji"]
|
10
|
+
spec.email = ["don.kojikoji@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Counter of deleted lines on GitHub pull request.}
|
13
|
+
spec.homepage = "https://github.com/komaji/kachikachi"
|
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
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency 'thor'
|
26
|
+
spec.add_dependency 'octokit'
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
end
|
data/lib/kachikachi.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'kachikachi/counter'
|
3
|
+
|
4
|
+
module Kachikachi
|
5
|
+
class CLI < Thor
|
6
|
+
desc 'count', 'Count removed code lines.'
|
7
|
+
option 'endpoint', default: ENV['GITHUB_API_ENDPOINT'] || 'https://api.github.com/'
|
8
|
+
option 'token', default: ENV['KACHIKACHI_GITHUB_TOKEN']
|
9
|
+
option 'repo', required: true
|
10
|
+
option 'file-regexp'
|
11
|
+
option 'milestones', type: :array
|
12
|
+
option 'pull-request-numbers', type: :array
|
13
|
+
option 'state', default: :closed
|
14
|
+
option 'ignore-white-space', type: :boolean, default: true
|
15
|
+
option 'ignore-comment-regexp'
|
16
|
+
option 'base-branch'
|
17
|
+
option 'user'
|
18
|
+
|
19
|
+
def count
|
20
|
+
@options[:milestones] || @options['pull-request-numbers'] or raise 'Need to specify milestones or pull request numbers. Please use --milestones or --pull-request-numbers options.'
|
21
|
+
Counter.new(self).count
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'kachikachi/git_hub'
|
2
|
+
|
3
|
+
module Kachikachi
|
4
|
+
class Counter
|
5
|
+
def initialize(cli)
|
6
|
+
@cli = cli
|
7
|
+
end
|
8
|
+
|
9
|
+
def count
|
10
|
+
target_patch_list = GitHub.new(@cli.options).pull_requests.map(&:target_patch_list).flatten
|
11
|
+
|
12
|
+
lines_count_list = []
|
13
|
+
target_patch_list.map { |patch|
|
14
|
+
lines_count = patch.body.only_removed.content.lines.count
|
15
|
+
lines_count_list << lines_count
|
16
|
+
puts "#{patch.file_name}: deleted #{lines_count} lines" unless lines_count.zero?
|
17
|
+
}
|
18
|
+
|
19
|
+
total_lines_count = lines_count_list.inject(0, :+)
|
20
|
+
|
21
|
+
puts "👋👋👋 total #{total_lines_count} lines 👋👋👋"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
require 'kachikachi/pull_request'
|
3
|
+
|
4
|
+
module Kachikachi
|
5
|
+
class GitHub
|
6
|
+
attr_accessor :client
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
@options = options
|
10
|
+
end
|
11
|
+
|
12
|
+
def pull_requests
|
13
|
+
pull_request_numbers = @options['pull-request-numbers']
|
14
|
+
return pull_request_numbers.map { |number| PullRequest.new(number, @options) } if pull_request_numbers
|
15
|
+
|
16
|
+
options = {
|
17
|
+
state: @options[:state]
|
18
|
+
}
|
19
|
+
options[:creator] = @options[:user] if @options[:user]
|
20
|
+
|
21
|
+
issues = milestone_numbers.map { |number|
|
22
|
+
options[:milestone] = number
|
23
|
+
client.list_issues(@options[:repo], options).select(&:pull_request)
|
24
|
+
}.flatten
|
25
|
+
|
26
|
+
issues.map{ |issue| PullRequest.new(issue.number, @options) }.select{ |pr| pr.base.ref == @options['base-branch'] }
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def milestone_numbers
|
31
|
+
client.list_milestones(@options[:repo], state: :all).select{ |milestone|
|
32
|
+
@options[:milestones].include?(milestone.title)
|
33
|
+
}.map(&:number)
|
34
|
+
end
|
35
|
+
|
36
|
+
def client
|
37
|
+
Octokit.configure do |c|
|
38
|
+
c.api_endpoint = @options['endpoint']
|
39
|
+
end
|
40
|
+
|
41
|
+
@client ||= Octokit::Client.new(access_token: @options[:token], auto_paginate: true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Kachikachi
|
2
|
+
class PatchBody
|
3
|
+
attr_accessor :content
|
4
|
+
|
5
|
+
def initialize(content, options)
|
6
|
+
@content = content || ''
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def only_removed
|
11
|
+
patch = ignore_unmodified_lines
|
12
|
+
.ignore_added_lines
|
13
|
+
patch = patch.ignore_white_space if @options['ignore-white-space']
|
14
|
+
pattern = @options['ignore-comment-regexp']
|
15
|
+
patch = patch.ignore_comment_lines(pattern) if pattern
|
16
|
+
|
17
|
+
patch
|
18
|
+
end
|
19
|
+
|
20
|
+
def ignore_unmodified_lines
|
21
|
+
PatchBody.new(@content.gsub(/^\s.*(\n|\r\n|\r)/, ''), @options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def ignore_added_lines
|
25
|
+
PatchBody.new(@content.gsub(/^\+.*(\n|\r\n|\r)/, ''), @options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def ignore_white_space
|
29
|
+
PatchBody.new(@content.gsub(/^(-|\+)\s*(\n|\r\n|\r)/, ''), @options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def ignore_comment_lines(pattern)
|
33
|
+
comment_line_regexp = Regexp.new("^[-+]?\s*#{pattern}.*(\n|\r\n|\r)")
|
34
|
+
PatchBody.new(@content.gsub(comment_line_regexp, ''), @options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
require 'kachikachi/patch'
|
3
|
+
|
4
|
+
module Kachikachi
|
5
|
+
class PullRequest
|
6
|
+
attr_accessor :number, :client, :content, :diff
|
7
|
+
|
8
|
+
def initialize(number, options)
|
9
|
+
@number = number
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def target_patch_list
|
14
|
+
patch_list.select do |patch|
|
15
|
+
!@options['file-regexp'] || patch.file_name =~ Regexp.new(@options['file-regexp'])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def patch_list
|
20
|
+
patch_body = ''
|
21
|
+
patch_list = []
|
22
|
+
patch_file_name = ''
|
23
|
+
body = false
|
24
|
+
lines = diff.lines
|
25
|
+
|
26
|
+
lines.each_with_index do |line, index|
|
27
|
+
case line
|
28
|
+
when /^diff\s--git\sa\/(?<file_name>.*)\sb\//
|
29
|
+
unless patch_body.empty?
|
30
|
+
patch_list << Patch.new(patch_file_name, patch_body, @options)
|
31
|
+
patch_body = ''
|
32
|
+
end
|
33
|
+
|
34
|
+
patch_file_name = Regexp.last_match[:file_name]
|
35
|
+
body = false
|
36
|
+
when /^@@\s-\d+,\d+\s\+\d+,\d+\s@@/
|
37
|
+
body = true
|
38
|
+
else
|
39
|
+
next unless body
|
40
|
+
|
41
|
+
patch_body << line
|
42
|
+
last_line = lines.count == index + 1
|
43
|
+
patch_list << Patch.new(patch_file_name, patch_body, @options) if last_line && !patch_body.empty?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
patch_list
|
48
|
+
end
|
49
|
+
|
50
|
+
def base
|
51
|
+
content.base
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def diff
|
56
|
+
@diff ||= client.pull_request(@options[:repo], number, accept: 'application/vnd.github.v3.diff')
|
57
|
+
end
|
58
|
+
|
59
|
+
def content
|
60
|
+
@content ||= client.pull_request(@options[:repo], number)
|
61
|
+
end
|
62
|
+
|
63
|
+
def client
|
64
|
+
Octokit.configure do |c|
|
65
|
+
c.api_endpoint = @options['endpoint']
|
66
|
+
end
|
67
|
+
|
68
|
+
@client ||= Octokit::Client.new(access_token: @options['token'], auto_paginate: true)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kachikachi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- komaji
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octokit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- don.kojikoji@gmail.com
|
86
|
+
executables:
|
87
|
+
- kachikachi
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- exe/kachikachi
|
103
|
+
- kachikachi.gemspec
|
104
|
+
- lib/kachikachi.rb
|
105
|
+
- lib/kachikachi/cli.rb
|
106
|
+
- lib/kachikachi/counter.rb
|
107
|
+
- lib/kachikachi/git_hub.rb
|
108
|
+
- lib/kachikachi/patch.rb
|
109
|
+
- lib/kachikachi/patch_body.rb
|
110
|
+
- lib/kachikachi/pull_request.rb
|
111
|
+
- lib/kachikachi/version.rb
|
112
|
+
homepage: https://github.com/komaji/kachikachi
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.7.6
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: Counter of deleted lines on GitHub pull request.
|
136
|
+
test_files: []
|