Sha256: 2f6a09c7091343c39e918e61ee867173c3ef63526363e6611229c8485e69b1f1

Contents?: true

Size: 838 Bytes

Versions: 7

Compression:

Stored size: 838 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 environment: ENV, repo: Git::Kit::Repo.new, shell: Open3
            @environment = environment
            @repo = repo
            @shell = shell
          end

          def name
            environment["HEAD"]
          end

          def shas
            shell.capture2e "git remote add -f origin #{environment["REPOSITORY_URL"]}"
            shell.capture2e "git fetch origin #{name}:#{name}"
            repo.shas start: "origin/master", finish: "origin/#{name}"
          end

          private

          attr_reader :environment, :repo, :shell
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
git-lint-1.4.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.3.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.2.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.1.1 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.1.0 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.0.1 lib/git/lint/branches/environments/netlify_ci.rb
git-lint-1.0.0 lib/git/lint/branches/environments/netlify_ci.rb