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 +4 -4
- data/lib/danger/ci_source/bitrise.rb +10 -4
- data/lib/danger/commands/runner.rb +1 -0
- data/lib/danger/commands/staging.rb +53 -0
- data/lib/danger/request_sources/gitlab.rb +10 -7
- data/lib/danger/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9d926df8cc4784ba1922fb73e34566e9b22e29f7345965d673fda190b265c151
         | 
| 4 | 
            +
              data.tar.gz: f8970d62ca3a0e305e1c80e1e27bde421c2eeb6dffc5633e7abba91d21c6b92f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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  | 
| 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 | 
            -
                   | 
| 53 | 
            -
             | 
| 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
         | 
| @@ -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 | 
            -
                     | 
| 41 | 
            -
             | 
| 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. | 
| 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 | 
            -
             | 
    
        data/lib/danger/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 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
         |