Class: LicenseFinder::CLI::Dependencies

Inherits:
Base
  • Object
show all
Extended by:
Subcommand
Includes:
MakesDecisions
Defined in:
lib/license_finder/cli/dependencies.rb

Instance Method Summary collapse

Methods included from Subcommand

banner

Methods included from MakesDecisions

included

Instance Method Details

#add(name, license, version = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/license_finder/cli/dependencies.rb', line 10

def add(name, license, version = nil)
  modifying {
    decisions
      .add_package(name, version, txn)
      .license(name, license, txn)
    decisions.approve(name, txn) if options[:approve]
  }
  if options[:approve]
    say "The #{name} dependency has been added and approved!", :green
  else
    say "The #{name} dependency has been added!", :green
  end
end

#listObject



33
34
35
36
# File 'lib/license_finder/cli/dependencies.rb', line 33

def list
  say "Manually Added Dependencies:", :blue
  say_each(decisions.packages) { |package| package.name }
end

#remove(name) ⇒ Object



26
27
28
29
30
# File 'lib/license_finder/cli/dependencies.rb', line 26

def remove(name)
  modifying { decisions.remove_package(name, txn) }

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