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

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
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43657 311
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

We're in Beta

About us Mission Statement