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-additional-logging-0.0.23 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.22 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.21 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.20 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.19 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.18 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.17 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.16 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.15 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.14 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.13 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.12 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.11 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.10 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.9 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.8 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.7 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.6 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.5 lib/danger/request_sources/local_only.rb
danger-additional-logging-0.0.4 lib/danger/request_sources/local_only.rb