danger-conflict_checker 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/.gitignore +50 -0
- data/Dangerfile +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +136 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +22 -0
- data/Rakefile +23 -0
- data/circle.yml +3 -0
- data/danger-conflict_checker.gemspec +50 -0
- data/hoge +4 -0
- data/lib/conflict_checker/gem_version.rb +3 -0
- data/lib/conflict_checker/plugin.rb +106 -0
- data/lib/danger_conflict_checker.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/spec/conflict_checker_spec.rb +10 -0
- data/spec/spec_helper.rb +59 -0
- metadata +217 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 671dac39d361a00da0e71cbb04b1f43f1c678f27
|
4
|
+
data.tar.gz: 37bf9d53a89a6d47b9f03bb33af4b2627e26f6f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ff0aa2350d385b44ca99bfb188042bb6c5d622e0fbcdbdbb3f253e1a256ec589399609e27c2cff80214d37a5ce9b0226b410152eed7cfac27613f9448ed7d5d
|
7
|
+
data.tar.gz: 4b8820cbefc1aa3c2e0f5a82a8754437799be449e5e83ec696a91c9c6826ac1949cf8e2f303c16ea092fdeeb381aa8b46fa5f83e65d587014c23e3dbc8ff3fb8
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Dangerfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
conflict_checker.check_conflict_and_comment()
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-conflict_checker (0.0.1)
|
5
|
+
danger-plugin-api (~> 1.0)
|
6
|
+
git (~> 1.3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.5.1)
|
12
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
13
|
+
ast (2.3.0)
|
14
|
+
claide (1.0.2)
|
15
|
+
claide-plugins (0.9.2)
|
16
|
+
cork
|
17
|
+
nap
|
18
|
+
open4 (~> 1.3)
|
19
|
+
coderay (1.1.1)
|
20
|
+
colored2 (3.1.2)
|
21
|
+
cork (0.3.0)
|
22
|
+
colored2 (~> 3.1)
|
23
|
+
danger (5.2.2)
|
24
|
+
claide (~> 1.0)
|
25
|
+
claide-plugins (>= 0.9.2)
|
26
|
+
colored2 (~> 3.1)
|
27
|
+
cork (~> 0.1)
|
28
|
+
faraday (~> 0.9)
|
29
|
+
faraday-http-cache (~> 1.0)
|
30
|
+
git (~> 1)
|
31
|
+
kramdown (~> 1.5)
|
32
|
+
octokit (~> 4.2)
|
33
|
+
terminal-table (~> 1)
|
34
|
+
danger-plugin-api (1.0.0)
|
35
|
+
danger (> 2.0)
|
36
|
+
diff-lcs (1.3)
|
37
|
+
faraday (0.12.1)
|
38
|
+
multipart-post (>= 1.2, < 3)
|
39
|
+
faraday-http-cache (1.3.1)
|
40
|
+
faraday (~> 0.8)
|
41
|
+
ffi (1.9.18)
|
42
|
+
formatador (0.2.5)
|
43
|
+
git (1.3.0)
|
44
|
+
guard (2.14.1)
|
45
|
+
formatador (>= 0.2.4)
|
46
|
+
listen (>= 2.7, < 4.0)
|
47
|
+
lumberjack (~> 1.0)
|
48
|
+
nenv (~> 0.1)
|
49
|
+
notiffany (~> 0.0)
|
50
|
+
pry (>= 0.9.12)
|
51
|
+
shellany (~> 0.0)
|
52
|
+
thor (>= 0.18.1)
|
53
|
+
guard-compat (1.2.1)
|
54
|
+
guard-rspec (4.7.3)
|
55
|
+
guard (~> 2.1)
|
56
|
+
guard-compat (~> 1.1)
|
57
|
+
rspec (>= 2.99.0, < 4.0)
|
58
|
+
kramdown (1.13.2)
|
59
|
+
listen (3.0.7)
|
60
|
+
rb-fsevent (>= 0.9.3)
|
61
|
+
rb-inotify (>= 0.9.7)
|
62
|
+
lumberjack (1.0.12)
|
63
|
+
method_source (0.8.2)
|
64
|
+
multipart-post (2.0.0)
|
65
|
+
nap (1.1.0)
|
66
|
+
nenv (0.3.0)
|
67
|
+
notiffany (0.1.1)
|
68
|
+
nenv (~> 0.1)
|
69
|
+
shellany (~> 0.0)
|
70
|
+
octokit (4.7.0)
|
71
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
72
|
+
open4 (1.3.4)
|
73
|
+
parallel (1.11.2)
|
74
|
+
parser (2.4.0.0)
|
75
|
+
ast (~> 2.2)
|
76
|
+
powerpack (0.1.1)
|
77
|
+
pry (0.10.4)
|
78
|
+
coderay (~> 1.1.0)
|
79
|
+
method_source (~> 0.8.1)
|
80
|
+
slop (~> 3.4)
|
81
|
+
public_suffix (2.0.5)
|
82
|
+
rainbow (2.2.2)
|
83
|
+
rake
|
84
|
+
rake (10.5.0)
|
85
|
+
rb-fsevent (0.9.8)
|
86
|
+
rb-inotify (0.9.8)
|
87
|
+
ffi (>= 0.5.0)
|
88
|
+
rspec (3.6.0)
|
89
|
+
rspec-core (~> 3.6.0)
|
90
|
+
rspec-expectations (~> 3.6.0)
|
91
|
+
rspec-mocks (~> 3.6.0)
|
92
|
+
rspec-core (3.6.0)
|
93
|
+
rspec-support (~> 3.6.0)
|
94
|
+
rspec-expectations (3.6.0)
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
+
rspec-support (~> 3.6.0)
|
97
|
+
rspec-mocks (3.6.0)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.6.0)
|
100
|
+
rspec-support (3.6.0)
|
101
|
+
rubocop (0.49.1)
|
102
|
+
parallel (~> 1.10)
|
103
|
+
parser (>= 2.3.3.1, < 3.0)
|
104
|
+
powerpack (~> 0.1)
|
105
|
+
rainbow (>= 1.99.1, < 3.0)
|
106
|
+
ruby-progressbar (~> 1.7)
|
107
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
108
|
+
ruby-progressbar (1.8.1)
|
109
|
+
sawyer (0.8.1)
|
110
|
+
addressable (>= 2.3.5, < 2.6)
|
111
|
+
faraday (~> 0.8, < 1.0)
|
112
|
+
shellany (0.0.1)
|
113
|
+
slop (3.6.0)
|
114
|
+
terminal-table (1.8.0)
|
115
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
|
+
thor (0.19.4)
|
117
|
+
unicode-display_width (1.2.1)
|
118
|
+
yard (0.9.9)
|
119
|
+
|
120
|
+
PLATFORMS
|
121
|
+
ruby
|
122
|
+
|
123
|
+
DEPENDENCIES
|
124
|
+
bundler (~> 1.3)
|
125
|
+
danger-conflict_checker!
|
126
|
+
guard (~> 2.14)
|
127
|
+
guard-rspec (~> 4.7)
|
128
|
+
listen (= 3.0.7)
|
129
|
+
pry
|
130
|
+
rake (~> 10.0)
|
131
|
+
rspec (~> 3.4)
|
132
|
+
rubocop (~> 0.41)
|
133
|
+
yard (~> 0.8)
|
134
|
+
|
135
|
+
BUNDLED WITH
|
136
|
+
1.13.6
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A guardfile for making Danger Plugins
|
2
|
+
# For more info see https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# To run, use `bundle exec guard`.
|
5
|
+
|
6
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
7
|
+
require 'guard/rspec/dsl'
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2017 Masayoshi Sakamoto <masayoshi.sakamoto@dena.com>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# danger-conflict_checker
|
2
|
+
|
3
|
+
Warn about the conflict between PRs.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install danger-conflict_checker
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
### methods
|
12
|
+
Get information about the conflict between PRs.
|
13
|
+
|
14
|
+
```
|
15
|
+
check_results = conflict_checker.check_conflict
|
16
|
+
```
|
17
|
+
|
18
|
+
Warn in PR comment about the conflict between PRs.
|
19
|
+
|
20
|
+
```
|
21
|
+
conflict_checker.check_conflict_and_comment
|
22
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:specs)
|
6
|
+
|
7
|
+
task default: :specs
|
8
|
+
|
9
|
+
task :spec do
|
10
|
+
Rake::Task['specs'].invoke
|
11
|
+
Rake::Task['rubocop'].invoke
|
12
|
+
Rake::Task['spec_docs'].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run RuboCop on the lib/specs directory'
|
16
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
17
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Ensure that the plugin passes `danger plugins lint`'
|
21
|
+
task :spec_docs do
|
22
|
+
sh 'bundle exec danger plugins lint'
|
23
|
+
end
|
data/circle.yml
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'conflict_checker/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-conflict_checker'
|
8
|
+
spec.version = ConflictChecker::VERSION
|
9
|
+
spec.authors = ['Masayoshi Sakamoto']
|
10
|
+
spec.email = ['masayoshi.sakamoto@dena.com']
|
11
|
+
spec.description = "Warn about the conflict between PRs."
|
12
|
+
spec.summary = "This is plugin for Danger that warn about the conflict between PRs."
|
13
|
+
spec.homepage = 'https://github.com/justice3120/danger-conflict_checker'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
22
|
+
spec.add_runtime_dependency 'git', '~> 1.3.0'
|
23
|
+
|
24
|
+
# General ruby development
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
|
28
|
+
# Testing support
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
30
|
+
|
31
|
+
# Linting code and docs
|
32
|
+
spec.add_development_dependency "rubocop", "~> 0.41"
|
33
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
34
|
+
|
35
|
+
# Makes testing easy via `bundle exec guard`
|
36
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
37
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
38
|
+
|
39
|
+
# If you want to work on older builds of ruby
|
40
|
+
spec.add_development_dependency 'listen', '3.0.7'
|
41
|
+
|
42
|
+
# This gives you the chance to run a REPL inside your tests
|
43
|
+
# via:
|
44
|
+
#
|
45
|
+
# require 'pry'
|
46
|
+
# binding.pry
|
47
|
+
#
|
48
|
+
# This will stop test execution and let you inspect the results
|
49
|
+
spec.add_development_dependency 'pry'
|
50
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
require 'tempfile'
|
3
|
+
require "open3"
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
module Danger
|
7
|
+
# Check and warn the conflict between PRs.
|
8
|
+
#
|
9
|
+
# @example Get information about the conflict between PRs.
|
10
|
+
# conflict_checker.check_conflict
|
11
|
+
# @example Warn in PR comment about the conflict between PRs.
|
12
|
+
# conflict_checker.check_conflict_and_comment
|
13
|
+
#
|
14
|
+
# @see justice3120/danger-conflict_checker
|
15
|
+
# @tags pr conflict
|
16
|
+
#
|
17
|
+
class DangerConflictChecker < Plugin
|
18
|
+
|
19
|
+
def initialize(dangerfile)
|
20
|
+
super(dangerfile)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get information about the conflict between PRs
|
24
|
+
# @return [Array<Hash>]
|
25
|
+
#
|
26
|
+
def check_conflict()
|
27
|
+
check_results = []
|
28
|
+
|
29
|
+
repo_name = github.pr_json[:base][:repo][:full_name]
|
30
|
+
|
31
|
+
pull_requests = github.api.pull_requests(repo_name).select do |pr|
|
32
|
+
pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]
|
33
|
+
end
|
34
|
+
|
35
|
+
return if pull_requests.empty?
|
36
|
+
|
37
|
+
g = Git.open(Dir.pwd)
|
38
|
+
|
39
|
+
pull_requests.each do |pr|
|
40
|
+
result = {
|
41
|
+
pull_request: pr,
|
42
|
+
mergeable: true,
|
43
|
+
conflicts: []
|
44
|
+
}
|
45
|
+
|
46
|
+
uuid = SecureRandom.uuid
|
47
|
+
|
48
|
+
r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])
|
49
|
+
r.fetch()
|
50
|
+
|
51
|
+
branch1 = github.pr_json[:head][:ref]
|
52
|
+
branch2 = "#{uuid}/#{pr[:head][:ref]}"
|
53
|
+
|
54
|
+
base = `git merge-base #{branch1} #{branch2}`.chomp
|
55
|
+
|
56
|
+
Tempfile.open('tmp') do |f|
|
57
|
+
patch = `git format-patch #{base}..#{branch2} --stdout`.chomp
|
58
|
+
f.sync = true
|
59
|
+
f.puts patch
|
60
|
+
out, s = Open3.capture2e("git apply --check #{f.path}")
|
61
|
+
|
62
|
+
out.each_line do |line|
|
63
|
+
|
64
|
+
if 'patch failed' == line.split(':')[1].strip
|
65
|
+
conflict = {
|
66
|
+
file: line.split(':')[2].strip,
|
67
|
+
line: line.split(':')[3].strip.to_i
|
68
|
+
}
|
69
|
+
result[:conflicts] << conflict
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
result[:mergeable] = result[:conflicts].empty?
|
74
|
+
end
|
75
|
+
|
76
|
+
g.remove_remote(uuid)
|
77
|
+
|
78
|
+
check_results << result
|
79
|
+
end
|
80
|
+
|
81
|
+
check_results
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
# Warn in PR comment about the conflict between PRs
|
86
|
+
# @return [Array<Hash>]
|
87
|
+
#
|
88
|
+
def check_conflict_and_comment()
|
89
|
+
results = check_conflict()
|
90
|
+
|
91
|
+
results.each do |result|
|
92
|
+
message = "<p>This PR conflicts with <a href=\"#{result[:pull_request][:html_url]}\">##{result[:pull_request][:number]}</a>.</p>"
|
93
|
+
table = '<table><thead><tr><th width="100%">File</th><th>Line</th></tr></thead><tbody>' + result[:conflicts].map do |conflict|
|
94
|
+
file = conflict[:file]
|
95
|
+
line = conflict[:line]
|
96
|
+
line_link = "#{result[:pull_request][:head][:repo][:html_url]}/blob/#{result[:pull_request][:head][:ref]}/#{file}#L#{line}"
|
97
|
+
"<tr><td>#{file}</td><td><a href=\"#{line_link}\">#L#{line}</a></td></tr>"
|
98
|
+
end.join('') + '</tbody></table>'
|
99
|
+
puts (message + table)
|
100
|
+
warn("<div>" + message + table + "</div>")
|
101
|
+
end
|
102
|
+
|
103
|
+
results
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'conflict_checker/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'conflict_checker/plugin'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
require 'rspec'
|
10
|
+
require 'danger'
|
11
|
+
|
12
|
+
# Use coloured output, it's the best.
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.filter_gems_from_backtrace "bundler"
|
15
|
+
config.color = true
|
16
|
+
config.tty = true
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'danger_plugin'
|
20
|
+
|
21
|
+
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
22
|
+
# If you are expanding these files, see if it's already been done ^.
|
23
|
+
|
24
|
+
# A silent version of the user interface,
|
25
|
+
# it comes with an extra function `.string` which will
|
26
|
+
# strip all ANSI colours from the string.
|
27
|
+
|
28
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
29
|
+
def testing_ui
|
30
|
+
@output = StringIO.new
|
31
|
+
def @output.winsize
|
32
|
+
[20, 9999]
|
33
|
+
end
|
34
|
+
|
35
|
+
cork = Cork::Board.new(out: @output)
|
36
|
+
def cork.string
|
37
|
+
out.string.gsub(/\e\[([;\d]+)?m/, "")
|
38
|
+
end
|
39
|
+
cork
|
40
|
+
end
|
41
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
42
|
+
|
43
|
+
# Example environment (ENV) that would come from
|
44
|
+
# running a PR on TravisCI
|
45
|
+
def testing_env
|
46
|
+
{
|
47
|
+
'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
|
48
|
+
'TRAVIS_PULL_REQUEST' => '800',
|
49
|
+
'TRAVIS_REPO_SLUG' => 'artsy/eigen',
|
50
|
+
'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
|
51
|
+
'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# A stubbed out Dangerfile for use in tests
|
56
|
+
def testing_dangerfile
|
57
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
58
|
+
Danger::Dangerfile.new(env, testing_ui)
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-conflict_checker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masayoshi Sakamoto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: danger-plugin-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.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.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
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.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.41'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.41'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.8'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.8'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.7'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.7'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: listen
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.0.7
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.0.7
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: Warn about the conflict between PRs.
|
168
|
+
email:
|
169
|
+
- masayoshi.sakamoto@dena.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- Dangerfile
|
176
|
+
- Gemfile
|
177
|
+
- Gemfile.lock
|
178
|
+
- Guardfile
|
179
|
+
- LICENSE.txt
|
180
|
+
- README.md
|
181
|
+
- Rakefile
|
182
|
+
- circle.yml
|
183
|
+
- danger-conflict_checker.gemspec
|
184
|
+
- hoge
|
185
|
+
- lib/conflict_checker/gem_version.rb
|
186
|
+
- lib/conflict_checker/plugin.rb
|
187
|
+
- lib/danger_conflict_checker.rb
|
188
|
+
- lib/danger_plugin.rb
|
189
|
+
- spec/conflict_checker_spec.rb
|
190
|
+
- spec/spec_helper.rb
|
191
|
+
homepage: https://github.com/justice3120/danger-conflict_checker
|
192
|
+
licenses:
|
193
|
+
- MIT
|
194
|
+
metadata: {}
|
195
|
+
post_install_message:
|
196
|
+
rdoc_options: []
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
requirements: []
|
210
|
+
rubyforge_project:
|
211
|
+
rubygems_version: 2.5.1
|
212
|
+
signing_key:
|
213
|
+
specification_version: 4
|
214
|
+
summary: This is plugin for Danger that warn about the conflict between PRs.
|
215
|
+
test_files:
|
216
|
+
- spec/conflict_checker_spec.rb
|
217
|
+
- spec/spec_helper.rb
|