Module: OrganizationLicenseAudit

Defined in:
lib/organization_license_audit.rb,
lib/organization_license_audit/version.rb

Constant Summary collapse

BUNDLE_PATH =
"vendor/bundle"
RESULT_LINE =
/(^[a-z_\d\.-]+), ([^,]+), (.+)/i
APPROVAL_HEADING =
"Dependencies that need approval"
PACKAGE_FILES =
{
  :bundler => "Gemfile",
  :npm     => "package.json",
  :bower   => "bower.json"
}
VERSION =
"1.1.2"

Class Method Summary collapse

Class Method Details

.run(options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/organization_license_audit.rb', line 17

def run(options)
  bad = find_bad(options)
  if bad.any?
    $stderr.puts "Failed:"

    errors = bad.map { |repo, output| [repo, extract_error(output)] }

    errors.each do |repo, unapproved|
      puts "#{describe_error(unapproved)} -- #{repo}"
    end

    if options[:csv]
      puts
      puts "CSV:"
      puts csv(errors, options[:csv])
    end

    1
  else
    0
  end
end