dimitarvp

dimitarvp

Mix archives: can I have several of Phoenix's (different versions) and use them concurrently?

Hey everyone,
I am interested in making a tree diff of freshly generated Phoenix projects and projects that have been in development for a while. I’d just like to have it at quick glance what’s the difference from the bare-bones app that would be generated with the Phoenix generator versus the actual app.

To that end, I was unable to find a way to use several different versions of the same Mix archive and be able to specify which version of the archive to use.

In general, Mix archives seems rather awkward to manage and something that regularly catches me with my pants down. I keep forgetting to check for Phoenix’s Mix archive version, but others have bitten me in the past as well. Is there anything we as a community can do to help there, by the way?

And, is there a way to do what I am after? Except for installing a particular version, using it, then deleting it, then installing another etc.?

Marked As Solved

dimitarvp

dimitarvp

Confirmed that using the following commands yields slightly different projects and thus it can be used to “sandbox” using various mix archive-related commands (like phx.new and many others):

MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.5" mix archive.install hex phx_new 1.5.5
mkdir ~/demo155
cd ~/demo155
MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.5" mix phx.new demo

MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.6" mix archive.install hex phx_new 1.5.6
mkdir ~/demo156
cd ~/demo156
MIX_ARCHIVES="$HOME/.mix_phoenix-1.5.6" mix phx.new demo

Doing diff -ur ~/demo155/demo ~/demo156/demo only shows differences between the secret_key_base and signing_salt variables (both irrelevant here) and – voila! – there are differences in mix.exs:

-      {:phoenix, "~> 1.5.5"},
+      {:phoenix, "~> 1.5.6"},

and:

-      {:phoenix_live_dashboard, "~> 0.2"},
+      {:phoenix_live_dashboard, "~> 0.3 or ~> 0.2.9"},

TL;DR: Using the MIX_ARCHIVES env var works perfectly for my goal.

Many thanks to @NobbZ for pointing me in the right direction.

Also Liked

dimitarvp

dimitarvp

It seems that a little better granularity (and I suppose less file waste) can be achieved by utilizing the MIX_ARCHIVES env var, I’ll experiment and report back.

LostKobrakai

LostKobrakai

There‘s https://www.phoenixdiff.org/ for that as well.

NobbZ

NobbZ

You could install each in a different MIX_HOME. And switch to those when using different versions.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New

Other popular topics Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New

We're in Beta

About us Mission Statement