danger 9.0.0 → 9.1.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
  SHA256:
3
- metadata.gz: 613bfd46794c42423189f27277eb745250ebae6a3bed733c9ba499d7507c1671
4
- data.tar.gz: 309007d0119085c78e8a18dec65d5fe8f2c46d67a9267b8e7ddd7fe8f284e31a
3
+ metadata.gz: 8fc4bd35f1d805c6e3ef5b0467cd59281f0251c10b0580ebb138002e3b370e62
4
+ data.tar.gz: 29df2722f598ead34bee294304b60b3f6343c6147cce87054772aac2b40f1f2b
5
5
  SHA512:
6
- metadata.gz: d934930d7677f61ec2c549c2418396f6bbb8c625fd1bc03f51952d9b5a6c4384b0e6a72fa496a0296bc1c6a524dbef8712f0bf73bbc25ff11897889896b928e4
7
- data.tar.gz: c6d450cf48ed09ca021849ff8166e102bc85ab970cefa3a715f5047e807b9f6dc8b2eaa3aa59b0e965e31efbde97b70d3b5efcc9cf5ddb50b51789b1385de25f
6
+ metadata.gz: 304581c49ae31baa62f135883e006536e993a824a6cea8a920a37d58b232ea3118eccf773ffc760281c8a49b70446b51b955c952379e9d41e12e9d9e9842a4d7
7
+ data.tar.gz: d68b392bcb4075b852cc988fdaa3e9e2fd3df080417dd31d1cb314bf9ec1a4f3af5fdf759f7f106e5071b60e48ae4affb78750ae58a43ecadb94d533d9e80d83
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-present Orta, Felix Krause
3
+ Copyright (c) 2015-present Orta, Felix Krause
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,83 @@
1
+ # https://docs.appcircle.io/environment-variables/managing-variables
2
+ # https://docs.appcircle.io/build/build-profile-configuration#environment-variables-configuration
3
+ require "danger/request_sources/github/github"
4
+ require "danger/request_sources/gitlab"
5
+ module Danger
6
+ # ### CI Setup
7
+ #
8
+ # Add a Custom Script step to your workflow and set it as a bash:
9
+ #
10
+ # ```shell
11
+ # cd $AC_REPOSITORY_DIR
12
+ # bundle install
13
+ # bundle exec danger
14
+ # ```
15
+ # ### Token Setup
16
+ #
17
+ # Login to Appcircle and select your build profile. Go to your *Config* and
18
+ # choose *Environment Variables*.
19
+ # https://docs.appcircle.io/environment-variables/managing-variables
20
+ #
21
+ # #### GitHub
22
+ # Add the `DANGER_GITHUB_API_TOKEN` to your profile's ENV.
23
+ #
24
+ # #### GitLab
25
+ # Add the `DANGER_GITLAB_API_TOKEN` to your profile's ENV.
26
+ #
27
+ # #### Bitbucket Cloud
28
+ # Add the `DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD`
29
+ # to your profile's ENV.
30
+ #
31
+ # #### Bitbucket server
32
+ # Add the `DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD`
33
+ # and `DANGER_BITBUCKETSERVER_HOST` to your profile's ENV.
34
+ #
35
+ class Appcircle < CI
36
+ def self.validates_as_ci?(env)
37
+ env.key? "AC_APPCIRCLE"
38
+ end
39
+
40
+ def self.validates_as_pr?(env)
41
+ return false unless env.key? "AC_PULL_NUMBER"
42
+ env["AC_PULL_NUMBER"].to_i > 0
43
+ end
44
+
45
+ def supported_request_sources
46
+ @supported_request_sources ||= [
47
+ Danger::RequestSources::GitHub,
48
+ Danger::RequestSources::BitbucketCloud,
49
+ Danger::RequestSources::BitbucketServer,
50
+ Danger::RequestSources::GitLab
51
+ ]
52
+ end
53
+
54
+ def initialize(env)
55
+ self.pull_request_id = env["AC_PULL_NUMBER"]
56
+ self.repo_url = env["AC_GIT_URL"]
57
+ self.repo_slug = repo_slug_from(self.repo_url)
58
+ end
59
+
60
+ def repo_slug_from(url)
61
+ if url =~ URI::regexp
62
+ # Try to parse the URL as a valid URI. This should cover the cases of http/https/ssh URLs.
63
+ begin
64
+ uri = URI.parse(url)
65
+ return uri.path.sub(/^(\/)/,'').sub(/(.git)$/,'')
66
+ rescue URI::InvalidURIError
67
+ # In case URL could not be parsed fallback to git URL parsing.
68
+ repo_slug_asgiturl(url)
69
+ end
70
+ else
71
+ # In case URL could not be parsed fallback to git URL parsing. git@github.com:organization/repo.git
72
+ repo_slug_asgiturl(url)
73
+ end
74
+ end
75
+
76
+ def repo_slug_asgiturl(url)
77
+ matcher_url = url
78
+ repo_matches = matcher_url.match(%r{([\/:])(([^\/]+\/)+[^\/]+?)(\.git$|$)})[2]
79
+ return repo_matches unless repo_matches.nil?
80
+ end
81
+ end
82
+ end
83
+
@@ -19,13 +19,13 @@ module Danger
19
19
  #
20
20
  # Add the `DANGER_GITHUB_API_TOKEN` to your workflow's [Secret App Env Vars](https://blog.bitrise.io/anyone-even-prs-can-have-secrets).
21
21
  #
22
- # ### bitbucket server and bitrsie
22
+ # ### bitbucket server and bitrise
23
23
  #
24
- # Danger will read the environment variable GIT_REPOSITORY_URL to construct the Bitbucket Server API URL
25
- # finding the project and repo slug in the GIT_REPOSITORY_URL variable. This GIT_REPOSITORY_URL variable
26
- # comes from the App Settings tab for your Bitrsie App. If you are manually setting a repo URL in the
27
- # Git Clone Repo step, you may need to set adjust this propery in the settings tab, maybe even fake it.
28
- # The patterns used are `(%r{\.com/(.*)})` and `(%r{\.com:(.*)})` and .split(/\.git$|$/) to remove ".git" if the URL contains it.
24
+ # Danger will read the environment variable GIT_REPOSITORY_URL to construct the Bitbucket Server API URL
25
+ # finding the project and repo slug in the GIT_REPOSITORY_URL variable. This GIT_REPOSITORY_URL variable
26
+ # comes from the App Settings tab for your Bitrise App. If you are manually setting a repo URL in the
27
+ # Git Clone Repo step, you may need to set adjust this property in the settings tab, maybe even fake it.
28
+ # The patterns used are `(%r{\.com/(.*)})` and `(%r{\.com:(.*)})` and .split(/\.git$|$/) to remove ".git" if the URL contains it.
29
29
  #
30
30
  class Bitrise < CI
31
31
  def self.validates_as_ci?(env)
@@ -48,7 +48,7 @@ module Danger
48
48
  def initialize(env)
49
49
  self.pull_request_id = env["BITRISE_PULL_REQUEST"]
50
50
  self.repo_url = env["GIT_REPOSITORY_URL"]
51
-
51
+
52
52
  matcher_url = self.repo_url
53
53
  self.repo_slug = repo_slug_from(self.repo_url)
54
54
  end
@@ -31,7 +31,7 @@ module Danger
31
31
  # to retrieve PR metadata, which will require an API token.
32
32
  #
33
33
  # 1. Go to your project > Settings > API Permissions. Create a token with scope "view-builds" and a label like "DANGER_CIRCLE_CI_API_TOKEN".
34
- # 2. Settings > Environement Variables. Add the token as a CircleCI environment variable, which exposes it to the Danger process.
34
+ # 2. Settings > Environment Variables. Add the token as a CircleCI environment variable, which exposes it to the Danger process.
35
35
  #
36
36
  # There is no difference here for OSS vs Closed, both scenarios will need this environment variable.
37
37
  #
@@ -48,7 +48,7 @@ module Danger
48
48
 
49
49
  client_version = Gem::Version.new(client.version.version)
50
50
  if (client_version >= Gem::Version.new("10.7"))
51
- #Use the 'list merge requests associated with a commit' API, for speeed
51
+ #Use the 'list merge requests associated with a commit' API, for speed
52
52
  # (GET /projects/:id/repository/commits/:sha/merge_requests) available for GitLab >= 10.7
53
53
  merge_request = client.commit_merge_requests(project_path, base_commit, state: :opened).first
54
54
  if (client_version >= Gem::Version.new("13.8"))
@@ -31,7 +31,7 @@ module Danger
31
31
  #
32
32
  # #### General
33
33
  #
34
- # People occasionally see issues with Danger not classing your CI runs as a PR, to give you visibilty
34
+ # People occasionally see issues with Danger not classing your CI runs as a PR, to give you visibility
35
35
  # the Jenkins side of Danger expects to see one of these env vars:
36
36
  # - ghprbPullId
37
37
  # - CHANGE_ID
@@ -17,5 +17,5 @@
17
17
  <%= current %>
18
18
  <%# the previous line has to be aligned far to the left, otherwise markdown can break easily %>
19
19
  <%- end -%>
20
- <%# Add the generated_by_ as a html coment to identify comments from danger. %>
20
+ <%# Add the generated_by_ as a html comment to identify comments from danger. %>
21
21
  <!-- "generated_by_<%= @danger_id %>" -->
@@ -308,7 +308,7 @@ module Danger
308
308
  private
309
309
 
310
310
  def eval_file(contents, path)
311
- eval(contents, nil, path.to_s) # rubocop:disable Eval
311
+ eval(contents, nil, path.to_s) # rubocop:disable Security/Eval
312
312
  end
313
313
 
314
314
  def print_list(title, rows)
@@ -3,7 +3,7 @@ require "danger/plugin_support/plugin"
3
3
  # Danger
4
4
  module Danger
5
5
  # Handles interacting with local only plugin inside a Dangerfile.
6
- # It is support pluggin for dry_run command and does not expose any methods.
6
+ # It is support plugin for dry_run command and does not expose any methods.
7
7
  # But you can still use other plugins like git
8
8
  #
9
9
  # @example Check that added lines contains agreed form of words
@@ -28,9 +28,9 @@ module Danger
28
28
 
29
29
  def supports_comments?
30
30
  major_version = @api_version.split(".").first.to_i
31
- minimun_version_for_comments = self.min_api_version_for_comments.split(".").first.to_i
31
+ minimum_version_for_comments = self.min_api_version_for_comments.split(".").first.to_i
32
32
 
33
- major_version >= minimun_version_for_comments
33
+ major_version >= minimum_version_for_comments
34
34
  end
35
35
 
36
36
  def inspect
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "9.0.0".freeze
2
+ VERSION = "9.1.0".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: 9.0.0
4
+ version: 9.1.0
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: 2022-09-02 00:00:00.000000000 Z
12
+ date: 2022-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -206,6 +206,7 @@ files:
206
206
  - lib/assets/DangerfileTemplate
207
207
  - lib/danger.rb
208
208
  - lib/danger/ci_source/appcenter.rb
209
+ - lib/danger/ci_source/appcircle.rb
209
210
  - lib/danger/ci_source/appveyor.rb
210
211
  - lib/danger/ci_source/azure_pipelines.rb
211
212
  - lib/danger/ci_source/bamboo.rb
@@ -343,7 +344,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
344
  - !ruby/object:Gem::Version
344
345
  version: '0'
345
346
  requirements: []
346
- rubygems_version: 3.1.6
347
+ rubyforge_project:
348
+ rubygems_version: 2.7.6.2
347
349
  signing_key:
348
350
  specification_version: 4
349
351
  summary: Like Unit Tests, but for your Team Culture.