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



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

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

#listObject



35
36
37
38
# File 'lib/license_finder/cli/dependencies.rb', line 35

def list
  say 'Manually Added Dependencies:', :blue
  say_each(decisions.packages, &:name)
end

#remove(name) ⇒ Object



28
29
30
31
32
# File 'lib/license_finder/cli/dependencies.rb', line 28

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

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