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

Fix incorrect formula name from file name #5868

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

kiendang
Copy link
Contributor

@kiendang kiendang commented Mar 12, 2019

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Currently brew extract will create wrong formula file for files with hyphen in their name.

brew extract --version=1.10.5 kubernetes-cli custom/formulae

==> Searching repository history
==> Writing formula for kubernetes-cli from revision d09d972 to /usr/local/Homebrew/Library/Taps/custom/homebrew-formulae/Formula/[email protected]

brew install custom/formulae/[email protected]

Error: No available formula with the name "custom/formulae/[email protected]"
In formula file: /usr/local/Homebrew/Library/Taps/custom/homebrew-formulae/Formula/[email protected]
Expected to find class KubernetesCliAT1105, but only found: KubernetesCli.

The reason is L145, kubernetes-cli would become Kubernetes-cli, not KubernetesCli, so the extracted versioned formula file will still have class name KubernetesCli instead of KubernetesCliAT1105.

# The class name has to be renamed to match the new filename,
# e.g. Foo version 1.2.3 becomes FooAT123 and resides in [email protected].
class_name = name.capitalize
versioned_name = Formulary.class_s("#{class_name}@#{version}")
result.gsub!("class #{class_name} < Formula", "class #{versioned_name} < Formula")

@etheleon

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Great work!
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @kiendang!

@MikeMcQuaid MikeMcQuaid merged commit 58ec409 into Homebrew:master Mar 12, 2019
@kiendang kiendang deleted the extract-rename-class branch March 12, 2019 19:57
@kiendang kiendang mentioned this pull request Mar 15, 2019
6 tasks
@lock lock bot added the outdated PR was locked due to age label Apr 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants