danger 5.6.0 → 5.6.1

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: 9973389d96fb5038948aadcc696a845877b934df
4
- data.tar.gz: 23a75796bf999b53a9fb9cd75ab76cb0a22168b9
3
+ metadata.gz: ec36701168c14090f3c64ea1b7fb6b3dd5439623
4
+ data.tar.gz: df080085b72b8261e85cf50d0c7ab8f3e0a16311
5
5
  SHA512:
6
- metadata.gz: 6c5986ae5c49a22d58f641e70c28db3705a38aa8c63ce8cf0cbccca87098bce89c2546144ef5431cf356f5ff5054a9cea5c91893c52767b816607e4885f95689
7
- data.tar.gz: fe1764de97f55c1cd740bbdac32517795835de5bc19265b2eb18e58c37d215cd133bee754e2aee55afa8e0f0c3dfe6a26e6212d134f40423e4d21f72aff7dc1d
6
+ metadata.gz: fdc16ebb0194bc7ce2765b0e642ac5009e750859fb770dd1cd5009de42d00c9ce9a87446f3f428961b4cfcec0eb5e08fee08132aee08d4e532ce7b5f0df07e2a
7
+ data.tar.gz: 81804bf81d9a6168a8c41fb6683c5f3f8c39e94ec83e616f187ffd8c84a2f34bed9e0d5a167364cc71eec2354517f98783a9c2f046a981539476eacfc9eaa603
data/README.md CHANGED
@@ -13,7 +13,7 @@ Formalize your Pull Request etiquette.
13
13
  <a href="#what-is-danger">What is Danger?</a> &bull;
14
14
  <a href="VISION.md">Vision</a> &bull;
15
15
  <a href="#im-here-to-help-out">Helping Out</a> &bull;
16
- <a href="http://danger.systems/guides/creating_your_first_plugin.html">Plugin Development</a>
16
+ <a href="https://danger.systems/guides/creating_your_first_plugin.html">Plugin Development</a>
17
17
  </p>
18
18
 
19
19
  -------
@@ -43,9 +43,9 @@ Danger provides the glue to let _you_ build out the rules specific to your team'
43
43
 
44
44
  Alright. So, actually, you may be in the wrong place. From here on in, this README is going to be for people who are interested in working on and improving on Danger.
45
45
 
