Is there a way to pull archives from hex.pm

raxx_kit is a generator for web-applications, using Ace and Raxx.


At the moment instructions for using raxx_kit include pulling the archive from github.

$ mix archive.install https://github.com/CrowdHailer/raxx_kit/raw/master/raxx_kit.ez

This works perfectly well but it has a few, minor, downsides such as a long url and the fact the project is not discoverable on hex.pm.

I was wondering if there was anyway to pull an archive from hex. It seams like it should be easy enough to implement.

For example mix.exs could specify the path to an archive within the project.

defmodule RaxxKit.MixProject do
  use Mix.Project

  def project do
    [
      app: :raxx_kit,
      archive: "./raxx_kit.ez"
      # etc
    ]
  end
end

And then mix archive.install raxx_kit could just look for the project on hex.

Thoughts, is this possible some other way or is there a good reason this would be a bad idea?

1 Like

According to mix help archive.install you can do mix archive.install hex $package $version where version is optional.

Interesting. I was looking at the docs here mix archive.install — Mix v1.16.0

I probably looked too much at the code examples. I now see it says

If an argument is provided, it should be a local path or a URL to a prebuilt archive, a Git repository, a GitHub repository, or a Hex package.

To me this suggests I should add a url to a hex package.

Edit

Sorry I see it now.

Ok. but I do have an issue. running the following will build the archive locally, correct?

mix archive.install hex raxx_kit

I need to build my archive with the --include-dot-files option. Is it possible for me to use the command above but have my project specify that the archive should be build with the option for dotfiles.

I can’t answer that, as I’ve not currently used an archive.install hex, phx_new and hex are the only archives I’ve installed. hex installs semi-automatically once needed and phx_new propagates installation via URL.

I just read from the documentation of the task.

But I do assume, that the hex archive is involved in the hex-install, so lets try to ask @ericmj.

I think archive.install should take the same options that archive.build does or possibly that it should be possible to configure --include-dot-files in the project config so that the flag is not needed.

1 Like

Are you saying it should already or that it should be changed to address this?

In my opinion when I pull an archive from hex I do not want to remember to add any options or switches. I just want it to work out of the box, as it were when I use an URL to a prebuilt archive.

That’s the user point of view.

I think it should be changed to address this.

Definitely. If you could configure --include-dot-files in the project config it would work out of the box.

2 Likes