Sha256: ef8efda5a005ea19540d7569b2b90e6405048350bf32e17656d5fc3e9b121a25

Contents?: true

Size: 988 Bytes

Versions: 2

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require_relative 'polariscope/version'
require_relative 'polariscope/scanner/codebase_health_score'
require_relative 'polariscope/scanner/gem_versions'
require_relative 'polariscope/file_content'
require_relative 'polariscope/color/hsl'

module Polariscope
  Error = Class.new(StandardError)

  class << self
    def scan(gemfile_content: nil, gemfile_lock_content: nil, bundler_audit_config_content: nil)
      Scanner::CodebaseHealthScore.new(
        gemfile_content: gemfile_content || FileContent.for('Gemfile'),
        gemfile_lock_content: gemfile_lock_content || FileContent.for('Gemfile.lock'),
        bundler_audit_config_content: bundler_audit_config_content || FileContent.for('.bundler-audit.yml')
      ).health_score
    end

    def score_color(score)
      Color::Hsl.for(score)
    end

    def gem_versions(dependency_names, spec_type: :released)
      Scanner::GemVersions.new(dependency_names, spec_type: spec_type)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polariscope-0.1.2 lib/polariscope.rb
polariscope-0.1.1 lib/polariscope.rb