greggreg
greggreg

Reputation: 12085

How do I access a project's Mixfile from an escript?

When compiling an Elixir mix project into an escript, I want to be able to access its mixfile for looking up things like the version number. When I run the project in IEx this is no problem. But it seems that mix is not compiling the mixfile into the escript.

When I try to access the mixfile I get: module MixfileTest.Mixfile is not available

I have tried requireing the module but this is to no avail. How can I access a project's mixfile once compiled to an escript?

Upvotes: 2

Views: 103

Answers (1)

stephen_m
stephen_m

Reputation: 910

You could get the project details at compile time. Just an idea.

defmodule MixfileTest do
  @project MixfileTest.Mixfile.project()

  def main([]) do
    IO.inspect @project
  end

end

Upvotes: 3

Related Questions