Class: LicenseFinder::CLI::Main

Inherits:
Base
  • Object
show all
Defined in:
lib/license_finder/cli.rb

Instance Method Summary collapse

Methods inherited from Base

subcommand

Instance Method Details

#action_itemsObject



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/license_finder/cli.rb', line 260

def action_items
  unapproved = Dependency.unapproved

  if unapproved.empty?
    say "All dependencies are approved for use", :green
  else
    say "Dependencies that need approval:", :red
    say TextReport.new(unapproved)
    exit 1
  end
end

#approve(name, *other_names) ⇒ Object



235
236
237
238
239
240
241
242
# File 'lib/license_finder/cli.rb', line 235

def approve(name, *other_names)
  names = other_names.unshift name
  die_on_error {
    names.each { |name| DependencyManager.approve!(name, options[:approver], options[:message]) }
  }

  say "The #{names.join(", ")} dependency has been approved!", :green
end

#license(license, name) ⇒ Object



245
246
247
248
249
250
251
# File 'lib/license_finder/cli.rb', line 245

def license(license, name)
  die_on_error {
    DependencyManager.license!(name, license)
  }

  say "The #{name} dependency has been marked as using #{license} license!", :green
end

#moveObject



254
255
256
257
# File 'lib/license_finder/cli.rb', line 254

def move
  Configuration.move!
  say "Congratulations, you have cleaned up your root directory!'", :green
end

#rescanObject



219
220
221
222
# File 'lib/license_finder/cli.rb', line 219

def rescan
  sync_with_spinner
  show_results
end

#show_resultsObject



225
226
227
228
# File 'lib/license_finder/cli.rb', line 225

def show_results
  IgnoredDependencies.new.list
  action_items
end