danger 6.2.2 → 6.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45b362f1e56f963bb7e924c541d6934d426ce840f092fb26aa4158956bb9fb5d
4
- data.tar.gz: af30407cccc20cd672276fe288626506c2e6835215fbc4ee8c775119c4703099
3
+ metadata.gz: 9d926df8cc4784ba1922fb73e34566e9b22e29f7345965d673fda190b265c151
4
+ data.tar.gz: f8970d62ca3a0e305e1c80e1e27bde421c2eeb6dffc5633e7abba91d21c6b92f
5
5
  SHA512:
6
- metadata.gz: bf6970506bab77f49b534185392873b8448af90d4ac1a7ba6004673a900d63e3f8141f3561372fa5da2935be0fe00646d08f7fea97da1165826d1851932ad038
7
- data.tar.gz: b1cfca29b03ac5ad85089b92d2ea5d17df40a6a4ed2e0da15e4fa772f50696347976f1d701a4f891febf3d42acaab864aa15d1e5c2f8894fc344cb352c208f14
6
+ metadata.gz: 9608e049321d268c0f3870c3bb8b73409a18f8fcedc7f51b199a70a0495f5ed4d2d729276fd65cfdf398b04702c2a55d75c4ddcfe73d80098971c5126f5b33c7
7
+ data.tar.gz: 4fd51d8b97e1e1e417885ef72b4ece5755fbfe691bccd60b437950071cb70e009a3205397a5f8da281c776da58133d9690c98f415eb29a17bcb99da5b6fc277d
@@ -25,7 +25,7 @@ module Danger
25
25
  # finding the project and repo slug in the GIT_REPOSITORY_URL variable. This GIT_REPOSITORY_URL variable
26
26
  # comes from the App Settings tab for your Bitrsie App. If you are manually setting a repo URL in the
27
27
  # Git Clone Repo step, you may need to set adjust this propery in the settings tab, maybe even fake it.
28
- # The pattern used is `(%r{([\/:])(([^\/]+\/){1,2}[^\/]+?)(\.git$|$)}`.
28
+ # The patterns used are `(%r{\.com/(.*)})` and `(%r{\.com:(.*)})` .
29
29
  #
30
30
  class Bitrise < CI
31
31
  def self.validates_as_ci?(env)
@@ -48,9 +48,15 @@ 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
-
52
- repo_matches = self.repo_url.match(%r{([\/:])(([^\/]+\/){1,2}[^\/]+?)(\.git$|$)})
53
- self.repo_slug = repo_matches[2] unless repo_matches.nil?
51
+
52
+ if repo_url.include? ".com/"
53
+ repo_matches = self.repo_url.match(%r{\.com/(.*)})[1]
54
+ elsif repo_url.include? ".com:"
55
+ repo_matches = self.repo_url.match(%r{\.com:(.*)})[1]
56
+ end
57
+
58
+ self.repo_slug = repo_matches unless repo_matches.nil?
59
+
54
60
  end
55
61
  end
56
62
  end
@@ -3,6 +3,7 @@ module Danger
3
3
  require "danger/commands/init"
4
4
  require "danger/commands/local"
5
5
  require "danger/commands/dry_run"
6
+ require "danger/commands/staging"
6
7
  require "danger/commands/systems"
7
8
  require "danger/commands/pr"
8
9
 
@@ -0,0 +1,53 @@
1
+ require "danger/commands/local_helpers/pry_setup"
2
+ require "fileutils"
3
+ require "tmpdir"
4
+
5
+ module Danger
6
+ class Staging < Runner
7
+ self.summary = "Run the Dangerfile locally against local master"
8
+ self.command = "staging"
9
+
10
+ def self.options
11
+ [
12
+ ["--pry", "Drop into a Pry shell after evaluating the Dangerfile."]
13
+ ]
14
+ end
15
+
16
+ def initialize(argv)
17
+ show_help = true if argv.arguments == ["-h"]
18
+
19
+ # Currently CLAide doesn't support short option like -h https://github.com/CocoaPods/CLAide/pull/60
20
+ # when user pass in -h, mimic the behavior of passing in --help.
21
+ argv = CLAide::ARGV.new ["--help"] if show_help
22
+
23
+ super
24
+
25
+ if argv.flag?("pry", false)
26
+ @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path)
27
+ end
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ unless @dangerfile_path
33
+ help! "Could not find a Dangerfile."
34
+ end
35
+ end
36
+
37
+ def run
38
+ ENV["DANGER_USE_LOCAL_ONLY_GIT"] = "YES"
39
+
40
+ env = EnvironmentManager.new(ENV, cork)
41
+ dm = Dangerfile.new(env, cork)
42
+
43
+ dm.run(
44
+ Danger::EnvironmentManager.danger_base_branch,
45
+ Danger::EnvironmentManager.danger_head_branch,
46
+ @dangerfile_path,
47
+ nil,
48
+ nil,
49
+ nil
50
+ )
51
+ end
52
+ end
53
+ end
@@ -36,9 +36,13 @@ module Danger
36
36
  require "gitlab"
37
37
 
38
38
  @client ||= Gitlab.client(endpoint: endpoint, private_token: token)
39
- rescue LoadError
40
- puts "The GitLab gem was not installed, you will need to change your Gem from `danger` to `danger-gitlab`.".red
41
- puts "\n - See https://github.com/danger/danger/blob/master/CHANGELOG.md#400"
39
+ rescue LoadError => e
40
+ if e.path == "gitlab"
41
+ puts "The GitLab gem was not installed, you will need to change your Gem from `danger` to `danger-gitlab`.".red
42
+ puts "\n - See https://github.com/danger/danger/blob/master/CHANGELOG.md#400"
43
+ else
44
+ puts "Error: #{e}".red
45
+ end
42
46
  abort
43
47
  end
44
48
 
@@ -122,11 +126,11 @@ module Danger
122
126
  end
123
127
 
124
128
  def setup_danger_branches
129
+ # we can use a GitLab specific feature here:
125
130
  base_branch = self.mr_json.source_branch
131
+ base_commit = self.mr_json.diff_refs.base_sha
126
132
  head_branch = self.mr_json.target_branch
127
- head_commit = self.scm.head_commit
128
-
129
- raise "Are you running `danger local/pr` against the correct repository? Also this can happen if you run danger on MR without changes" if base_commit == head_commit
133
+ head_commit = self.mr_json.diff_refs.head_sha
130
134
 
131
135
  # Next, we want to ensure that we have a version of the current branch at a known location
132
136
  scm.ensure_commitish_exists_on_branch! base_branch, base_commit
@@ -512,4 +516,3 @@ module Danger
512
516
  end
513
517
  end
514
518
  end
515
-
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "6.2.2".freeze
2
+ VERSION = "6.3.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: 6.2.2
4
+ version: 6.3.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: 2020-02-07 00:00:00.000000000 Z
12
+ date: 2020-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -246,6 +246,7 @@ files:
246
246
  - lib/danger/commands/plugins/plugin_readme.rb
247
247
  - lib/danger/commands/pr.rb
248
248
  - lib/danger/commands/runner.rb
249
+ - lib/danger/commands/staging.rb
249
250
  - lib/danger/commands/systems.rb
250
251
  - lib/danger/comment_generators/bitbucket_server.md.erb
251
252
  - lib/danger/comment_generators/bitbucket_server_inline.md.erb