Class: LicenseFinder::CLI::Licenses

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

Instance Method Summary collapse

Methods included from Subcommand

banner

Methods included from MakesDecisions

included

Instance Method Details

#add(name, license) ⇒ Object



12
13
14
15
16
17
# File 'lib/license_finder/cli/licenses.rb', line 12

def add(name, license)
  modifying { decisions.license(name, license, txn) }

  version_info = options[:version] ? " with version #{options[:version]}" : ''
  printer.say "The #{name} dependency#{version_info} has been marked as using #{license} license!", :green
end

#remove(dep, lic = nil) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/license_finder/cli/licenses.rb', line 22

def remove(dep, lic = nil)
  modifying { decisions.unlicense(dep, lic, txn) }

  version_info = options[:version] ? " with version #{options[:version]}" : ''
  suffix = lic ? " of #{lic}" : ''
  printer.say "The dependency #{dep}#{version_info} no longer has a manual license#{suffix}"
end