Sha256: 864d44cedfdbbced253eb497f9bd80f75ed29e550686472ff6dad5f242107bee

Contents?: true

Size: 1.25 KB

Versions: 46

Compression:

Stored size: 1.25 KB

Contents

require "danger/helpers/comments_helper"
require "danger/helpers/comment"

module Danger
  module RequestSources
    class LocalOnly < RequestSource
      include Danger::Helpers::CommentsHelper
      attr_accessor :mr_json, :commits_json

      def self.env_vars
        ["DANGER_LOCAL_ONLY"]
      end

      def initialize(ci_source, _environment)
        self.ci_source = ci_source
      end

      def validates_as_ci?
        true
      end

      def validates_as_api_source?
        true
      end

      def scm
        @scm ||= GitRepo.new
      end

      def setup_danger_branches
        # Check that discovered values really exists
        [ci_source.base_commit, ci_source.head_commit].each do |commit|
          raise "Specified commit '#{commit}' not found" if scm.exec("rev-parse --quiet --verify #{commit}").empty?
        end

        self.scm.exec "branch #{EnvironmentManager.danger_base_branch} #{ci_source.base_commit}"
        self.scm.exec "branch #{EnvironmentManager.danger_head_branch} #{ci_source.head_commit}"
      end

      def fetch_details; end

      def update_pull_request!(_hash_needed); end

      # @return [String] The organisation name, is nil if it can't be detected
      def organisation
        nil
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
danger-9.5.1 lib/danger/request_sources/local_only.rb
danger-9.5.0 lib/danger/request_sources/local_only.rb
danger-9.4.3 lib/danger/request_sources/local_only.rb
danger-9.4.2 lib/danger/request_sources/local_only.rb
danger-9.4.1 lib/danger/request_sources/local_only.rb
danger-9.4.0 lib/danger/request_sources/local_only.rb
danger-9.3.2 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.36 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.35 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.34 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.33 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.32 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.31 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.30 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.29 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.28 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.27 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.26 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.25 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.24 lib/danger/request_sources/local_only.rb