Sha256: f611feaaa97e23d635f7c08d71178304882d60c28bc2af4a880e33ebb0fae7d3

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module Spandx
  module Cli
    module Commands
      class Scan < Spandx::Cli::Command
        attr_reader :lockfile

        def initialize(lockfile, options)
          @lockfile = lockfile ? ::Pathname.new(File.expand_path(lockfile)) : nil
          @options = options
        end

        def execute(output: $stdout)
          if lockfile.nil?
            output.puts 'OK'
          else
            report = ::Spandx::Core::Report.new
            ::Spandx::Core::Parser.for(lockfile).parse(lockfile).each do |dependency|
              report.add(dependency)
            end
            output.puts report.to_json
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spandx-0.7.0 lib/spandx/cli/commands/scan.rb
spandx-0.6.0 lib/spandx/cli/commands/scan.rb