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

Allow for multiple download locations for different operating systems #5

Closed
moritzheiber opened this issue Apr 5, 2020 · 4 comments

Comments

@moritzheiber
Copy link

moritzheiber commented Apr 5, 2020

Linuxbrew is a thing:tm: thus some Homebrew formula are doing stuff like this:

# The main formula
class MyFormula < Formula
  # [...]
  version '0.0.1'
  # [...]

  if OS.mac?
    url 'https://some.url/v0.0.1/binary-macos'
    sha256 'ce06501c7f791b4d653effb50f234cd6fa451c734054acb9936c14e965abf37d'
  elsif OS.linux?
    url 'https://some.url/v0.0.1/binary-linux'
    sha256 'a64cc55300ccd8491759fa5a7df1031e57b83d9712512333f792d4fb448dd766'
  end
  # [...]
end

It would be cool to be able to support this formula with this action 🙂

@mislav
Copy link
Owner

mislav commented Apr 9, 2020

@moritzheiber Yes that would be a great feature! It's just that, without a proper ruby parser, it would be really hard to parse out the if..else clauses to figure out where to inject the different URLs/checksums 🤔

@rami3l
Copy link

rami3l commented Jun 4, 2020

@mislav I want this feature too, but... Why should we need a parser in this case?
In my opinion, maybe we can use stuff like magic comments:

class Foo < Formula
  [ .. ]
  # BEGIN VERSION
  version "v0.1.0-alpha.1"
  # END VERSION
  [ .. ]
end

... and I think we might be able to write a script which generates ruby code and uses it to fill in the blanks. This also solves the problem of "which OS" problem! Just write:

# BEGIN URL.MAC
url "https://some.url/v0.0.1/binary-macos"
# END URL.MAC

... and you'll be fine.

Of course, the thing doesn’t have to be this complicated, but it seems practical for more complex scripts.

Also, we can choose to mix up the automatic way and the manual way, for example being able to annotate the Mac if-block would be of great help.

PS: My finals are approaching and I don't have enough time to do a proof of concept. However, I'd like to try when the vacations begin.

@rami3l
Copy link

rami3l commented Jun 5, 2020

@moritzheiber @mislav Oh no, I just thought too much: why can't we add support for template files?

@moritzheiber
Copy link
Author

moritzheiber commented Jun 5, 2020

@rami3l Here be dragons! 🐉 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants