class Bard::CI
Public Class Methods
new(project_name, branch, local: false)
click to toggle source
# File lib/bard/ci.rb, line 5 def initialize project_name, branch, local: false @project_name = project_name @branch = branch @local = !!local end
Private Instance Methods
choose_runner_class()
click to toggle source
# File lib/bard/ci.rb, line 36 def choose_runner_class if local? require_relative "./ci/local" Local elsif github_actions? require_relative "./ci/github_actions" GithubActions elsif jenkins? require_relative "./ci/jenkins" Jenkins end end
github_actions?()
click to toggle source
# File lib/bard/ci.rb, line 20 def github_actions? File.exist?(".github/workflows/ci.yml") end
jenkins?()
click to toggle source
# File lib/bard/ci.rb, line 24 def jenkins? !local? && !github_actions? end
local?()
click to toggle source
# File lib/bard/ci.rb, line 16 def local? @local end
runner()
click to toggle source
# File lib/bard/ci.rb, line 28 def runner @runner ||= choose_runner_class.new(@project_name, @branch, sha) end
sha()
click to toggle source
# File lib/bard/ci.rb, line 32 def sha @sha ||= `git rev-parse #{@branch}`.chomp end