class Danger::LocalOnlyGitRepo
### CI
Setup
For setting up LocalOnlyGitRepo
there is not much needed. Either ‘–base` and `–head` need to be specified or origin/master is expected for base and HEAD for head
Constants
- BASE_VAR
- HEAD_VAR
Attributes
Public Class Methods
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 38 def initialize(env = {}) # expects --base/--head specified OR origin/master to be base and HEAD head self.base_commit = env[BASE_VAR] || run_git("rev-parse --abbrev-ref origin/master") self.head_commit = env[HEAD_VAR] || run_git("rev-parse --abbrev-ref HEAD") end
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 18 def self.validates_as_ci?(env) env.key? "DANGER_USE_LOCAL_ONLY_GIT" end
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 22 def self.validates_as_pr?(_env) false end
Public Instance Methods
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 26 def git @git ||= GitRepo.new end
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 30 def run_git(command) git.exec(command).encode("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "") end
Source
# File lib/danger/ci_source/local_only_git_repo.rb, line 34 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::LocalOnly] end