danger 8.2.0 → 8.2.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
  SHA256:
3
- metadata.gz: a23a15079e019e675afdc325babf115a1a6f38ddbd06a5ba11dd93243ea1dfa0
4
- data.tar.gz: 380335b8eb423be1096f3b25b3f2602d24d7288b70deb69e8b9991e6dcf09d16
3
+ metadata.gz: 3930680bc519ec86948df5375ea6ffad444929619c7faf3190e204eee827767b
4
+ data.tar.gz: 6ca8c826a895e9d0ef6bf66343e70110026a8a77fafddc6e72f26b129c37801d
5
5
  SHA512:
6
- metadata.gz: 2d68ba968f860e6b4631536548d23279677645d20e7cb5d9567c73222a87128c027664e72f176bca01a31adbbbc2b8f123f5f20997e005a428cc2321e979d023
7
- data.tar.gz: 10ab5f0cb6c3810e0f4520724854a3a8e3e4aeef35c252ed7a3ac729a2407c73df382a6cb98b1682170efd215bc495a11a312fa1d47f5d1b546632bd415b8d0f
6
+ metadata.gz: '0267983777b8a27f5d90f6221655d18657a0c4ed6276e475631e4984eabbe2f5329ec8df774100052dfd1e6368082b9865fd1bd87956b538fa032042f1e1538d'
7
+ data.tar.gz: 700097f2571dd5cb9cac5b9f74d034a53a00e73f747d3aa489cb9cae83b86b85908281a3c910bec25a2299fd828449c9eb82f796d8865f84a0742a46488d2dd3
data/README.md CHANGED
@@ -51,7 +51,7 @@ Some quick links: [Guides Index](https://danger.systems/guides.html), [DSL Refer
51
51
 
52
52
  Brilliant. So, let's get you set up.
53
53
 
54
- ``` sh
54
+ ```sh
55
55
  git clone https://github.com/danger/danger.git
56
56
  cd danger
57
57
  bundle install
@@ -7,7 +7,7 @@ module Danger
7
7
  #
8
8
  # Add a script step to your appcenter-post-build.sh:
9
9
  #
10
- # ``` shell
10
+ # ```shell
11
11
  # #!/usr/bin/env bash
12
12
  # bundle install
13
13
  # bundle exec danger
@@ -3,6 +3,7 @@ module Danger
3
3
  # ### CI Setup
4
4
  #
5
5
  # Install dependencies and add a danger step to your `appveyor.yml`.
6
+ #
6
7
  # ```yaml
7
8
  # install:
8
9
  # - cmd: >-
@@ -19,6 +20,7 @@ module Danger
19
20
  # For public repositories, add your plain token to environment variables in `appveyor.yml`.
20
21
  # Encrypted environment variables will not be decrypted on PR builds.
21
22
  # see here: https://www.appveyor.com/docs/build-configuration/#secure-variables
23
+ #
22
24
  # ```yaml
23
25
  # environment:
24
26
  # DANGER_GITHUB_API_TOKEN: <YOUR_TOKEN_HERE>
@@ -26,6 +28,7 @@ module Danger
26
28
  #
27
29
  # For private repositories, enter your token in `Settings>Environment>Environment variables>Add variable` and turn on `variable encryption`.
28
30
  # You will see encrypted variable text in `Settings>Export YAML` so just copy to your `appveyor.yml`.
31
+ #
29
32
  # ```yaml
30
33
  # environment:
31
34
  # DANGER_GITHUB_API_TOKEN:
@@ -7,7 +7,7 @@ module Danger
7
7
  #
8
8
  # Add a script step:
9
9
  #
10
- # ``` shell
10
+ # ```shell
11
11
  # #!/usr/bin/env bash
12
12
  # bundle install
13
13
  # bundle exec danger
@@ -2,6 +2,7 @@ module Danger
2
2
  # ### CI Setup
3
3
  #
4
4
  # Install dependencies and add a danger step to your `bitbucket-pipelines.yml`.
5
+ #
5
6
  # ```yaml
6
7
  # script:
7
8
  # - bundle exec danger --verbose
@@ -9,7 +9,7 @@ module Danger
9
9
  # With BuildKite you run the server yourself, so you will want to run it as a part of your build process.
10
10
  # It is common to have build steps, so we would recommend adding this to your scrip:
11
11
  #
12
- # ``` shell
12
+ # ```shell
13
13
  # echo "--- Running Danger"
14
14
  # bundle exec danger
15
15
  # ```
@@ -19,7 +19,7 @@ module Danger
19
19
  #
20
20
  # e.g.
21
21
  #
22
- # ``` yaml
22
+ # ```yaml
23
23
  # - run: bundle exec danger --verbose
24
24
  # ```
25
25
  #
@@ -10,7 +10,7 @@ module Danger
10
10
  #
11
11
  # With Concourse, you run the docker images yourself, so you will want to add `yarn danger ci` within one of your build jobs.
12
12
  #
13
- # ``` shell
13
+ # ```shell
14
14
  # build:
15
15
  # image: golang
16
16
  # commands:
@@ -8,7 +8,7 @@ module Danger
8
8
  # With Drone you run the docker images yourself, so you will want to add `bundle exec danger` at the end of
9
9
  # your `.drone.yml`.
10
10
  #
11
- # ``` shell
11
+ # ```shell
12
12
  # build:
13
13
  # image: golang
14
14
  # commands:
@@ -24,7 +24,7 @@ module Danger
24
24
  # Drone secrets: http://readme.drone.io/usage/secret-guide/
25
25
  # NOTE: This is a new syntax in DroneCI 0.6+
26
26
  #
27
- # ```
27
+ # ```yml
28
28
  # build:
29
29
  # image: golang
30
30
  # secrets:
@@ -6,7 +6,7 @@ module Danger
6
6
  # You can use `danger/danger` Action in your `.github/workflows/xxx.yml`.
7
7
  # And so, you can use GITHUB_TOKEN secret as `DANGER_GITHUB_API_TOKEN` environment variable.
8
8
  #
9
- # ```
9
+ # ```yml
10
10
  # ...
11
11
  # steps:
12
12
  # - uses: actions/checkout@v1
@@ -7,6 +7,7 @@ module Danger
7
7
  # ### CI Setup
8
8
  #
9
9
  # Install dependencies and add a danger step to your .gitlab-ci.yml:
10
+ #
10
11
  # ```yml
11
12
  # before_script:
12
13
  # - bundle install
@@ -14,6 +15,7 @@ module Danger
14
15
  # script:
15
16
  # - bundle exec danger
16
17
  # ```
18
+ #
17
19
  # ### Token Setup
18
20
  #
19
21
  # Add the `DANGER_GITLAB_API_TOKEN` to your pipeline env variables if you
@@ -6,7 +6,8 @@ module Danger
6
6
  # ### CI Setup
7
7
  #
8
8
  # Install dependencies and add a danger step to your screwdriver.yaml:
9
- # ``` yml
9
+ #
10
+ # ```yml
10
11
  # jobs:
11
12
  # danger:
12
13
  # requires: [~pr, ~commit]
@@ -27,6 +27,7 @@ module Danger
27
27
  # branch="%teamcity.build.branch%"
28
28
  # export GITHUB_PULL_REQUEST_ID=(${branch//\// })
29
29
  # ```
30
+ #
30
31
  # Or if you are using the pull request feature you can set an environment parameter called `GITHUB_PULL_REQUEST_ID`
31
32
  # to the value of: `%teamcity.pullRequest.number`
32
33
  #
@@ -59,6 +60,7 @@ module Danger
59
60
  #
60
61
  # You will also need to set the `BITBUCKET_BRANCH_NAME` environment variable.
61
62
  # TeamCity provides `%teamcity.build.branch%`, which you can use at the top of your Simple Command Runner:
63
+ #
62
64
  # ```sh
63
65
  # export BITBUCKET_BRANCH_NAME="%teamcity.build.branch%"
64
66
  # ```
@@ -22,7 +22,7 @@ module Danger
22
22
  super
23
23
 
24
24
  if argv.flag?("pry", false)
25
- @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path)
25
+ @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path, DryRun.command)
26
26
  end
