danger-github_ext 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +134 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +23 -0
- data/danger-github_ext.gemspec +49 -0
- data/lib/danger_github_ext.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/github_ext/gem_version.rb +3 -0
- data/lib/github_ext/plugin.rb +96 -0
- data/spec/github_ext_spec.rb +54 -0
- data/spec/spec_helper.rb +59 -0
- metadata +201 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6811daa08f325b5223648e5fd7089827a967b832
|
4
|
+
data.tar.gz: 3307f829adcf177b574db69b81a122884df1911a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4577a6406ace00550f0d6ffa313b792f07120603ad58ec534f218e926dd9bbc0d00da0ff6348699e3a01c26881b8c80d7d3946c43a56d064dd945c48111b1246
|
7
|
+
data.tar.gz: a43349f3e5de3ab5b35c43a09ede6c73d1e1b26e6c166acc0320b5b29dec1ac01bf98b9860e458c266351be774d3a7a4ddf762f07306603e73c58948187b96da
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-github_ext (0.0.2)
|
5
|
+
danger-plugin-api (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.1)
|
11
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
12
|
+
ast (2.3.0)
|
13
|
+
claide (1.0.1)
|
14
|
+
claide-plugins (0.9.2)
|
15
|
+
cork
|
16
|
+
nap
|
17
|
+
open4 (~> 1.3)
|
18
|
+
coderay (1.1.1)
|
19
|
+
colored2 (3.1.2)
|
20
|
+
cork (0.3.0)
|
21
|
+
colored2 (~> 3.1)
|
22
|
+
danger (4.3.5)
|
23
|
+
claide (~> 1.0)
|
24
|
+
claide-plugins (>= 0.9.2)
|
25
|
+
colored2 (~> 3.1)
|
26
|
+
cork (~> 0.1)
|
27
|
+
faraday (~> 0.9)
|
28
|
+
faraday-http-cache (~> 1.0)
|
29
|
+
git (~> 1)
|
30
|
+
kramdown (~> 1.5)
|
31
|
+
octokit (~> 4.2)
|
32
|
+
terminal-table (~> 1)
|
33
|
+
danger-plugin-api (1.0.0)
|
34
|
+
danger (> 2.0)
|
35
|
+
diff-lcs (1.3)
|
36
|
+
faraday (0.12.0.1)
|
37
|
+
multipart-post (>= 1.2, < 3)
|
38
|
+
faraday-http-cache (1.3.1)
|
39
|
+
faraday (~> 0.8)
|
40
|
+
ffi (1.9.18)
|
41
|
+
ffi (1.9.18-x64-mingw32)
|
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.11)
|
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
|
+
parser (2.4.0.0)
|
74
|
+
ast (~> 2.2)
|
75
|
+
powerpack (0.1.1)
|
76
|
+
pry (0.10.4)
|
77
|
+
coderay (~> 1.1.0)
|
78
|
+
method_source (~> 0.8.1)
|
79
|
+
slop (~> 3.4)
|
80
|
+
public_suffix (2.0.5)
|
81
|
+
rainbow (2.2.1)
|
82
|
+
rake (10.5.0)
|
83
|
+
rb-fsevent (0.9.8)
|
84
|
+
rb-inotify (0.9.8)
|
85
|
+
ffi (>= 0.5.0)
|
86
|
+
rspec (3.5.0)
|
87
|
+
rspec-core (~> 3.5.0)
|
88
|
+
rspec-expectations (~> 3.5.0)
|
89
|
+
rspec-mocks (~> 3.5.0)
|
90
|
+
rspec-core (3.5.4)
|
91
|
+
rspec-support (~> 3.5.0)
|
92
|
+
rspec-expectations (3.5.0)
|
93
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
+
rspec-support (~> 3.5.0)
|
95
|
+
rspec-mocks (3.5.0)
|
96
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
+
rspec-support (~> 3.5.0)
|
98
|
+
rspec-support (3.5.0)
|
99
|
+
rubocop (0.48.1)
|
100
|
+
parser (>= 2.3.3.1, < 3.0)
|
101
|
+
powerpack (~> 0.1)
|
102
|
+
rainbow (>= 1.99.1, < 3.0)
|
103
|
+
ruby-progressbar (~> 1.7)
|
104
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
105
|
+
ruby-progressbar (1.8.1)
|
106
|
+
sawyer (0.8.1)
|
107
|
+
addressable (>= 2.3.5, < 2.6)
|
108
|
+
faraday (~> 0.8, < 1.0)
|
109
|
+
shellany (0.0.1)
|
110
|
+
slop (3.6.0)
|
111
|
+
terminal-table (1.7.3)
|
112
|
+
unicode-display_width (~> 1.1.1)
|
113
|
+
thor (0.19.4)
|
114
|
+
unicode-display_width (1.1.3)
|
115
|
+
yard (0.9.8)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
x64-mingw32
|
120
|
+
|
121
|
+
DEPENDENCIES
|
122
|
+
bundler (~> 1.3)
|
123
|
+
danger-github_ext!
|
124
|
+
guard (~> 2.14)
|
125
|
+
guard-rspec (~> 4.7)
|
126
|
+
listen (= 3.0.7)
|
127
|
+
pry
|
128
|
+
rake (~> 10.0)
|
129
|
+
rspec (~> 3.4)
|
130
|
+
rubocop (~> 0.41)
|
131
|
+
yard (~> 0.8)
|
132
|
+
|
133
|
+
BUNDLED WITH
|
134
|
+
1.14.3
|
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 <>
|
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,51 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
### github_ext
|
4
|
+
|
5
|
+
This is Danger Plugin for GitHub extension.
|
6
|
+
When installing this plugin, you can additional methods on github instance
|
7
|
+
|
8
|
+
<blockquote>Determine if pull request is mergeable and mergeable status is clean
|
9
|
+
<pre>
|
10
|
+
github.mergeable?</pre>
|
11
|
+
</blockquote>
|
12
|
+
|
13
|
+
<blockquote>List labels for the pull request
|
14
|
+
<pre>
|
15
|
+
github.labels</pre>
|
16
|
+
</blockquote>
|
17
|
+
|
18
|
+
<blockquote>Add labels to the pull request
|
19
|
+
<pre>
|
20
|
+
github.add_labels 'build ok'</pre>
|
21
|
+
</blockquote>
|
22
|
+
|
23
|
+
<blockquote>Remove labels from the pull request
|
24
|
+
<pre>
|
25
|
+
github.remove_labels 'build failed'</pre>
|
26
|
+
</blockquote>
|
27
|
+
|
28
|
+
<blockquote>List current statuses for the head commit
|
29
|
+
<pre>
|
30
|
+
github.statuses</pre>
|
31
|
+
</blockquote>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
#### Methods
|
38
|
+
|
39
|
+
`mergeable?` - Whether mergeable and mergeable status is clean
|
40
|
+
|
41
|
+
`labels` - Get labels
|
42
|
+
|
43
|
+
`add_labels` - add labels to pull request
|
44
|
+
|
45
|
+
`remove_labels` - remove labels from pull request
|
46
|
+
|
47
|
+
`statuses` - get current commit statuses
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
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
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'github_ext/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-github_ext'
|
8
|
+
spec.version = GithubExt::VERSION
|
9
|
+
spec.authors = ['']
|
10
|
+
spec.email = ['']
|
11
|
+
spec.description = %q{A short description of danger-github_ext.}
|
12
|
+
spec.summary = %q{A longer description of danger-github_ext.}
|
13
|
+
spec.homepage = 'https://github.com//danger-github_ext'
|
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
|
+
|
23
|
+
# General ruby development
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
|
27
|
+
# Testing support
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
|
+
|
30
|
+
# Linting code and docs
|
31
|
+
spec.add_development_dependency "rubocop", "~> 0.41"
|
32
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
33
|
+
|
34
|
+
# Makes testing easy via `bundle exec guard`
|
35
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
36
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
37
|
+
|
38
|
+
# If you want to work on older builds of ruby
|
39
|
+
spec.add_development_dependency 'listen', '3.0.7'
|
40
|
+
|
41
|
+
# This gives you the chance to run a REPL inside your tests
|
42
|
+
# via:
|
43
|
+
#
|
44
|
+
# require 'pry'
|
45
|
+
# binding.pry
|
46
|
+
#
|
47
|
+
# This will stop test execution and let you inspect the results
|
48
|
+
spec.add_development_dependency 'pry'
|
49
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'github_ext/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'github_ext/plugin'
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Danger
|
2
|
+
# This is Danger Plugin for GitHub extension.
|
3
|
+
# When installing this plugin, you can additional methods on github instance
|
4
|
+
#
|
5
|
+
# @example Determine if pull request is mergeable and mergeable status is clean
|
6
|
+
#
|
7
|
+
# github.mergeable?
|
8
|
+
#
|
9
|
+
# @example List labels for the pull request
|
10
|
+
#
|
11
|
+
# github.labels
|
12
|
+
#
|
13
|
+
# @example Add labels to the pull request
|
14
|
+
#
|
15
|
+
# github.add_labels 'build ok'
|
16
|
+
#
|
17
|
+
# @example Remove labels from the pull request
|
18
|
+
#
|
19
|
+
# github.remove_labels 'build failed'
|
20
|
+
#
|
21
|
+
# @example List current statuses for the head commit
|
22
|
+
#
|
23
|
+
# github.statuses
|
24
|
+
#
|
25
|
+
# @see duck8823/danger-github_ext
|
26
|
+
# @tags github
|
27
|
+
#
|
28
|
+
class DangerGithubExt < DangerfileGitHubPlugin
|
29
|
+
|
30
|
+
def initialize(dangerfile)
|
31
|
+
super(dangerfile)
|
32
|
+
|
33
|
+
self.api.auto_paginate = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Whether mergeable and mergeable status is clean
|
37
|
+
# @return [boolean]
|
38
|
+
#
|
39
|
+
def mergeable?
|
40
|
+
self.pr_json.attrs[:mergeable_state] == 'clean' && github.pr_json.attrs[:mergeable]
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get labels
|
44
|
+
# @return [[String]]
|
45
|
+
#
|
46
|
+
def labels
|
47
|
+
@repo ||= self.pr_json.base.repo.full_name
|
48
|
+
@number ||= self.pr_json.number
|
49
|
+
self.api.labels_for_issue(@repo, @number).map { |issue|
|
50
|
+
issue.name
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# add labels to pull request
|
55
|
+
# @param [[String]] labels
|
56
|
+
# @return [void]
|
57
|
+
#
|
58
|
+
def add_labels(labels)
|
59
|
+
@repo ||= self.pr_json.base.repo.full_name
|
60
|
+
@number ||= self.pr_json.number
|
61
|
+
self.api.add_labels_to_an_issue(@repo, @number, Array(labels))
|
62
|
+
end
|
63
|
+
|
64
|
+
# remove labels from pull request
|
65
|
+
# @param [[String]] labels
|
66
|
+
# @return [void]
|
67
|
+
#
|
68
|
+
def remove_labels(labels)
|
69
|
+
@repo ||= self.pr_json.base.repo.full_name
|
70
|
+
@number ||= self.pr_json.number
|
71
|
+
Array(labels).each do |label|
|
72
|
+
self.api.remove_label(@repo, @number, label)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# get current commit statuses
|
77
|
+
# @return [[Hash]]
|
78
|
+
#
|
79
|
+
def statuses
|
80
|
+
@repo ||= self.pr_json.base.repo.full_name
|
81
|
+
@sha ||= self.head_commit
|
82
|
+
statuses = {}
|
83
|
+
self.api.statuses(@repo, @sha).each do |status|
|
84
|
+
statuses[status.context] ||= []
|
85
|
+
statuses[status.context].push({
|
86
|
+
context: status.context,
|
87
|
+
state: status.state,
|
88
|
+
date: status.updated_at
|
89
|
+
})
|
90
|
+
end
|
91
|
+
statuses.map {|_, val|
|
92
|
+
val.sort{|a, b| b[:date] <=> a[:date] }[0]
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
describe Danger::DangerGithubExt do
|
5
|
+
it 'should be a plugin' do
|
6
|
+
expect(Danger::DangerGithubExt.new(testing_dangerfile)).to be_a Danger::Plugin
|
7
|
+
end
|
8
|
+
|
9
|
+
before :all, 'stub setting' do
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.mock_with :rspec do |mocks|
|
12
|
+
mocks.allow_message_expectations_on_nil = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# You should test your custom attributes and methods here
|
19
|
+
#
|
20
|
+
describe 'with Dangerfile' do
|
21
|
+
before do
|
22
|
+
@dangerfile = testing_dangerfile
|
23
|
+
@my_plugin = @dangerfile.github
|
24
|
+
end
|
25
|
+
|
26
|
+
# Some examples for writing tests
|
27
|
+
# You should replace these with your own.
|
28
|
+
|
29
|
+
it 'should be true when mergeable' do
|
30
|
+
allow(@my_plugin.pr_json).to receive(:attrs).and_return({
|
31
|
+
:mergeable => true,
|
32
|
+
:mergeable_state => 'clean'
|
33
|
+
})
|
34
|
+
expect(@my_plugin.mergeable?).to be true
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should be false when dont mergeable' do
|
38
|
+
allow(@my_plugin.pr_json).to receive(:attrs).and_return({
|
39
|
+
:mergeable => false,
|
40
|
+
:mergeable_state => 'clean'
|
41
|
+
})
|
42
|
+
expect(@my_plugin.mergeable?).to be false
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should be false when mergeable state is dirty' do
|
46
|
+
allow(@my_plugin.pr_json).to receive(:attrs).and_return({
|
47
|
+
:mergeable => true,
|
48
|
+
:mergeable_state => 'dirty'
|
49
|
+
})
|
50
|
+
expect(@my_plugin.mergeable?).to be false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
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,201 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-github_ext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ''
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-16 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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.41'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.41'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.14'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: listen
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.0.7
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.0.7
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: A short description of danger-github_ext.
|
154
|
+
email:
|
155
|
+
- ''
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- ".travis.yml"
|
162
|
+
- Gemfile
|
163
|
+
- Gemfile.lock
|
164
|
+
- Guardfile
|
165
|
+
- LICENSE.txt
|
166
|
+
- README.md
|
167
|
+
- Rakefile
|
168
|
+
- danger-github_ext.gemspec
|
169
|
+
- lib/danger_github_ext.rb
|
170
|
+
- lib/danger_plugin.rb
|
171
|
+
- lib/github_ext/gem_version.rb
|
172
|
+
- lib/github_ext/plugin.rb
|
173
|
+
- spec/github_ext_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
homepage: https://github.com//danger-github_ext
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.6.10
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: A longer description of danger-github_ext.
|
199
|
+
test_files:
|
200
|
+
- spec/github_ext_spec.rb
|
201
|
+
- spec/spec_helper.rb
|