Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install all licenses #8256

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Library/Homebrew/metafiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@ module Metafiles

module_function

def license?(file)
file = file.upcase
ext = File.extname(file)
file = File.basename(file, ext)
file.gsub!("LICENCE", "LICENSE")
file == "LICENSE" || file.start_with?("LICENSE-")
end

def list?(file)
return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)

!copy?(file)
end

def copy?(file)
return true if license?(file)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the two entries in BASENAMES are not used anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that, do we want to get rid of them?

Copy link
Member

@reitermarkus reitermarkus Aug 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either that, or move them to something like BASENAME_REGEXES:

BASENAME_REGEXES = [/^licen(c|s)e(\-|$)/].freeze

and change the check to

BASENAMES.include?(file) || BASENAME_REGEXES.any? { |r| r.match?(file) }

so we don't even need the license? helper function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't even need to be an array of regexes.


file = file.downcase
ext = File.extname(file)
file = File.basename(file, ext) if EXTENSIONS.include?(ext)
Expand Down