27
27
  end
28
28
 
@@ -277,7 +277,7 @@ module Danger
277
277
  ui.say "- You can look at the following Dangerfiles to get some more ideas:"
278
278
  ui.pause 0.6
279
279
  ui.link "https://github.com/danger/danger/blob/master/Dangerfile"
280
- ui.link "https://github.com/artsy/eigen/blob/master/Dangerfile"
280
+ ui.link "https://github.com/artsy/eigen/blob/master/dangerfile.ts"
281
281
  ui.pause 1
282
282
  end
283
283
 
@@ -32,7 +32,7 @@ module Danger
32
32
  super
33
33
 
34
34
  if argv.flag?("pry", false)
35
- @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path)
35
+ @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path, Local.command)
36
36
  end
37
37
  end
38
38
 
@@ -4,9 +4,9 @@ module Danger
4
4
  @cork = cork
5
5
  end
6
6
 
7
- def setup_pry(dangerfile_path)
7
+ def setup_pry(dangerfile_path, command)
8
8
  return dangerfile_path if dangerfile_path.empty?
9
- validate_pry_available
9
+ validate_pry_available(command)
10
10
  FileUtils.cp dangerfile_path, DANGERFILE_COPY
11
11
  File.open(DANGERFILE_COPY, "a") do |f|
