danger-mention 0.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8297f54a5ea709aa67d5c032f4bd4b7c203abe7d
4
- data.tar.gz: fa6c8849b61ee0e0a5bbdff94ef06070b3301097
3
+ metadata.gz: c15c140c232de314f7e29f13171bd5ab11192655
4
+ data.tar.gz: 422979de0bd74c63f311fce4cfaf3896ccfc9ea4
5
5
  SHA512:
6
- metadata.gz: c2a807ac485bce802c103cdf982b988ee847941853a8027ce0174bc5680a3047a849120c71965a848a2ccb9b326d4c9c4ba361a9397a1deb5305301009ea2cfc
7
- data.tar.gz: e253ef9e4789852d7b642f1c1d3aed67f267519b59119a509d5dfa3bff14e8dc6debfe89466322c40aac848a2fbd4e28071952906940b41999ac9000349f4bd9
6
+ metadata.gz: 3c626c992aa0d0acf6ddac75978130a123d4d8d50d28e6e8830fe56ae000058d0fcfc4b8b4a08161dc8fff183c4195b14eda833599c1a01965d6d8df5fe0bd16
7
+ data.tar.gz: 05047aaa830369a1a981bcd08665d187999fa6996438fa1c8be81a7cfea7b90adc2f0200c0914463784f197c8b605d9e3918c294a838b7d8871d2a9de49aad90
data/Gemfile.lock CHANGED
@@ -1,50 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-mention (0.1)
4
+ danger-mention (0.4.0)
5
5
  danger
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  addressable (2.4.0)
11
+ ast (2.3.0)
11
12
  claide (1.0.0)
12
- claide-plugins (0.9.0)
13
- cork (~> 0)
14
- nap (~> 1.0)
13
+ claide-plugins (0.9.1)
14
+ cork
15
+ nap
15
16
  open4 (~> 1.3)
17
+ coderay (1.1.1)
16
18
  colored (1.2)
17
- cork (0.1.0)
19
+ cork (0.2.0)
18
20
  colored (~> 1.2)
19
- danger (0.10.0)
21
+ danger (3.0.3)
20
22
  claide (~> 1.0)
21
- claide-plugins (~> 0.9)
23
+ claide-plugins (> 0.9.0)
22
24
  colored (~> 1.2)
23
25
  cork (~> 0.1)
24
- faraday (~> 0)
26
+ faraday (~> 0.9)
25
27
  faraday-http-cache (~> 1.0)
26
28
  git (~> 1)
29
+ gitlab (~> 3.7.0)
30
+ kramdown (~> 1.5)
27
31
  octokit (~> 4.2)
28
- redcarpet (~> 3.3)
29
32
  terminal-table (~> 1)
33
+ yard (~> 0.9.5)
30
34
  diff-lcs (1.2.5)
31
35
  faraday (0.9.2)
32
36
  multipart-post (>= 1.2, < 3)
33
- faraday-http-cache (1.3.0)
37
+ faraday-http-cache (1.3.1)
34
38
  faraday (~> 0.8)
39
+ ffi (1.9.14)
40
+ formatador (0.2.5)
35
41
  git (1.3.0)
42
+ gitlab (3.7.0)
43
+ httparty (~> 0.13.0)
44
+ terminal-table
45
+ guard (2.14.0)
46
+ formatador (>= 0.2.4)
47
+ listen (>= 2.7, < 4.0)
48
+ lumberjack (~> 1.0)
49
+ nenv (~> 0.1)
50
+ notiffany (~> 0.0)
51
+ pry (>= 0.9.12)
52
+ shellany (~> 0.0)
53
+ thor (>= 0.18.1)
54
+ guard-compat (1.2.1)
55
+ guard-rspec (4.7.3)
56
+ guard (~> 2.1)
57
+ guard-compat (~> 1.1)
58
+ rspec (>= 2.99.0, < 4.0)
59
+ httparty (0.13.7)
60
+ json (~> 1.8)
61
+ multi_xml (>= 0.5.2)
62
+ json (1.8.3)
63
+ kramdown (1.12.0)
64
+ listen (3.0.7)
65
+ rb-fsevent (>= 0.9.3)
66
+ rb-inotify (>= 0.9.7)
67
+ lumberjack (1.0.10)
68
+ method_source (0.8.2)
69
+ multi_xml (0.5.5)
36
70
  multipart-post (2.0.0)
37
71
  nap (1.1.0)
72
+ nenv (0.3.0)
73
+ notiffany (0.1.1)
74
+ nenv (~> 0.1)
75
+ shellany (~> 0.0)
38
76
  octokit (4.3.0)
39
77
  sawyer (~> 0.7.0, >= 0.5.3)
40
78
  open4 (1.3.4)
79
+ parser (2.3.1.2)
80
+ ast (~> 2.2)
81
+ powerpack (0.1.1)
82
+ pry (0.10.4)
83
+ coderay (~> 1.1.0)
84
+ method_source (~> 0.8.1)
85
+ slop (~> 3.4)
86
+ rainbow (2.1.0)
41
87
  rake (10.5.0)
42
- redcarpet (3.3.4)
88
+ rb-fsevent (0.9.7)
89
+ rb-inotify (0.9.7)
90
+ ffi (>= 0.5.0)
43
91
  rspec (3.5.0)
44
92
  rspec-core (~> 3.5.0)
45
93
  rspec-expectations (~> 3.5.0)
46
94
  rspec-mocks (~> 3.5.0)
47
- rspec-core (3.5.1)
95
+ rspec-core (3.5.2)
48
96
  rspec-support (~> 3.5.0)
49
97
  rspec-expectations (3.5.0)
50
98
  diff-lcs (>= 1.2.0, < 2.0)
@@ -53,10 +101,22 @@ GEM
53
101
  diff-lcs (>= 1.2.0, < 2.0)
54
102
  rspec-support (~> 3.5.0)
55
103
  rspec-support (3.5.0)
104
+ rubocop (0.42.0)
105
+ parser (>= 2.3.1.1, < 3.0)
106
+ powerpack (~> 0.1)
107
+ rainbow (>= 1.99.1, < 3.0)
108
+ ruby-progressbar (~> 1.7)
109
+ unicode-display_width (~> 1.0, >= 1.0.1)
110
+ ruby-progressbar (1.8.1)
56
111
  sawyer (0.7.0)
57
112
  addressable (>= 2.3.5, < 2.5)
58
113
  faraday (~> 0.8, < 0.10)
114
+ shellany (0.0.1)
115
+ slop (3.6.0)
59
116
  terminal-table (1.6.0)
117
+ thor (0.19.1)
118
+ unicode-display_width (1.1.0)
119
+ yard (0.9.5)
60
120
 
61
121
  PLATFORMS
62
122
  ruby
@@ -64,8 +124,12 @@ PLATFORMS
64
124
  DEPENDENCIES
65
125
  bundler (~> 1.3)
66
126
  danger-mention!
127
+ guard (~> 2.14)
128
+ guard-rspec (~> 4.7)
67
129
  rake (~> 10.0)
68
130
  rspec (~> 3.4)
131
+ rubocop (~> 0.41)
132
+ yard (~> 0.8)
69
133
 
70
134
  BUNDLED WITH
