Sha256: f64f01e37dfb6b79649d2c5f13a163030bd204db96b397889564f1fc519663b4

Contents?: true

Size: 1.46 KB

Versions: 26

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

module LicenseFinder
  module CLI
    class Dependencies < Base
      extend Subcommand
      include MakesDecisions

      method_option :approve, type: :boolean, desc: 'Approve the added dependency'
      method_option :homepage, type: :string, desc: 'Source of the added dependency'

      auditable
      desc 'add DEPENDENCY LICENSE VERSION [--homepage=HOMEPAGE] [--approve]', 'Add a dependency that is not managed by a package manager, optionally approving it at the same time'
      def add(name, license, version)
        modifying do
          decisions
            .add_package(name, version, txn)
            .license(name, license, txn)
          decisions.homepage(name, options[:homepage], txn) if options[:homepage]
          decisions.approve(name, txn) if options[:approve]
        end
        if options[:approve]
          say "The #{name} dependency has been added and approved!", :green
        else
          say "The #{name} dependency has been added!", :green
        end
      end

      auditable
      desc 'remove DEPENDENCY', 'Remove a dependency that is not managed by a package manager'
      def remove(name)
        modifying { decisions.remove_package(name, txn) }

        say "The #{name} dependency has been removed.", :green
      end

      desc 'list', 'List manually added dependencies'
      def list
        say 'Manually Added Dependencies:', :blue
        say_each(decisions.packages, &:name)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
license_finder-6.15.0 lib/license_finder/cli/dependencies.rb
gitlab-license_finder-6.14.2.1 lib/license_finder/cli/dependencies.rb
license_finder-6.14.2 lib/license_finder/cli/dependencies.rb
license_finder-6.14.1 lib/license_finder/cli/dependencies.rb
license_finder-6.13.0 lib/license_finder/cli/dependencies.rb
license_finder-6.12.2 lib/license_finder/cli/dependencies.rb
license_finder-6.12.1 lib/license_finder/cli/dependencies.rb
license_finder-6.12.0 lib/license_finder/cli/dependencies.rb
license_finder-6.11.0 lib/license_finder/cli/dependencies.rb
license_finder-6.10.1 lib/license_finder/cli/dependencies.rb
license_finder-6.10.0 lib/license_finder/cli/dependencies.rb
license_finder-6.9.0 lib/license_finder/cli/dependencies.rb
license_finder-6.8.2 lib/license_finder/cli/dependencies.rb
license_finder-6.8.1 lib/license_finder/cli/dependencies.rb
license_finder-6.8.0 lib/license_finder/cli/dependencies.rb
license_finder-6.7.0 lib/license_finder/cli/dependencies.rb
license_finder-6.6.2 lib/license_finder/cli/dependencies.rb
license_finder-6.6.1 lib/license_finder/cli/dependencies.rb
license_finder-6.6.0 lib/license_finder/cli/dependencies.rb
license_finder-6.5.0 lib/license_finder/cli/dependencies.rb