Class: LicenseeCLI

Inherits:
Thor
  • Object
show all
Includes:
Licensee::Commands::DetectCLIHelpers
Defined in:
lib/licensee/commands/diff.rb,
lib/licensee/commands/detect.rb,
lib/licensee/commands/version.rb,
lib/licensee/commands/license_path.rb

Overview

‘licensee license-path` command implementation.

Constant Summary

Constants included from Licensee::Commands::DetectCLIHelpers

Licensee::Commands::DetectCLIHelpers::MATCHED_FILE_METHODS

Instance Method Summary collapse

Instance Method Details

#detect(_path = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/licensee/commands/detect.rb', line 18

def detect(_path = nil)
  Licensee.confidence_threshold = options[:confidence]

  handle_json_output if options[:json]

  print_project_summary
  print_matched_files
  maybe_diff_license_file
end

#diff(_path = nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/licensee/commands/diff.rb', line 9

def diff(_path = nil)
  say "Comparing to #{expected_license.name}:"
  print_table diff_summary_rows
  exit_on_exact_match
  say word_diff
end

#license_path(path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/licensee/commands/license_path.rb', line 6

def license_path(path)
  project = Licensee.project(path)

  exit 1 unless project.license_file

  if remote?
    say project.license_file.path
  else
    say File.expand_path(project.license_file.path, path)
  end
end

#versionObject



6
7
8
# File 'lib/licensee/commands/version.rb', line 6

def version
  say Licensee::VERSION
end