Homebrew / homebrew-bundle

📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.
MIT License
5.36k stars 288 forks source link

Parse brewfiles line by line #57

Closed mootari closed 9 years ago

mootari commented 9 years ago

Currently the DSL seems to choke on invalid quotes, causing the whole Brewfile to fail with "missing formula" errors for each single line. I would suggest to either

I'm not a ruby guy and I've only briefly looked at the code, but my guess would be that the first option is actually easier to implement.

MikeMcQuaid commented 9 years ago

Could you provide a sample failing Brewfile? Thanks!

mootari commented 9 years ago

Sure! I've provided multiple samples here: https://gist.github.com/cisso/ccadc42b4133d810d212 The one I mentioned above is Brewfile_fails_for_all_1.

Edit: Assuming that "Dsl" stands for domain-specific language, shouldn't that class merely parse/tokenize the Brewfile and return a list of sanitized Entry objects, so that they can be processed by a different class? (again, not a ruby guy)

xu-cheng commented 9 years ago

This issue is related to the legacy codes here. Instead of raising the error when dealing with invalid Brewfile, it tries to treat each line as individual formula name. In the result, some weird messages get out.

Should we just drop these legacy codes? cc @andrew

andrew commented 9 years ago

Yeah I'm not attached to the legacy code at all!

kevinSuttle commented 9 years ago

So, to be clear, what was the reason for requiring quotes in formula names inside of Brewfiles?

MikeMcQuaid commented 9 years ago

@kevinSuttle It's a Ruby DSL which means we don't need to implement our own parser.

kevinSuttle commented 9 years ago

@mikemcquaid Ok. So, not wanting to derail here, but that does directly affect Homebrew formulae, especially Caskroom.

MikeMcQuaid commented 9 years ago

@kevinSuttle I doesn't affect anything outside of Brewfiles.