Sha256: 3174e90a79d312d354d29ab3a92068f582b6f16ffe835158950533b05b1f7e81

Contents?: true

Size: 858 Bytes

Versions: 5

Compression:

Stored size: 858 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"]

          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

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.3.3 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.3.2 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.3.1 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.3.0 lib/git/lint/branches/environments/netlify_ci.rb