-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
bottle: add bottle stanza by traversing AST #9095
Conversation
Very nice. Would be good to also have some tests with examples where the non-AST version broke before. Also, maybe move this into |
e04a27e
to
7559b0a
Compare
I ❤️ this a LOT, thanks so much @SeekingMeaning! |
I'm not sure if this is too long for testing one example: context "when `license` is simple" do
let(:formula_contents) do
<<~RUBY.chomp
class Foobar < Formula
desc "Foobar"
license "GPL-3.0"
end
RUBY
end
let(:new_contents) do
<<~RUBY.chomp
class Foobar < Formula
desc "Foobar"
license "GPL-3.0"
bottle do
sha256 "123" => :cat
end
end
RUBY
end
it "adds `bottle` after `license`" do
described_class.add_bottle_stanza! formula_contents, bottle_output
expect(formula_contents).to eq(new_contents)
end
end Context: describe "#add_bottle_stanza!" do
let(:bottle_output) do
require "active_support/core_ext/string/indent"
<<~RUBY.chomp.indent(2)
bottle do
sha256 "123" => :cat
end
RUBY
end
# above code block example goes here
# more examples
end |
@SeekingMeaning Doesn't seem too long to me! |
This is looking great @SeekingMeaning! A few nits but I'm 👍🏻 to merge this whenever. |
As |
75c048e
to
5543a5d
Compare
Maybe something like |
@SeekingMeaning Yeh, I'm suggesting it might be good to extract a constant from both places. Alternatively, just |
5543a5d
to
dd8f514
Compare
Review period ended. |
dd8f514
to
5142f86
Compare
5142f86
to
b8aa67b
Compare
Linux gives this error:
|
Looks similar to: Homebrew/discussions#265 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 to merge once CI is 💚.
Yup, that suggested change fixed CI 🎉. Not merging yet because this has the potential to cause homebrew-core issues so I want to wait until @SeekingMeaning is around to respond quickly to any if needed. Nice work here 👏🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, really cool work. I'll let @SeekingMeaning merge and monitor stuff in case there is any issue.
Thanks guys! This should only affect new formulae added to homebrew-core but I'll try to keep an eye on everything just in case. |
brew style
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?This should improve
brew bottle
and make it 💥 less often by traversing the abstract syntax tree of a new formula and not using regexRelated: #9081 (comment)