mergem 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.0pdd.yml +9 -0
- data/.gitattributes +7 -0
- data/.github/workflows/cron.yml +15 -0
- data/.github/workflows/pdd.yml +11 -0
- data/.github/workflows/rake.yml +27 -0
- data/.github/workflows/xcop.yml +11 -0
- data/.gitignore +8 -0
- data/.pdd +7 -0
- data/.rubocop.yml +23 -0
- data/.rultor.yml +20 -0
- data/.simplecov +38 -0
- data/Gemfile +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +83 -0
- data/bin/mergem +103 -0
- data/features/cli.feature +16 -0
- data/features/gem_package.feature +23 -0
- data/features/step_definitions/steps.rb +86 -0
- data/features/support/env.rb +21 -0
- data/lib/mergem/askrultor.rb +44 -0
- data/lib/mergem/pulls.rb +44 -0
- data/lib/mergem/version.rb +27 -0
- data/mergem.gemspec +58 -0
- data/test/test__helper.rb +30 -0
- data/test/test_askrultor.rb +40 -0
- data/test/test_pulls.rb +45 -0
- metadata +284 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8544f1985d8470a64aa5f012576351d4f18592adbf74f4fd54035f541aadd4cd
|
4
|
+
data.tar.gz: c969c24ddb79efca6b15f7d91652eeb5c9ef9d5c3b0de6f779d4b0809cfcdcbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f72c7388b4b5e194352fd96b28c0248a2e92a23122daa27f657b50f45a9332ef35f4ffae3ac31aae319bd4baf64de00c1d2955526c7d3f55dc7c230a10bcf86b
|
7
|
+
data.tar.gz: 6c7e2018f6d6b80a82c120ecb5326e26a3612d3391899ad0ffe2078fc2e1a0e1e4e606f12b085e6f18cc1d471d3048f353335ba42167f666d83942304480b692
|
data/.0pdd.yml
ADDED
data/.gitattributes
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
name: cron
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: '*/15 * * * *'
|
6
|
+
jobs:
|
7
|
+
cron:
|
8
|
+
runs-on: ubuntu-20.04
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v3
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: ${{ matrix.ruby }}
|
14
|
+
- run: bundle update
|
15
|
+
- run: bin/mergem --repo=yegor256/mergem --token=${{ secrets.TOKEN }}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
name: rake
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu-20.04, macos-12]
|
15
|
+
ruby: ['2.7', '3.0']
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- uses: actions/cache@v3
|
20
|
+
with:
|
21
|
+
path: .mergem-cache
|
22
|
+
key: main
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
- run: bundle update
|
27
|
+
- run: bundle exec rake
|
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'bin/**/*'
|
4
|
+
- 'assets/**/*'
|
5
|
+
DisplayCopNames: true
|
6
|
+
TargetRubyVersion: 2.2
|
7
|
+
NewCops: enable
|
8
|
+
SuggestExtensions: false
|
9
|
+
|
10
|
+
Metrics/CyclomaticComplexity:
|
11
|
+
Max: 10
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Enabled: false
|
14
|
+
Layout/MultilineMethodCallIndentation:
|
15
|
+
Enabled: false
|
16
|
+
Metrics/AbcSize:
|
17
|
+
Enabled: false
|
18
|
+
Metrics/BlockLength:
|
19
|
+
Max: 50
|
20
|
+
Layout/EmptyLineAfterGuardClause:
|
21
|
+
Enabled: false
|
22
|
+
Style/ClassAndModuleChildren:
|
23
|
+
Enabled: false
|
data/.rultor.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
docker:
|
2
|
+
image: yegor256/rultor-image:1.13.0
|
3
|
+
assets:
|
4
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
|
+
install: |
|
6
|
+
pdd -f /dev/null
|
7
|
+
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
8
|
+
release:
|
9
|
+
script: |-
|
10
|
+
bundle exec rake
|
11
|
+
rm -rf *.gem
|
12
|
+
sed -i "s/0\.0\.0/${tag}/g" lib/mergem/version.rb
|
13
|
+
git add lib/mergem/version.rb
|
14
|
+
git commit -m "version set to ${tag}"
|
15
|
+
gem build mergem.gemspec
|
16
|
+
chmod 0600 ../rubygems.yml
|
17
|
+
gem push *.gem --config-file ../rubygems.yml
|
18
|
+
merge:
|
19
|
+
script: |-
|
20
|
+
bundle exec rake
|
data/.simplecov
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
if Gem.win_platform?
|
22
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
23
|
+
SimpleCov::Formatter::HTMLFormatter
|
24
|
+
]
|
25
|
+
SimpleCov.start do
|
26
|
+
add_filter '/test/'
|
27
|
+
add_filter '/features/'
|
28
|
+
end
|
29
|
+
else
|
30
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
31
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
32
|
+
)
|
33
|
+
SimpleCov.start do
|
34
|
+
add_filter '/test/'
|
35
|
+
add_filter '/features/'
|
36
|
+
minimum_coverage 80
|
37
|
+
end
|
38
|
+
end
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
source 'https://rubygems.org'
|
22
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Yegor Bugayenko
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
<img alt="mergem logo" src="/logo.svg" width="64px"/>
|
2
|
+
|
3
|
+
[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
|
4
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/mergem)](http://www.rultor.com/p/yegor256/mergem)
|
5
|
+
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
6
|
+
|
7
|
+
[![rake](https://github.com/yegor256/mergem/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/mergem/actions/workflows/rake.yml)
|
8
|
+
[![PDD status](http://www.0pdd.com/svg?name=yegor256/mergem)](http://www.0pdd.com/p?name=yegor256/mergem)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/mergem.svg)](http://badge.fury.io/rb/mergem)
|
10
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/mergem/blob/master/LICENSE.txt)
|
11
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/396ec0584e0a84adc723/maintainability)](https://codeclimate.com/github/yegor256/mergem/maintainability)
|
12
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/mergem.svg)](https://codecov.io/github/yegor256/mergem?branch=master)
|
13
|
+
![Lines of code](https://img.shields.io/tokei/lines/github/yegor256/mergem)
|
14
|
+
[![Hits-of-Code](https://hitsofcode.com/github/yegor256/mergem)](https://hitsofcode.com/view/github/yegor256/mergem)
|
15
|
+
|
16
|
+
This simple script may help you deal with pull requests
|
17
|
+
coming to your GitHub repositories from robots:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ gem install mergem
|
21
|
+
```
|
22
|
+
|
23
|
+
Then, run it locally and read its output:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ mergem --repo yegor256/mergem --verbose --token <YOUR_GITHUB_TOKEN>
|
27
|
+
```
|
28
|
+
|
29
|
+
## How to contribute
|
30
|
+
|
31
|
+
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
32
|
+
Make sure you build is green before you contribute
|
33
|
+
your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
34
|
+
[Bundler](https://bundler.io/) installed. Then:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ bundle update
|
38
|
+
$ bundle exec rake
|
39
|
+
```
|
40
|
+
|
41
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
data/Rakefile
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'rubygems'
|
22
|
+
require 'rake'
|
23
|
+
require 'rdoc'
|
24
|
+
require 'rake/clean'
|
25
|
+
|
26
|
+
def name
|
27
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
28
|
+
end
|
29
|
+
|
30
|
+
def version
|
31
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
32
|
+
end
|
33
|
+
|
34
|
+
task default: %i[clean test features rubocop xcop copyright]
|
35
|
+
|
36
|
+
require 'rake/testtask'
|
37
|
+
desc 'Run all unit tests'
|
38
|
+
Rake::TestTask.new(:test) do |test|
|
39
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
40
|
+
test.libs << 'lib' << 'test'
|
41
|
+
test.pattern = 'test/**/test_*.rb'
|
42
|
+
test.verbose = false
|
43
|
+
end
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
desc 'Build RDoc documentation'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "#{name} #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'rubocop/rake_task'
|
55
|
+
desc 'Run RuboCop on all directories'
|
56
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
57
|
+
task.fail_on_error = true
|
58
|
+
task.requires << 'rubocop-rspec'
|
59
|
+
task.options = ['--display-cop-names']
|
60
|
+
end
|
61
|
+
|
62
|
+
require 'xcop/rake_task'
|
63
|
+
Xcop::RakeTask.new(:xcop) do |task|
|
64
|
+
task.license = 'LICENSE.txt'
|
65
|
+
task.includes = ['**/*.xml', '**/*.xsl', '**/*.xsd', '**/*.html']
|
66
|
+
task.excludes = ['mergem/**', 'coverage/**']
|
67
|
+
end
|
68
|
+
|
69
|
+
require 'cucumber/rake/task'
|
70
|
+
Cucumber::Rake::Task.new(:features) do
|
71
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
72
|
+
end
|
73
|
+
Cucumber::Rake::Task.new(:'features:html') do |t|
|
74
|
+
t.profile = 'html_report'
|
75
|
+
end
|
76
|
+
|
77
|
+
task :copyright do
|
78
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
79
|
+
--include '*.rb' \
|
80
|
+
--include '*.txt' \
|
81
|
+
--include 'Rakefile' \
|
82
|
+
."
|
83
|
+
end
|
data/bin/mergem
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
+
# SOFTWARE.
|
21
|
+
|
22
|
+
STDOUT.sync = true
|
23
|
+
|
24
|
+
require 'slop'
|
25
|
+
require 'loog'
|
26
|
+
require 'octokit'
|
27
|
+
require 'backtrace'
|
28
|
+
require 'fileutils'
|
29
|
+
require 'obk'
|
30
|
+
require_relative '../lib/mergem/version'
|
31
|
+
require_relative '../lib/mergem/pulls'
|
32
|
+
|
33
|
+
loog = Loog::REGULAR
|
34
|
+
|
35
|
+
def config(path)
|
36
|
+
f = File.expand_path(path)
|
37
|
+
args = []
|
38
|
+
args += File.readlines(f).map(&:strip).reject { |a| a.empty? } if File.exist?(f)
|
39
|
+
args
|
40
|
+
end
|
41
|
+
|
42
|
+
args = config('~/.mergem') + config('.mergem') + ARGV
|
43
|
+
|
44
|
+
opts = Slop.parse(args, strict: true, help: true) do |o|
|
45
|
+
o.banner = "Usage (#{Mergem::VERSION}): mergem [options]"
|
46
|
+
o.bool '-h', '--help', 'Show these instructions'
|
47
|
+
o.bool '--version', 'Show current version'
|
48
|
+
o.bool '--verbose', 'Print as much log messages as possible'
|
49
|
+
o.bool '--dry', 'Make no real round trips to GitHub'
|
50
|
+
o.string '--cache', 'Use this file as a cache, to avoid duplicated roudtrips to GitHub', default: '.mergem-cache'
|
51
|
+
o.integer '--delay', 'Delay between HTTP calls to GitHub API, in milliseconds', default: 1000
|
52
|
+
o.string '--token', 'GitHub authentication token'
|
53
|
+
o.array '--repo', 'GitHub repo to check, e.g. yegor256/blog'
|
54
|
+
end
|
55
|
+
|
56
|
+
if opts.help?
|
57
|
+
puts opts
|
58
|
+
exit
|
59
|
+
end
|
60
|
+
|
61
|
+
if opts.verbose?
|
62
|
+
loog = Loog::VERBOSE
|
63
|
+
end
|
64
|
+
|
65
|
+
if opts.version?
|
66
|
+
loog.info(Mergem::VERSION)
|
67
|
+
exit
|
68
|
+
end
|
69
|
+
|
70
|
+
Encoding.default_external = Encoding::UTF_8
|
71
|
+
Encoding.default_internal = Encoding::UTF_8
|
72
|
+
|
73
|
+
def api(opts, loog)
|
74
|
+
if opts.token?
|
75
|
+
api = Octokit::Client.new(:access_token => opts[:token])
|
76
|
+
else
|
77
|
+
api = Octokit::Client.new
|
78
|
+
loog.warn("Connecting to GitHub without a token, this may lead to errors, use --token")
|
79
|
+
end
|
80
|
+
api.auto_paginate = true
|
81
|
+
Obk.new(api, pause: opts[:delay])
|
82
|
+
end
|
83
|
+
|
84
|
+
begin
|
85
|
+
cache = File.absolute_path(opts[:cache])
|
86
|
+
loog.debug("Cache file is #{cache}")
|
87
|
+
api = api(opts, loog)
|
88
|
+
if opts.dry?
|
89
|
+
total = 1
|
90
|
+
else
|
91
|
+
total = Mergem::Pulls.new(api, loog, opts[:repo]).each do |repo, pr|
|
92
|
+
title = "#{repo}/##{pr}"
|
93
|
+
next unless File.readlines(cache).find(title).nil?
|
94
|
+
Mergem::AskRultor.new(api, loog).ask(repo, pr)
|
95
|
+
open(cache, 'a') { |f| f.puts title }
|
96
|
+
loog.info("#{title} checked")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
loog.debug("#{total} PRs processed")
|
100
|
+
rescue StandardError => e
|
101
|
+
loog.error(Backtrace.new(e))
|
102
|
+
exit -1
|
103
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Simple Reporting
|
2
|
+
I want to be able to build a report
|
3
|
+
|
4
|
+
Scenario: Help can be printed
|
5
|
+
When I run bin/mergem with "-h"
|
6
|
+
Then Exit code is zero
|
7
|
+
And Stdout contains "--help"
|
8
|
+
|
9
|
+
Scenario: Version can be printed
|
10
|
+
When I run bin/mergem with "--version"
|
11
|
+
Then Exit code is zero
|
12
|
+
|
13
|
+
Scenario: Simple roundtrip to GitHub
|
14
|
+
When I run bin/mergem with "--repo yegor256/mergem --dry --verbose"
|
15
|
+
Then Stdout contains "1 PRs processed"
|
16
|
+
And Exit code is zero
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Gem Package
|
2
|
+
As a source code writer I want to be able to
|
3
|
+
package the Gem into .gem file
|
4
|
+
|
5
|
+
Scenario: Gem can be packaged
|
6
|
+
Given I have a "execs.rb" file with content:
|
7
|
+
"""
|
8
|
+
#!/usr/bin/env ruby
|
9
|
+
require 'rubygems'
|
10
|
+
spec = Gem::Specification::load('./spec.rb')
|
11
|
+
if spec.executables.empty?
|
12
|
+
fail 'no executables: ' + File.read('./spec.rb')
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
When I run bash with:
|
16
|
+
"""
|
17
|
+
cd mergem
|
18
|
+
gem build mergem.gemspec
|
19
|
+
gem specification --ruby mergem-*.gem > ../spec.rb
|
20
|
+
cd ..
|
21
|
+
ruby execs.rb
|
22
|
+
"""
|
23
|
+
Then Exit code is zero
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'nokogiri'
|
22
|
+
require 'tmpdir'
|
23
|
+
require 'slop'
|
24
|
+
require 'English'
|
25
|
+
|
26
|
+
Before do
|
27
|
+
@cwd = Dir.pwd
|
28
|
+
@dir = Dir.mktmpdir('test')
|
29
|
+
FileUtils.mkdir_p(@dir)
|
30
|
+
Dir.chdir(@dir)
|
31
|
+
@opts = Slop.parse ['-v'] do |o|
|
32
|
+
o.bool '-v', '--verbose'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
After do
|
37
|
+
Dir.chdir(@cwd)
|
38
|
+
FileUtils.rm_rf(@dir)
|
39
|
+
end
|
40
|
+
|
41
|
+
Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
|
42
|
+
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
|
43
|
+
File.write(file, text.gsub(/\\xFF/, 0xFF.chr))
|
44
|
+
end
|
45
|
+
|
46
|
+
When(%r{^I run bin/mergem with "([^"]*)"$}) do |arg|
|
47
|
+
home = File.join(File.dirname(__FILE__), '../..')
|
48
|
+
@stdout = `ruby -I#{home}/lib #{home}/bin/mergem #{arg}`
|
49
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
50
|
+
end
|
51
|
+
|
52
|
+
Then(/^Stdout contains "([^"]*)"$/) do |txt|
|
53
|
+
raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}" unless @stdout.include?(txt)
|
54
|
+
end
|
55
|
+
|
56
|
+
Then(/^Stdout is empty$/) do
|
57
|
+
raise "STDOUT is not empty:\n#{@stdout}" unless @stdout == ''
|
58
|
+
end
|
59
|
+
|
60
|
+
Then(/^Exit code is zero$/) do
|
61
|
+
raise "Non-zero exit #{@exitstatus}:\n#{@stdout}" unless @exitstatus.zero?
|
62
|
+
end
|
63
|
+
|
64
|
+
Then(/^Exit code is not zero$/) do
|
65
|
+
raise 'Zero exit code' if @exitstatus.zero?
|
66
|
+
end
|
67
|
+
|
68
|
+
When(/^I run bash with "([^"]*)"$/) do |text|
|
69
|
+
FileUtils.copy_entry(@cwd, File.join(@dir, 'mergem'))
|
70
|
+
@stdout = `#{text}`
|
71
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
72
|
+
end
|
73
|
+
|
74
|
+
When(/^I run bash with:$/) do |text|
|
75
|
+
FileUtils.copy_entry(@cwd, File.join(@dir, 'mergem'))
|
76
|
+
@stdout = `#{text}`
|
77
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
78
|
+
end
|
79
|
+
|
80
|
+
Given(/^It is Unix$/) do
|
81
|
+
pending if Gem.win_platform?
|
82
|
+
end
|
83
|
+
|
84
|
+
Given(/^It is Windows$/) do
|
85
|
+
pending unless Gem.win_platform?
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'simplecov'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
# Ask Rultor to merge a pull request.
|
22
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
23
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
24
|
+
# License:: MIT
|
25
|
+
class Mergem::AskRultor
|
26
|
+
def initialize(api, loog)
|
27
|
+
@api = api
|
28
|
+
@loog = loog
|
29
|
+
end
|
30
|
+
|
31
|
+
def ask(repo, num)
|
32
|
+
begin
|
33
|
+
user = @api.user[:login]
|
34
|
+
rescue Octokit::Unauthorized
|
35
|
+
user = 'yegor256'
|
36
|
+
@loog.debug('You are not using GitHub token...')
|
37
|
+
end
|
38
|
+
json = @api.issue_comments(repo, num)
|
39
|
+
@loog.debug("Found #{json.count} comments in #{repo}##{num}")
|
40
|
+
return false unless json.find { |j| j[:user][:login] == user }.nil?
|
41
|
+
@api.add_comment(repo, num, '@rultor please, try to merge')
|
42
|
+
true
|
43
|
+
end
|
44
|
+
end
|
data/lib/mergem/pulls.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
# Pulls in GitHub API.
|
22
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
23
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
24
|
+
# License:: MIT
|
25
|
+
class Mergem::Pulls
|
26
|
+
def initialize(api, loog, repos)
|
27
|
+
@api = api
|
28
|
+
@loog = loog
|
29
|
+
@repos = repos
|
30
|
+
end
|
31
|
+
|
32
|
+
def each
|
33
|
+
total = 0
|
34
|
+
@repos.each do |repo|
|
35
|
+
json = @api.pull_requests(repo, state: 'open')
|
36
|
+
@loog.debug("Found #{json.count} pull requests in #{repo}")
|
37
|
+
json.each do |p|
|
38
|
+
yield repo, p[:number]
|
39
|
+
total += 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
total
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
# mergem main module.
|
22
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
23
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
24
|
+
# License:: MIT
|
25
|
+
module Mergem
|
26
|
+
VERSION = '0.0.1'.freeze
|
27
|
+
end
|
data/mergem.gemspec
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'English'
|
22
|
+
|
23
|
+
lib = File.expand_path('lib', __dir__)
|
24
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
|
+
require_relative 'lib/mergem/version'
|
26
|
+
|
27
|
+
Gem::Specification.new do |s|
|
28
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
|
+
s.required_ruby_version = '>= 2.2'
|
30
|
+
s.name = 'mergem'
|
31
|
+
s.version = Mergem::VERSION
|
32
|
+
s.license = 'MIT'
|
33
|
+
s.metadata = { 'rubygems_mfa_required' => 'true' }
|
34
|
+
s.summary = 'GitHub API client the deals with Pull Requests'
|
35
|
+
s.description = 'tbd...'
|
36
|
+
s.authors = ['Yegor Bugayenko']
|
37
|
+
s.email = 'yegor256@gmail.com'
|
38
|
+
s.homepage = 'http://github.com/yegor256/mergem'
|
39
|
+
s.files = `git ls-files`.split($RS)
|
40
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
41
|
+
s.rdoc_options = ['--charset=UTF-8']
|
42
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
43
|
+
s.add_runtime_dependency 'backtrace', '~>0.3'
|
44
|
+
s.add_runtime_dependency 'iri', '~>0.5'
|
45
|
+
s.add_runtime_dependency 'loog', '~>0.2'
|
46
|
+
s.add_runtime_dependency 'obk', '0.3.0'
|
47
|
+
s.add_runtime_dependency 'octokit', '~>4.0'
|
48
|
+
s.add_runtime_dependency 'rainbow', '~>3.0'
|
49
|
+
s.add_runtime_dependency 'slop', '~>4.4'
|
50
|
+
s.add_development_dependency 'codecov', '0.6.0'
|
51
|
+
s.add_development_dependency 'cucumber', '8.0.0'
|
52
|
+
s.add_development_dependency 'minitest', '5.15.0'
|
53
|
+
s.add_development_dependency 'rake', '13.0.6'
|
54
|
+
s.add_development_dependency 'rdoc', '6.4.0'
|
55
|
+
s.add_development_dependency 'rubocop', '1.32.0'
|
56
|
+
s.add_development_dependency 'rubocop-rspec', '2.11.1'
|
57
|
+
s.add_development_dependency 'xcop', '0.7.1'
|
58
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
$stdout.sync = true
|
22
|
+
|
23
|
+
require 'simplecov'
|
24
|
+
SimpleCov.start
|
25
|
+
if ENV['CI'] == 'true'
|
26
|
+
require 'codecov'
|
27
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'minitest/autorun'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'minitest/autorun'
|
22
|
+
require 'octokit'
|
23
|
+
require 'loog'
|
24
|
+
require_relative '../lib/mergem/askrultor'
|
25
|
+
|
26
|
+
# Test for AskRultor.
|
27
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
29
|
+
# License:: MIT
|
30
|
+
class TestAskRultor < Minitest::Test
|
31
|
+
def test_real
|
32
|
+
api = Octokit::Client.new
|
33
|
+
m = Mergem::AskRultor.new(api, Loog::VERBOSE)
|
34
|
+
asked = m.ask('yegor256/mergem', 1)
|
35
|
+
assert(!asked)
|
36
|
+
rescue Octokit::TooManyRequests => e
|
37
|
+
puts e.message
|
38
|
+
skip
|
39
|
+
end
|
40
|
+
end
|
data/test/test_pulls.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'minitest/autorun'
|
22
|
+
require 'octokit'
|
23
|
+
require 'loog'
|
24
|
+
require_relative '../lib/mergem/pulls'
|
25
|
+
|
26
|
+
# Test for Pulls.
|
27
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
29
|
+
# License:: MIT
|
30
|
+
class TestPulls < Minitest::Test
|
31
|
+
def test_real
|
32
|
+
api = Octokit::Client.new
|
33
|
+
m = Mergem::Pulls.new(api, Loog::VERBOSE, ['yegor256/blog'])
|
34
|
+
ms = []
|
35
|
+
total = m.each do |repo, pr|
|
36
|
+
ms << "#{repo}##{pr}"
|
37
|
+
end
|
38
|
+
assert(!ms.empty?)
|
39
|
+
assert_equal(total, ms.count)
|
40
|
+
p ms
|
41
|
+
rescue Octokit::TooManyRequests => e
|
42
|
+
puts e.message
|
43
|
+
skip
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,284 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mergem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: backtrace
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: iri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: loog
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: obk
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.3.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.3.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octokit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rainbow
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: slop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.4'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.6.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.6.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: cucumber
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 8.0.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 8.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: minitest
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 5.15.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 5.15.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rake
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 13.0.6
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 13.0.6
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rdoc
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 6.4.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 6.4.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - '='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 1.32.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 1.32.0
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rubocop-rspec
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - '='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 2.11.1
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - '='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 2.11.1
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: xcop
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - '='
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 0.7.1
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - '='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 0.7.1
|
223
|
+
description: tbd...
|
224
|
+
email: yegor256@gmail.com
|
225
|
+
executables:
|
226
|
+
- mergem
|
227
|
+
extensions: []
|
228
|
+
extra_rdoc_files:
|
229
|
+
- README.md
|
230
|
+
- LICENSE.txt
|
231
|
+
files:
|
232
|
+
- ".0pdd.yml"
|
233
|
+
- ".gitattributes"
|
234
|
+
- ".github/workflows/cron.yml"
|
235
|
+
- ".github/workflows/pdd.yml"
|
236
|
+
- ".github/workflows/rake.yml"
|
237
|
+
- ".github/workflows/xcop.yml"
|
238
|
+
- ".gitignore"
|
239
|
+
- ".pdd"
|
240
|
+
- ".rubocop.yml"
|
241
|
+
- ".rultor.yml"
|
242
|
+
- ".simplecov"
|
243
|
+
- Gemfile
|
244
|
+
- LICENSE.txt
|
245
|
+
- README.md
|
246
|
+
- Rakefile
|
247
|
+
- bin/mergem
|
248
|
+
- features/cli.feature
|
249
|
+
- features/gem_package.feature
|
250
|
+
- features/step_definitions/steps.rb
|
251
|
+
- features/support/env.rb
|
252
|
+
- lib/mergem/askrultor.rb
|
253
|
+
- lib/mergem/pulls.rb
|
254
|
+
- lib/mergem/version.rb
|
255
|
+
- mergem.gemspec
|
256
|
+
- test/test__helper.rb
|
257
|
+
- test/test_askrultor.rb
|
258
|
+
- test/test_pulls.rb
|
259
|
+
homepage: http://github.com/yegor256/mergem
|
260
|
+
licenses:
|
261
|
+
- MIT
|
262
|
+
metadata:
|
263
|
+
rubygems_mfa_required: 'true'
|
264
|
+
post_install_message:
|
265
|
+
rdoc_options:
|
266
|
+
- "--charset=UTF-8"
|
267
|
+
require_paths:
|
268
|
+
- lib
|
269
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
270
|
+
requirements:
|
271
|
+
- - ">="
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
version: '2.2'
|
274
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
279
|
+
requirements: []
|
280
|
+
rubygems_version: 3.1.2
|
281
|
+
signing_key:
|
282
|
+
specification_version: 4
|
283
|
+
summary: GitHub API client the deals with Pull Requests
|
284
|
+
test_files: []
|