Sha256: 198ce78c18b64c18eb949d38e619356ebca44a39d27902b63ebbd01d706a15b0

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module Bundler
  module Alive
    # Represents a source code repository
    class SourceCodeRepository
      module Service
        GITHUB = :github
      end

      #
      # Creates a `SourceCodeRepository`
      #
      # @param [SourceCodeRepositoryUrl] url
      #
      def initialize(url:)
        raise ArgumentError, "Unknown url: #{url}" unless url.instance_of?(SourceCodeRepositoryUrl)

        @url = url
        @client = Client::SourceCodeClient.new(service_name: url.service_name)
      end

      #
      # Returns alive or not
      #
      # @return [Boolean]
      #
      def alive?
        !client.archived?(url)
      end

      private

      attr_reader :url, :client
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bundler-alive-0.1.2 lib/bundler/alive/source_code_repository.rb
bundler-alive-0.1.1 lib/bundler/alive/source_code_repository.rb
bundler-alive-0.1.0 lib/bundler/alive/source_code_repository.rb