Class: Danger::RequestSources::LocalOnly

Inherits:
RequestSource show all
Includes:
Helpers::CommentsHelper
Defined in:
lib/danger/request_sources/local_only.rb

Constant Summary

Constants inherited from RequestSource

RequestSource::DANGER_REPO_NAME

Instance Attribute Summary collapse

Attributes inherited from RequestSource

#ci_source, #host, #ignored_violations

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CommentsHelper

#apply_template, #generate_comment, #generate_description, #generate_inline_comment_body, #generate_inline_markdown_body, #generate_message_group_comment, #markdown_link_to_message, #markdown_parser, #messages_are_equivalent, #process_markdown, #random_compliment, #table

Methods included from Helpers::CommentsParsingHelper

#parse_comment, #parse_message_from_row, #parse_tables_from_comment, #table_kind_from_title, #violations_from_table

Methods inherited from RequestSource

available_request_sources, available_source_names_and_envs, #file_url, inherited, #inspect, optional_env_vars, source_name, #update_build_status

Constructor Details

#initialize(ci_source, _environment) ⇒ LocalOnly

Returns a new instance of LocalOnly.



14
15
16
# File 'lib/danger/request_sources/local_only.rb', line 14

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

Instance Attribute Details

#commits_jsonObject

Returns the value of attribute commits_json.



8
9
10
# File 'lib/danger/request_sources/local_only.rb', line 8

def commits_json
  @commits_json
end

#mr_jsonObject

Returns the value of attribute mr_json.



8
9
10
# File 'lib/danger/request_sources/local_only.rb', line 8

def mr_json
  @mr_json
end

Class Method Details

.env_varsObject



10
11
12
# File 'lib/danger/request_sources/local_only.rb', line 10

def self.env_vars
  ["DANGER_LOCAL_ONLY"]
end

Instance Method Details

#fetch_detailsObject



40
# File 'lib/danger/request_sources/local_only.rb', line 40

def fetch_details; end

#organisationString

Returns The organisation name, is nil if it can’t be detected.

Returns:

  • (String)

    The organisation name, is nil if it can’t be detected



45
46
47
# File 'lib/danger/request_sources/local_only.rb', line 45

def organisation
  nil
end

#scmObject



26
27
28
# File 'lib/danger/request_sources/local_only.rb', line 26

def scm
  @scm ||= GitRepo.new
end

#setup_danger_branchesObject



30
31
32
33
34
35
36
37
38
# File 'lib/danger/request_sources/local_only.rb', line 30

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

#update_pull_request!(_hash_needed) ⇒ Object



42
# File 'lib/danger/request_sources/local_only.rb', line 42

def update_pull_request!(_hash_needed); end

#validates_as_api_source?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/danger/request_sources/local_only.rb', line 22

def validates_as_api_source?
  true
end

#validates_as_ci?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/danger/request_sources/local_only.rb', line 18

def validates_as_ci?
  true
end