Elm-format: Explore using brew for Mac

Created on 29 Jan 2016  路  7Comments  路  Source: avh4/elm-format

Is anyone planning on writing a brew formula for this? Otherwise I could give it a try.

packaging Mac

Most helpful comment

As mentioned in https://github.com/avh4/elm-format/issues/84 it seems that brew support is partially working:

brew install --devel homebrew/devel-only/elm-format

After running that I got two elm-formats:

/usr/local/bin/elm-format-0.16
/usr/local/bin/elm-format-0.17

The only thing left to do was creating a symbolic link:

ln -s /usr/local/bin/elm-format-0.17 /usr/local/bin/elm-format

All 7 comments

I don't know of anyone working on this. I would be happy to see this, but be warned that it's a bit painful because of the dependency on haskell. It also hopefully won't be needed for long because the goal for elm-format is to merge it into Elm-Platform within the next 3 months so that it will be distributed with Elm.

If you do want to look at this, here's a start that might help get haskell compilation working:

require "language/haskell"

class ElmFormat < Formula
  include Language::Haskell::Cabal

  desc "..."
  homepage "..."

  stable do
    url "..."
    sha256 "..."
  end

  bottle do
    sha256 "..." => :el_capitan
    sha256 "..." => :yosemite
    sha256 "..." => :mavericks
  end

  head do
    url "..."
  end

  depends_on "ghc" => :build
  depends_on "cabal-install" => :build

  def install
    cabal_sandbox do
      cabal_sandbox_add_source "elm-format"
      cabal_install "--only-dependencies", "elm-format"
      cabal_install "--prefix=#{prefix}", "elm-format"
    end
  end

  test do
    src_path = testpath/"Hello.elm"
    src_path.write <<-EOS.undent
      import Html exposing (text)
      main = text "Hello, world!"
    EOS

    system bin/"elm-format", testpath/"Hello.elm", "--yes"
    ## assert output is formatted
  end
end

I put this together with a little of help of what @avh4 posted above. https://github.com/enilsen16/homebrew/commit/85f95f82265c0bdcbd2a8cf69615b65e1afbffff

I am not sure homebrew will accept this formula until a stable version is released but I will try anyway. https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Acceptable-Formulae.md#stable-versions

If this is to become part of Elm Platform in the foreseeable future, there's no need to bother with Homebrew.

@avh4 what about the plans to move elm-format to the elm-platform?

As mentioned in https://github.com/avh4/elm-format/issues/84 it seems that brew support is partially working:

brew install --devel homebrew/devel-only/elm-format

After running that I got two elm-formats:

/usr/local/bin/elm-format-0.16
/usr/local/bin/elm-format-0.17

The only thing left to do was creating a symbolic link:

ln -s /usr/local/bin/elm-format-0.17 /usr/local/bin/elm-format

I just came here after using the formula as it seems to install 3 versions but link none. The formula should only install the latest version. If other versions are needed there should be secondary formulas to those version. Is there a reason for 3 version to be installed automatically and none be linked?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mordrax picture mordrax  路  6Comments

rtfeldman picture rtfeldman  路  4Comments

ahstro picture ahstro  路  4Comments

welblaud picture welblaud  路  3Comments

avh4 picture avh4  路  5Comments