Class: Git::Lint::Branches::Environments::NetlifyCI

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/branches/environments/netlify_ci.rb

Overview

Provides Netlify CI build environment feature branch information.

Instance Method Summary collapse

Constructor Details

#initialize(repository: GitPlus::Repository.new, shell: Open3, environment: ENV) ⇒ NetlifyCI

Returns a new instance of NetlifyCI.



11
12
13
14
15
# File 'lib/git/lint/branches/environments/netlify_ci.rb', line 11

def initialize repository: GitPlus::Repository.new, shell: Open3, environment: ENV
  @repository = repository
  @shell = shell
  @environment = environment
end

Instance Method Details

#commitsObject



21
22
23
24
25
# File 'lib/git/lint/branches/environments/netlify_ci.rb', line 21

def commits
  shell.capture3 "git remote add -f origin #{environment["REPOSITORY_URL"]}"
  shell.capture3 "git fetch origin #{name}:#{name}"
  repository.commits "origin/#{repository.branch_default}..origin/#{name}"
end

#nameObject



17
18
19
# File 'lib/git/lint/branches/environments/netlify_ci.rb', line 17

def name
  environment["HEAD"]
end