зеркало из https://github.com/github/licensed.git
Родитель
a4f4f0d5f9
Коммит
3054bc2f96
|
@ -15,7 +15,7 @@ module Licensed
|
|||
method_option :format, aliases: "-f", enum: ["yaml", "json"],
|
||||
desc: "Output format"
|
||||
def cache
|
||||
run Licensed::Commands::Cache.new(config:),
|
||||
run Licensed::Commands::Cache.new(config: config),
|
||||
force: options[:force], sources: options[:sources], reporter: options[:format]
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ module Licensed
|
|||
enum: ["files", "configuration"], default: "files",
|
||||
desc: "Whether to check compliance status from cached records or the configuration file"
|
||||
def status
|
||||
run Licensed::Commands::Status.new(config:), sources: options[:sources], reporter: options[:format], data_source: options[:data_source]
|
||||
run Licensed::Commands::Status.new(config: config), sources: options[:sources], reporter: options[:format], data_source: options[:data_source]
|
||||
end
|
||||
|
||||
desc "list", "List dependencies"
|
||||
|
@ -43,7 +43,7 @@ module Licensed
|
|||
method_option :licenses, aliases: "-l", type: :boolean,
|
||||
desc: "Include detected licenses in output"
|
||||
def list
|
||||
run Licensed::Commands::List.new(config:), sources: options[:sources], reporter: options[:format], licenses: options[:licenses]
|
||||
run Licensed::Commands::List.new(config: config), sources: options[:sources], reporter: options[:format], licenses: options[:licenses]
|
||||
end
|
||||
|
||||
desc "notices", "Generate a NOTICE file with dependency data"
|
||||
|
@ -54,7 +54,7 @@ module Licensed
|
|||
method_option :computed, aliases: "-l", type: :boolean,
|
||||
desc: "Whether to generate a NOTICE file using computed data or cached records"
|
||||
def notices
|
||||
run Licensed::Commands::Notices.new(config:), sources: options[:sources], computed: options[:computed]
|
||||
run Licensed::Commands::Notices.new(config: config), sources: options[:sources], computed: options[:computed]
|
||||
end
|
||||
|
||||
map "-v" => :version
|
||||
|
@ -70,7 +70,7 @@ module Licensed
|
|||
method_option :config, aliases: "-c", type: :string,
|
||||
desc: "Path to licensed configuration file"
|
||||
def env
|
||||
run Licensed::Commands::Environment.new(config:), reporter: options[:format]
|
||||
run Licensed::Commands::Environment.new(config: config), reporter: options[:format]
|
||||
end
|
||||
|
||||
desc "migrate", "Migrate from a previous version of licensed"
|
||||
|
|
|
@ -74,7 +74,7 @@ module Licensed
|
|||
|
||||
# Is the given dependency reviewed?
|
||||
def reviewed?(dependency, match_version: false)
|
||||
any_list_pattern_matched? self["reviewed"][dependency["type"]], dependency, match_version:
|
||||
any_list_pattern_matched? self["reviewed"][dependency["type"]], dependency, match_version: match_version
|
||||
end
|
||||
|
||||
# Find all reviewed dependencies that match the provided dependency's name
|
||||
|
|
|
@ -37,7 +37,7 @@ module Licensed
|
|||
raise ArgumentError, "dependency path #{path} must be absolute"
|
||||
end
|
||||
|
||||
super(path, search_root:, detect_readme: true, detect_packages: true)
|
||||
super(path, search_root: search_root, detect_readme: true, detect_packages: true)
|
||||
end
|
||||
|
||||
# Returns whether the dependency exists locally
|
||||
|
|
|
@ -17,7 +17,7 @@ module Licensed
|
|||
Dependency.new(
|
||||
name: package["name"],
|
||||
version: package["version"] || package["_release"],
|
||||
path:,
|
||||
path: path,
|
||||
metadata: {
|
||||
"type" => Bower.type,
|
||||
"summary" => package["description"],
|
||||
|
|
|
@ -15,7 +15,7 @@ module Licensed
|
|||
|
||||
def initialize(name:, version:, path:, loaded_from:, errors: [], metadata: {})
|
||||
@loaded_from = loaded_from
|
||||
super name:, version:, path:, errors:, metadata:
|
||||
super name: name, version: version, path: path, errors: errors, metadata: metadata
|
||||
end
|
||||
|
||||
# Load a package manager file from the base Licensee::Projects::FsProject
|
||||
|
|
|
@ -44,14 +44,14 @@ module Licensed
|
|||
spec = super(*args)
|
||||
return spec unless spec.is_a?(LazySpecification)
|
||||
|
||||
Licensed::Bundler::MissingSpecification.new(name:, version:, platform:, source:)
|
||||
Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
|
||||
end
|
||||
|
||||
def __materialize__(*args)
|
||||
spec = super(*args)
|
||||
return spec if spec
|
||||
|
||||
Licensed::Bundler::MissingSpecification.new(name:, version:, platform:, source:)
|
||||
Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,8 +17,8 @@ module Licensed
|
|||
Dependency.new(
|
||||
name: package["name"],
|
||||
version: package["version"],
|
||||
path:,
|
||||
search_root:,
|
||||
path: path,
|
||||
search_root: search_root,
|
||||
errors: Array(package["error"]),
|
||||
metadata: {
|
||||
"type" => Cabal.type,
|
||||
|
|
|
@ -20,9 +20,9 @@ module Licensed
|
|||
version = lockfile.version(name).version
|
||||
|
||||
Dependency.new(
|
||||
path:,
|
||||
name:,
|
||||
version:,
|
||||
path: path,
|
||||
name: name,
|
||||
version: version,
|
||||
metadata: { "type" => Cocoapods.type }
|
||||
)
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ module Licensed
|
|||
|
||||
Licensed::Dependency.new(
|
||||
name: submodule_path,
|
||||
version:,
|
||||
version: version,
|
||||
path: config.pwd.join(displaypath),
|
||||
metadata: {
|
||||
"type" => self.class.type,
|
||||
|
|
|
@ -31,10 +31,10 @@ module Licensed
|
|||
def load_csv(path, executable, configurations)
|
||||
@csv ||= begin
|
||||
gradle_licenses_dir = File.join(path, GRADLE_LICENSES_PATH)
|
||||
Licensed::Sources::Gradle.gradle_command("generateLicenseReport", path:, executable:, configurations:)
|
||||
Licensed::Sources::Gradle.gradle_command("generateLicenseReport", path: path, executable: executable, configurations: configurations)
|
||||
CSV.foreach(File.join(gradle_licenses_dir, GRADLE_LICENSES_CSV_NAME), headers: true).each_with_object({}) do |row, hsh|
|
||||
name, _, version = row["artifact"].rpartition(":")
|
||||
key = csv_key(name:, version:)
|
||||
key = csv_key(name: name, version: version)
|
||||
hsh[key] = row["moduleLicenseUrl"]
|
||||
end
|
||||
ensure
|
||||
|
@ -56,7 +56,7 @@ module Licensed
|
|||
def initialize(name:, version:, path:, executable:, configurations:, metadata: {})
|
||||
@configurations = configurations
|
||||
@executable = executable
|
||||
super(name:, version:, path:, metadata:)
|
||||
super(name: name, version: version, path: path, metadata: metadata)
|
||||
end
|
||||
|
||||
# Returns whether the dependency content exists
|
||||
|
@ -84,14 +84,14 @@ module Licensed
|
|||
end
|
||||
|
||||
def enumerate_dependencies
|
||||
JSON.parse(self.class.gradle_command("printDependencies", path: config.pwd, executable: gradle_executable, configurations:)).map do |package|
|
||||
JSON.parse(self.class.gradle_command("printDependencies", path: config.pwd, executable: gradle_executable, configurations: configurations)).map do |package|
|
||||
name = "#{package["group"]}:#{package["name"]}"
|
||||
Dependency.new(
|
||||
name:,
|
||||
name: name,
|
||||
version: package["version"],
|
||||
path: config.pwd,
|
||||
executable: gradle_executable,
|
||||
configurations:,
|
||||
configurations: configurations,
|
||||
metadata: {
|
||||
"type" => Gradle.type
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ module Licensed
|
|||
name: package_name,
|
||||
version: contents_version(*sources),
|
||||
path: configured_license_path(package_name) || sources_license_path(sources),
|
||||
sources:,
|
||||
sources: sources,
|
||||
metadata: {
|
||||
"type" => Manifest.type,
|
||||
"name" => package_name
|
||||
|
@ -180,7 +180,7 @@ module Licensed
|
|||
|
||||
def initialize(name:, version:, path:, sources:, metadata: {})
|
||||
@sources = sources
|
||||
super(name:, version:, path:, metadata:)
|
||||
super(name: name, version: version, path: path, metadata: metadata)
|
||||
end
|
||||
|
||||
def project_files
|
||||
|
|
|
@ -40,7 +40,7 @@ module Licensed
|
|||
Dependency.new(
|
||||
name: pkg[:name],
|
||||
version: pkg[:version],
|
||||
path:,
|
||||
path: path,
|
||||
metadata: pkg[:metadata].merge("type" => self.class.type),
|
||||
errors: errors + Array(pkg[:error])
|
||||
)
|
||||
|
|
|
@ -33,7 +33,7 @@ module Licensed
|
|||
|
||||
errors = package["problems"] unless package["path"]
|
||||
Dependency.new(
|
||||
name:,
|
||||
name: name,
|
||||
version: package["version"] || package["required"],
|
||||
path: package["path"],
|
||||
errors: Array(errors),
|
||||
|
|
|
@ -202,8 +202,8 @@ module Licensed
|
|||
|
||||
NuGetDependency.new(
|
||||
name: id,
|
||||
version:,
|
||||
path:,
|
||||
version: version,
|
||||
path: path,
|
||||
errors: Array(error),
|
||||
metadata: {
|
||||
"type" => NuGet.type,
|
||||
|
|
|
@ -19,9 +19,9 @@ module Licensed
|
|||
error = "Unable to determine project path from #{url}" unless path
|
||||
|
||||
Dependency.new(
|
||||
name:,
|
||||
path:,
|
||||
version:,
|
||||
name: name,
|
||||
path: path,
|
||||
version: version,
|
||||
errors: Array(error),
|
||||
metadata: {
|
||||
"type" => Swift.type,
|
||||
|
|
|
@ -13,7 +13,7 @@ module Licensed
|
|||
def enumerate_dependencies
|
||||
packages.map do |name, package|
|
||||
Dependency.new(
|
||||
name:,
|
||||
name: name,
|
||||
version: package["version"],
|
||||
path: package["path"],
|
||||
metadata: {
|
||||
|
|
|
@ -20,7 +20,7 @@ module Licensed
|
|||
def enumerate_dependencies
|
||||
packages.map do |name, package|
|
||||
Dependency.new(
|
||||
name:,
|
||||
name: name,
|
||||
version: package["version"],
|
||||
path: package["path"],
|
||||
metadata: {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe Licensed::Commands::Cache do
|
|||
let(:source_config) { {} }
|
||||
let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) }
|
||||
let(:reporter) { TestReporter.new }
|
||||
let(:command) { Licensed::Commands::Cache.new(config:) }
|
||||
let(:command) { Licensed::Commands::Cache.new(config: config) }
|
||||
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
|
||||
|
||||
after do
|
||||
|
|
|
@ -172,7 +172,7 @@ describe Licensed::Commands::Command do
|
|||
|
||||
it "uses a passed in reporter if given" do
|
||||
reporter = Licensed::Reporters::StatusReporter.new
|
||||
assert_equal reporter, command.create_reporter(reporter:)
|
||||
assert_equal reporter, command.create_reporter(reporter: reporter)
|
||||
end
|
||||
|
||||
it "uses the commands default_reporter by default" do
|
||||
|
|
|
@ -18,7 +18,7 @@ describe Licensed::Commands::Environment do
|
|||
]
|
||||
}
|
||||
let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }) }
|
||||
let(:command) { Licensed::Commands::Environment.new(config:) }
|
||||
let(:command) { Licensed::Commands::Environment.new(config: config) }
|
||||
|
||||
describe "#run" do
|
||||
let(:reporter) { TestReporter.new }
|
||||
|
|
|
@ -9,7 +9,7 @@ describe Licensed::Commands::List do
|
|||
let(:apps) { [] }
|
||||
let(:source_config) { {} }
|
||||
let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }, "test" => source_config) }
|
||||
let(:command) { Licensed::Commands::List.new(config:) }
|
||||
let(:command) { Licensed::Commands::List.new(config: config) }
|
||||
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
|
||||
|
||||
each_source do |source_class|
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Licensed::Commands::Notices do
|
|||
let(:cache_path) { Dir.mktmpdir }
|
||||
let(:reporter) { TestReporter.new }
|
||||
let(:config) { Licensed::Configuration.new("cache_path" => cache_path, "sources" => { "test" => true }) }
|
||||
let(:command) { Licensed::Commands::Notices.new(config:) }
|
||||
let(:command) { Licensed::Commands::Notices.new(config: config) }
|
||||
|
||||
before do
|
||||
generator_config = Marshal.load(Marshal.dump(config))
|
||||
|
|
|
@ -11,7 +11,7 @@ describe Licensed::Commands::Status do
|
|||
let(:source_config) { {} }
|
||||
let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) }
|
||||
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
|
||||
let(:command) { Licensed::Commands::Status.new(config:) }
|
||||
let(:command) { Licensed::Commands::Status.new(config: config) }
|
||||
|
||||
def dependency_errors(app, source, dependency_name = "dependency")
|
||||
app_report = reporter.report.reports.find { |r| r.name == app["name"] }
|
||||
|
|
|
@ -162,7 +162,7 @@ if Licensed::Shell.tool_available?("dotnet")
|
|||
dep = Licensed::Sources::NuGet::NuGetDependency.new(
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
path:,
|
||||
path: path,
|
||||
metadata: {
|
||||
"name" => "test"
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ module CommandTestHelpers
|
|||
def run_command(**options)
|
||||
if defined?(reporter) && !options.key?(:reporter)
|
||||
# automatically set the defined reporter if a reporter is not explicitly set
|
||||
options = options.merge(reporter:)
|
||||
options = options.merge(reporter: reporter)
|
||||
end
|
||||
|
||||
# expects the test class to define "command"
|
||||
|
|
|
@ -12,7 +12,7 @@ class TestShell < Licensed::UI::Shell
|
|||
return unless level?("debug")
|
||||
@messages << {
|
||||
message: msg,
|
||||
newline:,
|
||||
newline: newline,
|
||||
style: :debug
|
||||
}
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ class TestShell < Licensed::UI::Shell
|
|||
return unless level?("info")
|
||||
@messages << {
|
||||
message: msg,
|
||||
newline:,
|
||||
newline: newline,
|
||||
style: :info
|
||||
}
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ class TestShell < Licensed::UI::Shell
|
|||
return unless level?("confirm")
|
||||
@messages << {
|
||||
message: msg,
|
||||
newline:,
|
||||
newline: newline,
|
||||
style: :confirm
|
||||
}
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ class TestShell < Licensed::UI::Shell
|
|||
return unless level?("warn")
|
||||
@messages << {
|
||||
message: msg,
|
||||
newline:,
|
||||
newline: newline,
|
||||
style: :warn
|
||||
}
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ class TestShell < Licensed::UI::Shell
|
|||
return unless level?("error")
|
||||
@messages << {
|
||||
message: msg,
|
||||
newline:,
|
||||
newline: newline,
|
||||
style: :error
|
||||
}
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче