Sha256: b2cfb79016d2ec2536f8759de3c1792d290a9d4f5f21058029afe5d2b88aaccf

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 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/master..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.1.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-2.0.0 lib/git/lint/branches/environments/netlify_ci.rb