71
135
  1.11.2
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/README.md CHANGED
@@ -4,11 +4,7 @@ A [Danger](https://github.com/danger/danger) plugin to automatically mention pot
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your Gemfile:
8
-
9
- ```rb
10
- gem 'danger-mention'
11
- ```
7
+ $ gem install danger-mention
12
8
 
13
9
  ## Usage
14
10
 
@@ -21,7 +17,7 @@ mention.run
21
17
  Additionally you can set up maximum number of people to ping in the PR message, regexes of ignored files and list of users that will never be mentioned.
22
18
 
23
19
  ```rb
24
- mention.run(2, [".*.h"], ["wojteklu"])
20
+ mention.run(2, ["Pods/"], ["wojteklu"])
25
21
  ```
26
22
 
27
23
  ## License
data/Rakefile CHANGED
@@ -1,5 +1,23 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
- RSpec::Core::RakeTask.new(:spec)
5
- task default: :spec
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
@@ -25,4 +25,12 @@ Gem::Specification.new do |spec|
25
25
  # Testing support
26
26
  spec.add_development_dependency 'rspec', '~> 3.4'
27
27
 
28
+ # Linting code and docs
29
+ spec.add_development_dependency 'rubocop', '~> 0.41'
30
+ spec.add_development_dependency 'yard', '~> 0.8'
31
+
32
+ # Makes testing easy via `bundle exec guard`
33
+ spec.add_development_dependency 'guard', '~> 2.14'
34
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
35
+
28
36
  end
data/lib/danger_plugin.rb CHANGED
@@ -7,21 +7,33 @@ module Danger
7
7
  # It downloads and parses the blame information of changed files
8
8
  # to figure out who may be a good reviewer.
9
9
  #
10
- # @example Specifying max reviewers.
10
+ # @example Running plugin with reviewers count specified
11
11
  #
12
- # # Find maximum two reviewers without specifying
13
- # # ignored files and users
12
+ # # Find maximum two reviewers
14
13
  # mention.run(2, [], [])
15
14
  #
15
+ # @example Running plugin with some files blacklisted
16
+ #
17
+ # # Find reviewers without parsing blame information
18
+ # # from files matching to 'Pods/*'
19
+ # mention.run(2, ["Pods/*"], [])
20
+ #
21
+ # @example Running plugin with some users blacklisted
22
+ #
23
+ # # Find reviewers ignoring users 'wojteklu' and 'danger'
24
+ # mention.run(2, [], ["wojteklu", "danger"])
25
+ #
26
+ # @tags github, review, mention, blame
27
+
16
28
  class DangerMention < Plugin
17
29
 
18
30
  # Mention potential reviewers.
19
31
  #
20
- # @param Integer max_reviewers
32
+ # @param [Integer] max_reviewers
21
33
  # Maximum number of people to ping in the PR message, default is 3.
22
- # @param [String] file_blacklist
34
+ # @param [Array<String>] file_blacklist
23
35
  # Regexes of ignored files.
24
- # @param [String] user_blacklist
36
+ # @param [Array<String>] user_blacklist
25
37
  # List of users that will never be mentioned.
26
38
  # @return [void]
27
39
  #
@@ -48,6 +60,8 @@ module Danger
48
60
  end
49
61
  end
50
62
 
63
+ private
64
+
51
65
  def select_files(file_blacklist)
52
66
  files = Finder.parse(env.scm.diff)
53
67
 
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module DangerMention
2
- VERSION = '0.2'
2
+ VERSION = '0.4.0'.freeze
3
3
  DESCRIPTION = 'Danger plugin to automatically mention potential reviewers on pull requests'
4
4
  end
@@ -1,9 +1,11 @@
1
1
  require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  module Danger
4
+
4
5
  describe DangerMention do
5
6
  before do
6
7
  @mention = testing_dangerfile.mention
8
+ DangerMention.send(:public, *DangerMention.private_instance_methods)
7
9
  end
8
10
 
9
11
  it 'is a plugin' do
data/spec/spec_helper.rb CHANGED
@@ -1,30 +1,58 @@
1
1
  require 'pathname'
2
-
3
2
  ROOT = Pathname.new(File.expand_path('../../', __FILE__))
4
3
  $LOAD_PATH.unshift((ROOT + 'lib').to_s)
5
4
  $LOAD_PATH.unshift((ROOT + 'spec').to_s)
6
5
 
6
+ require 'bundler/setup'
7
+ require 'pry'
8
+
9
+ require 'rspec'
10
+ require 'danger'
11
+
12
+ # Use coloured output, it's the best.
7
13
  RSpec.configure do |config|
8
- # Use color in STDOUT
14
+ config.filter_gems_from_backtrace 'bundler'
9
15
  config.color = true
16
+ config.tty = true
10
17
  end
11
18
 
12
- require 'danger'
13
- require 'cork'
14
19
  require 'danger_plugin'
15
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
16
29
  def testing_ui
17
- Cork::Board.new(silent: true)
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
18
40
  end
41
+ # rubocop:enable Lint/NestedMethodDefinition
19
42
 
43
+ # Example environment (ENV) that would come from
44
+ # running a PR on TravisCI
20
45
  def testing_env
21
46
  {
22
47
  'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
23
- 'TRAVIS_PULL_REQUEST' => '1',
24
- 'TRAVIS_REPO_SLUG' => 'test'
48
+ 'TRAVIS_PULL_REQUEST' => '800',
49
+ 'TRAVIS_REPO_SLUG' => 'artsy/eigen',
50
+ 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
51
+ 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
25
52
  }
26
53
  end
27
54
 
55
+ # A stubbed out Dangerfile for use in tests
28
56
  def testing_dangerfile
29
57
  env = Danger::EnvironmentManager.new(testing_env)
30
58
  Danger::Dangerfile.new(env, testing_ui)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-mention
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojtek Lukaszuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-31 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -66,6 +66,62 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
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'
69
125
  description: Danger plugin to automatically mention potential reviewers on pull requests.
70
126
  email:
71
127
  - wojciech.lukaszuk@icloud.com
@@ -76,6 +132,7 @@ files:
76
132
  - ".gitignore"
77
133
  - Gemfile
78
134
  - Gemfile.lock
135
+ - Guardfile
79
136
  - LICENSE
80
137
  - README.md
81
138
  - Rakefile
@@ -105,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
162
  version: '0'
106
163
  requirements: []
107
164
  rubyforge_project:
108
- rubygems_version: 2.4.6
165
+ rubygems_version: 2.6.6
109
166
  signing_key:
110
167
  specification_version: 4
111
168
  summary: Danger plugin to automatically mention potential reviewers on pull requests.