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, #environment, #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, optional_env_vars, source_name, #update_build_status

Constructor Details

#initialize(ci_source, environment) ⇒ LocalOnly

Returns a new instance of LocalOnly.



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

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

Instance Attribute Details

#commits_jsonObject

Returns the value of attribute commits_json.



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

def commits_json
  @commits_json
end

#mr_jsonObject

Returns the value of attribute mr_json.



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

def mr_json
  @mr_json
end

Class Method Details

.env_varsObject



12
13
14
# File 'lib/danger/request_sources/local_only.rb', line 12

def self.env_vars
  ["DANGER_LOCAL_ONLY"]
end

Instance Method Details

#fetch_detailsObject



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

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



48
49
50
# File 'lib/danger/request_sources/local_only.rb', line 48

def organisation
  nil
end

#scmObject



29
30
31
# File 'lib/danger/request_sources/local_only.rb', line 29

def scm
  @scm ||= GitRepo.new
end

#setup_danger_branchesObject



33
34
35
36
37
38
39
40
41
# File 'lib/danger/request_sources/local_only.rb', line 33

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



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

def update_pull_request!(_hash_needed); end

#validates_as_api_source?Boolean

Returns:

  • (Boolean)


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

def validates_as_api_source?
  true
end

#validates_as_ci?Boolean

Returns:

  • (Boolean)


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

def validates_as_ci?
  true
end