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
base_commit[RW]
head_commit[RW]
Public Class Methods
new(env = {})
click to toggle 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
validates_as_ci?(env)
click to toggle 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
validates_as_pr?(_env)
click to toggle source
# File lib/danger/ci_source/local_only_git_repo.rb, line 22 def self.validates_as_pr?(_env) false end
Public Instance Methods
git()
click to toggle source
# File lib/danger/ci_source/local_only_git_repo.rb, line 26 def git @git ||= GitRepo.new end
run_git(command)
click to toggle 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
supported_request_sources()
click to toggle source
# File lib/danger/ci_source/local_only_git_repo.rb, line 34 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::LocalOnly] end