Sha256: 5a7d636df551d4d9b29ab55b926ea4a660f9b126843bc988da1bd6f5597c969a

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

require 'git'
require 'open-uri'

module OpenStax::Aws
  module GitHelper

    def self.sha_for_branch_name(org_slash_repo:, branch:)
      ::Git.ls_remote("https://github.com/#{org_slash_repo}")["branches"][branch][:sha]
    end

    def self.file_content_at_sha(org_slash_repo:, sha:, path:)
      location = "https://raw.githubusercontent.com/#{org_slash_repo}/#{sha}/#{path}"
      file = open(location)
      file.read
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openstax_aws-1.2.0 lib/openstax/aws/git_helper.rb
openstax_aws-1.1.0 lib/openstax/aws/git_helper.rb
openstax_aws-1.0.0 lib/openstax/aws/git_helper.rb