Mix get command line task in project setup

79 views
Skip to first unread message

Chris Jimison

unread,
Feb 28, 2015, 2:49:11 PM2/28/15
to elixir-l...@googlegroups.com
Hi all,

I hit kind of a strange use-case and was wondering if anyone knew a way around it.  I am currently hitting an issue then when I include exrm (a release package project) as a deps will break ex_docs ability to generate the docs (or maybe it is earmark .. not sure).  

My question is how can I get the "task" (in this case "docs") from within the "def project" function?  I don't need to include exrm when I am doing a mix docs build but I do need to make packaged builds of both :dev and :prod environments.  I have already filed a bug with the exrm folks but I would love to work around this until such a time that a fix can be put into place.

Thanks for the help!

-Chris

P.S.  Example mix.exs file created by running mix new Sandbox --sup and updated with packages

defmodule Sandbox.Mixfile do
  use Mix.Project

  def project do
    [app: : sandbox,
     version: "0.0.1",
     deps_path: "deps",
     lockfile: "mix.lock",
     elixir: "~> 1.0",
     deps: deps]
  end

  def application do
    [applications: [:logger],
     mod: {Sandbox, []}]
  end
  defp deps do
    [
        # It would be awesome if I can check if this is a docs build here...
        #{:exrm,     git: "https://github.com/bitwalker/exrm.git",       branch: "master"}, #<-- uncomment this line and mix docs will no longer work
        {:earmark,  "~> 0.1",                                           only: :dev},
        {:ex_doc,   "~> 0.7",                                           only: :dev}
    ]
  end
end

José Valim

unread,
Feb 28, 2015, 3:24:17 PM2/28/15
to elixir-l...@googlegroups.com
So those configurations ran fine on my machine. Can you please post the Elixir version and the error message with stacktrace of the error you are seeing?



José Valim
Skype: jv.ptec
Founder and Lead Developer

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/8e5fa309-c8ad-4be9-a2dd-e032aa85db82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Jimison

unread,
Mar 1, 2015, 11:28:08 AM3/1/15
to elixir-l...@googlegroups.com
earmark - 0.1.13
ex_doc - 0.7.1
exrm: {:git, "https://github.com/bitwalker/exrm.git", "abfbca17df004f721990b962050b6842cdf965fd", [branch: "master"]},
elixir - 1.0.3
Mac OSX

As for an error there is no error message, when I take the exrm package out I get the following

➜ mix docs
<compiles all project files>
Generated sandbox.app
Docs successfully generated.
View them at "doc/index.html".
➜ 
Adding the exrm package in (and removing the docs folder) I get the following

➜ mix docs
<compiles all project files>
Generated sandbox.app
➜ 

There is no docs folder generated

If it is working for you then I am sure it must be a problem with my configuration or setup.  However, is it possible to check in the mix.exs what “task” I am running (or the command line args, etc) so I can conditionally require deps?

Thanks!

-Chris

You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/_8-i-zw6yHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bn8jGKTCDK2EiXOqxxXzxz4B%3Dqgsp1d7RJPXE%3DJcd6Dg%40mail.gmail.com.

José Valim

unread,
Mar 1, 2015, 11:45:22 AM3/1/15
to elixir-l...@googlegroups.com

If it is working for you then I am sure it must be a problem with my configuration or setup.  However, is it possible to check in the mix.exs what “task” I am running (or the command line args, etc) so I can conditionally require deps?

Unfortunately no.

José Valim

unread,
Mar 1, 2015, 11:45:41 AM3/1/15
to elixir-l...@googlegroups.com
If you push a project to github with mix.exs and mix.lock I would gladly take a look.



José Valim
Skype: jv.ptec
Founder and Lead Developer

Christopher Jimison

unread,
Mar 7, 2015, 1:02:23 PM3/7/15
to elixir-l...@googlegroups.com
Hi Jose,

I am very sorry for the delay in responding, I have been at GDC all week and just now getting back around to this.  Thank you so much for the very generous offer however the fine folks at exrm found the bug and fixed it.

-Chris

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/_8-i-zw6yHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages