Sha256: e74bc8d71d8a7f91009ee689fe48e2cd672cc1504309a45220c7c580e5d512bf

Contents?: true

Size: 882 Bytes

Versions: 2

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require "open3"

module Git
  module Lint
    module Branches
      module Environments
        # Provides Netlify CI build environment feature branch information.
        class NetlifyCI
          def initialize repository: GitPlus::Repository.new, shell: Open3, environment: ENV
            @repository = repository
            @shell = shell
            @environment = environment
          end

          def name
            environment["HEAD"]
          end

          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

          private

          attr_reader :repository, :shell, :environment
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-lint-2.2.1 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.2.0 lib/git/lint/branches/environments/netlify_ci.rb