Sha256: 17431d1b366f912e73f514ee31aba645ac2a72b3780cbf239f346cbd4dd87a1c

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 KB

Contents

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

      method_option :approve, type: :boolean, desc: 'Approve the added dependency'
      auditable
      desc 'add DEPENDENCY LICENSE [VERSION] [--approve]', 'Add a dependency that is not managed by a package manager, optionally approving it at the same time'
      def add(name, license, version = nil)
        modifying do
          decisions
            .add_package(name, version, txn)
            .license(name, license, txn)
          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

14 entries across 14 versions & 1 rubygems

Version Path
license_finder-5.4.1 lib/license_finder/cli/dependencies.rb
license_finder-5.4.0 lib/license_finder/cli/dependencies.rb
license_finder-5.3.0 lib/license_finder/cli/dependencies.rb
license_finder-5.2.3 lib/license_finder/cli/dependencies.rb
license_finder-5.2.1 lib/license_finder/cli/dependencies.rb
license_finder-5.2.0 lib/license_finder/cli/dependencies.rb
license_finder-5.1.1 lib/license_finder/cli/dependencies.rb
license_finder-5.1.0 lib/license_finder/cli/dependencies.rb
license_finder-5.0.3 lib/license_finder/cli/dependencies.rb
license_finder-5.0.2 lib/license_finder/cli/dependencies.rb
license_finder-5.0.0 lib/license_finder/cli/dependencies.rb
license_finder-4.0.2 lib/license_finder/cli/dependencies.rb
license_finder-4.0.1 lib/license_finder/cli/dependencies.rb
license_finder-3.1.1 lib/license_finder/cli/dependencies.rb