Sha256: 71e0e755f240ac38d5e06adaa8d355c1552ecb77047136706fd1255854bd8c96

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

# frozen_string_literal: true

module Spandx
  module Cli
    module Commands
      class Build
        INDEXES = {
          maven: Spandx::Java::Index,
          nuget: Spandx::Dotnet::Index,
          dotnet: Spandx::Dotnet::Index,
          pypi: Spandx::Python::Index,
        }.freeze

        def initialize(options)
          @options = options
        end

        def execute(output: $stdout)
          catalogue = Spandx::Spdx::Catalogue.from_git
          indexes.each do |index|
            output.puts index.name
            index.update!(catalogue: catalogue, output: output)
          end
          output.puts 'OK'
        end

        private

        def indexes
          index = INDEXES[@options[:index]&.to_sym]

          if index.nil?
            INDEXES.values.uniq.map { |x| x.new(directory: @options[:directory]) }
          else
            [index.new(directory: @options[:directory])]
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spandx-0.12.3 lib/spandx/cli/commands/build.rb
spandx-0.12.2 lib/spandx/cli/commands/build.rb
spandx-0.12.1 lib/spandx/cli/commands/build.rb
spandx-0.12.0 lib/spandx/cli/commands/build.rb