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) ⇒ Object



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

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

#listObject



38
39
40
41
# File 'lib/license_finder/cli/dependencies.rb', line 38

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

#remove(name) ⇒ Object



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

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

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