12
12
  f.write("\nbinding.pry; File.delete(\"#{DANGERFILE_COPY}\")")
@@ -20,10 +20,10 @@ module Danger
20
20
 
21
21
  DANGERFILE_COPY = "_Dangerfile.tmp".freeze
22
22
 
23
- def validate_pry_available
23
+ def validate_pry_available(command)
24
24
  Kernel.require "pry"
25
25
  rescue LoadError
26
- cork.warn "Pry was not found, and is required for 'danger pr --pry'."
26
+ cork.warn "Pry was not found, and is required for 'danger #{command} --pry'."
27
27
  cork.print_warnings
28
28
  abort
29
29
  end
@@ -37,7 +37,7 @@ module Danger
37
37
  @dangerfile_path = dangerfile if File.exist?(dangerfile)
38
38
 
39
39
  if argv.flag?("pry", false)
40
- @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path)
40
+ @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path, PR.command)
41
41
  end
42
42
  end
43
43
 
@@ -23,7 +23,7 @@ module Danger
23
23
  super
24
24
 
25
25
  if argv.flag?("pry", false)
26
- @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path)
26
+ @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path, Staging.command)
27
27
  end
28
28
  end
29
29
 
@@ -97,7 +97,7 @@ module Danger
97
97
  # @return [String]
98
98
  #
99
99
  def pr_author
100
- @bs.pr_json[:author][:username]
100
+ @bs.pr_json[:author][:nickname]
101
101
  end
102
102
 
103
103
  # @!group PR Commit Metadata
@@ -33,6 +33,11 @@ module Danger
33
33
  #
34
34
  # danger.import_dangerfile(github: "ruby-grape/danger", branch: "custom", path: "path/to/Dangerfile")
35
35
  #
36
+ # @example Import a plugin available over HTTP
37
+ #
38
+ # custom_url = "https://custom.bitbucket.com/project-name/Dangerfile?raw"
39
+ # danger.import_dangerfile(url: custom_url)
40
+ #
36
41
  # @see danger/danger
37
42
  # @tags core, plugins
38
43
 
@@ -84,8 +89,10 @@ module Danger
84
89
  import_dangerfile_from_path(opts[:path])
85
90
  elsif opts.key?(:gem)
86
91
  import_dangerfile_from_gem(opts[:gem])
92
+ elsif opts.key?(:url)
93
+ import_dangerfile_from_url(opts[:url])
87
94
  else
88
- raise "`import` requires a Hash with either :github, :gitlab, :gem, or :path"
95
+ raise "`import` requires a Hash with either :github, :gitlab, :gem, :path or :url"
89
96
  end
90
97
  else
91
98
  raise "`import` requires a Hash"
@@ -180,6 +187,19 @@ module Danger
180
187
  @dangerfile.parse(Pathname.new(local_path))
181
188
  end
182
189
 
190
+ # @!group Danger
191
+ # Download and execute a remote Dangerfile.
192
+ #
193
+ # @param [String] url
194
+ # A https url where the Dangerfile is.
195
+ # @return [void]
196
+ #
197
+ def import_dangerfile_from_url(url)
198
+ raise "`import_dangerfile_from_url` requires a string" unless url.kind_of?(String)
199
+ local_path = download(url)
200
+ @dangerfile.parse(Pathname.new(local_path))
201
+ end
202
+
183
203
  # @!group Plugins
184
204
  # Download a local or remote plugin or Dangerfile.
185
205
  # This method will not import the file for you, use plugin.import instead
@@ -57,7 +57,8 @@ module Danger
57
57
  def fetch_comments
58
58
  values = []
59
59
  # TODO: use a url parts encoder to encode the query
60
- uri = "#{pr_api_endpoint}/comments?pagelen=100&q=deleted+%7E+false+AND+user.username+%7E+%22#{@username}%22"
60
+ corrected_uuid = @my_uuid[1...-1] if !@my_uuid.nil? # Endpoint doesnt support curly brackets for this, so remove them for this
61
+ uri = "#{pr_api_endpoint}/comments?pagelen=100&q=deleted+%7E+false+AND+user.uuid+%7E+%22#{corrected_uuid}%22"
61
62
 
62
63
  while uri
63
64
  json = fetch_json(URI(uri))
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "8.2.0".freeze
2
+ VERSION = "8.2.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: 8.2.0
4
+ version: 8.2.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: 2020-10-26 00:00:00.000000000 Z
12
+ date: 2020-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide