Class: Danger::LocalGitRepo
- Defined in:
- lib/danger/ci_source/local_git_repo.rb
Overview
ignore
Instance Attribute Summary collapse
-
#base_commit ⇒ Object
Returns the value of attribute base_commit.
-
#head_commit ⇒ Object
Returns the value of attribute head_commit.
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
- #git ⇒ Object
-
#initialize(env = {}) ⇒ LocalGitRepo
constructor
A new instance of LocalGitRepo.
- #run_git(command) ⇒ Object
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env = {}) ⇒ LocalGitRepo
Returns a new instance of LocalGitRepo.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 39 def initialize(env = {}) @env = env self.repo_slug = remote_info.slug raise_error_for_missing_remote if remote_info.kind_of?(NoRepoInfo) self.pull_request_id = found_pull_request.pull_request_id if sha self.base_commit = commits.base self.head_commit = commits.head else self.base_commit = found_pull_request.base self.head_commit = found_pull_request.head end end |
Instance Attribute Details
#base_commit ⇒ Object
Returns the value of attribute base_commit.
17 18 19 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 17 def base_commit @base_commit end |
#head_commit ⇒ Object
Returns the value of attribute head_commit.
17 18 19 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 17 def head_commit @head_commit end |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
19 20 21 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 19 def self.validates_as_ci?(env) env.key? "DANGER_USE_LOCAL_GIT" end |
.validates_as_pr?(_env) ⇒ Boolean
23 24 25 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 23 def self.validates_as_pr?(_env) false end |
Instance Method Details
#git ⇒ Object
27 28 29 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 27 def git @git ||= GitRepo.new end |
#run_git(command) ⇒ Object
31 32 33 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 31 def run_git(command) git.exec(command).encode("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "") end |
#supported_request_sources ⇒ Object
35 36 37 |
# File 'lib/danger/ci_source/local_git_repo.rb', line 35 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::BitbucketServer, Danger::RequestSources::BitbucketCloud] end |