46
- We keep all of the end-user documentation at [http://danger.systems](http://danger.systems).
46
+ We keep all of the end-user documentation at [https://danger.systems](https://danger.systems).
47
47
 
48
- Some quick links: [Guides Index](http://danger.systems/guides.html), [DSL Reference](http://danger.systems/reference.html), [Getting Started](http://danger.systems/guides/getting_started.html) and [What does Danger Do?](http://danger.systems/guides/what_does_danger_do.html).
48
+ Some quick links: [Guides Index](https://danger.systems/guides.html), [DSL Reference](https://danger.systems/reference.html), [Getting Started](https://danger.systems/guides/getting_started.html) and [What does Danger Do?](https://danger.systems/guides/what_does_danger_do.html).
49
49
 
50
50
  ## I'm here to help out!
51
51
 
@@ -76,7 +76,7 @@ I'd strongly recommend using `bundle exec guard` to run your tests as you work.
76
76
 
77
77
  #### Debugging
78
78
 
79
- Ruby is super dynamic. One of the best ways to debug Ruby code is by using [pry](http://pryrepl.org/). We include pry for developers: when you have a problem, copy these two lines just before your problem and follow the instructions from "[I Want To Be A Danger Wizard](http://danger.systems/guides/troubleshooting.html#i-want-to-be-a-danger-wizard)."
79
+ Ruby is super dynamic. One of the best ways to debug Ruby code is by using [pry](http://pryrepl.org/). We include pry for developers: when you have a problem, copy these two lines just before your problem and follow the instructions from "[I Want To Be A Danger Wizard](https://danger.systems/guides/troubleshooting.html#i-want-to-be-a-danger-wizard)."
80
80
 
81
81
  ```ruby
82
82
  require 'pry'
@@ -17,13 +17,15 @@ module Danger
17
17
  #
18
18
  # Add the `DANGER_GITLAB_API_TOKEN` to your pipeline env variables.
19
19
  class GitLabCI < CI
20
+ attr_reader :project_url
21
+
20
22
  def self.validates_as_ci?(env)
21
23
  env.key? "GITLAB_CI"
22
24
  end
23
25
 
24
26
  def self.validates_as_pr?(env)
25
27
  exists = [
26
- "GITLAB_CI", "CI_PROJECT_ID"
28
+ "GITLAB_CI", "CI_PROJECT_PATH"
27
29
  ].all? { |x| env[x] }
28
30
 
29
31
  exists && determine_merge_request_id(env).to_i > 0
@@ -33,11 +35,11 @@ module Danger
33
35
  return env["CI_MERGE_REQUEST_ID"] if env["CI_MERGE_REQUEST_ID"]
34
36
  return 0 unless env["CI_COMMIT_SHA"]
35
37
 
36
- project_id = env["CI_PROJECT_ID"]
38
+ project_path = env["CI_PROJECT_PATH"]
37
39
  base_commit = env["CI_COMMIT_SHA"]
38
40
  client = RequestSources::GitLab.new(nil, env).client
39
41
 
40
- merge_requests = client.merge_requests(project_id, state: :opened)
42
+ merge_requests = client.merge_requests(project_path, state: :opened)
41
43
  merge_request = merge_requests.auto_paginate.find do |mr|
42
44
  mr.sha == base_commit
43
45
  end
@@ -46,12 +48,17 @@ module Danger
46
48
  end
47
49
 
48
50
  def initialize(env)
49
- self.repo_slug = env["CI_PROJECT_ID"]
50
- self.pull_request_id = self.class.determine_merge_request_id(env)
51
+ @env = env
52
+ @repo_slug = env["CI_PROJECT_PATH"]
53
+ @project_url = env["CI_PROJECT_URL"]
51
54
  end
52
55
 
53
56
  def supported_request_sources
54
57
  @supported_request_sources ||= [Danger::RequestSources::GitLab]
55
58
  end
59
+
60
+ def pull_request_id
61
+ @pull_request_id ||= self.class.determine_merge_request_id(@env)
62
+ end
56
63
  end
57
64
  end
@@ -255,7 +255,7 @@ module Danger
255
255
  ui.say "You need to expose a token called " + "DANGER_GITHUB_API_TOKEN".yellow + " and the value is the GitHub Personal Access Token."
256
256
  ui.say "Depending on the CI system, this may need to be done on the machine (in the " + "~/.bashprofile".yellow + ") or in a web UI somewhere."
257
257
  ui.say "We have a guide for all supported CI systems on danger.systems:"
258
- ui.link "http://danger.systems/guides/getting_started.html#setting-up-danger-to-run-on-your-ci"
258
+ ui.link "https://danger.systems/guides/getting_started.html#setting-up-danger-to-run-on-your-ci"
259
259
  end
260
260
 
261
261
  def note_about_clicking_links
@@ -21,7 +21,7 @@ module Danger
21
21
 
22
22
  self.description = <<-DESC
23
23
  Converts a collection of file paths of Danger plugins into a JSON format.
24
- Note: Before 1.0, it will also parse the represented JSON to validate whether http://danger.systems would
24
+ Note: Before 1.0, it will also parse the represented JSON to validate whether https://danger.systems would
25
25
  show the plugin on the website.
26
26
  DESC
27
27
 
@@ -51,5 +51,5 @@
51
51
  <%# the previous line has to be aligned far to the left, otherwise markdown can break easily %>
52
52
  <%- end -%>
53
53
  <p align="right" data-meta="generated_by_<%= @danger_id %>">
54
- Generated by :no_entry_sign: <a href="http://danger.systems/">Danger</a>
54
+ Generated by :no_entry_sign: <a href="https://danger.systems/">Danger</a>
55
55
  </p>
@@ -111,7 +111,7 @@ module Danger
111
111
  ui.puts subtitle
112
112
  ui.puts "\nFound these keys in your ENV: #{env.keys.join(', '.freeze)}."
113
113
  ui.puts "\nFailing the build, Danger cannot run without API access.".freeze
114
- ui.puts "You can see more information at http://danger.systems/guides/getting_started.html".freeze
114
+ ui.puts "You can see more information at https://danger.systems/guides/getting_started.html".freeze
115
115
  end
116
116
 
117
117
  def travis_note
@@ -192,15 +192,11 @@ module Danger
192
192
  def html_link(paths, full_path: true)
193
193
  paths = [paths] unless paths.kind_of?(Array)
194
194
  commit = head_commit
195
- same_repo = mr_json["project_id"] == mr_json["source_project_id"]
196
- sender_repo = mr_author + "/" + env.ci_source.repo_slug.split("/")[1]
197
- repo = same_repo ? env.ci_source.repo_slug : sender_repo
198
- host = @gitlab.host
199
195
 
200
196
  paths = paths.map do |path|
201
197
  url_path = path.start_with?("/") ? path : "/#{path}"
202
198
  text = full_path ? path : File.basename(path)
203
- create_link("https://#{host}/#{repo}/blob/#{commit}#{url_path}", text)
199
+ create_link("#{env.ci_source.project_url}/blob/#{commit}#{url_path}", text)
204
200
  end
205
201
 
206
202
  return paths.first if paths.count < 2
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "5.6.0".freeze
2
+ VERSION = "5.6.1".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-17 00:00:00.000000000 Z
12
+ date: 2018-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  version: '0'
293
293
  requirements: []
294
294
  rubyforge_project:
295
- rubygems_version: 2.6.14
295
+ rubygems_version: 2.5.1
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: Like Unit Tests, but for your Team Culture.