alchemist.el icon indicating copy to clipboard operation
alchemist.el copied to clipboard

Workflow: recomendations and suggestions

Open 4ZM opened this issue 8 years ago • 14 comments

Getting started with alchemist (which is awesome!), all the commands are kind of overwhelming. Especially if you are new to Elixir. I'm unsure when to re-compile with mix after I've changed a module and when to reload the buffer in iex, etc.

I would really appreciate some documentation of an example workflow and what alchemist commands are used in each step. Something like: create a new project, create a module, create a test, modify the module, experiment a bit in iex, re run the tests and so on.

4ZM avatar Sep 16 '16 08:09 4ZM

There is this refcard (spacemacs version). Also lot of info here http://alchemist.readthedocs.io/en/latest/basic_usage/

But its not really what you ask for, I guess most people tend to develop their own workflows, I'm quite new to both emacs (using spacemacs) and elixir, however if more people are interested I could try writing up a summary of what one can do with alchemist but it would be basic stuff, like looking up documentation, running tests and mix tasks, moving around in a project, compiling and last but not least using iex in emacs.

If you are both new to emacs and elixir, I would strongly suggest using spacemacs with the elixir layer, I think its a lot more beginner friendly

vasspilka avatar Sep 16 '16 15:09 vasspilka

Also @tonini I would suggest putting a documentation link in the alchemist website http://www.alchemist-elixir.org/ (preferably somewhere noticeable). When I first wanted to learn more about alchemist I was looking all around and could not find the documentation link, it was only many days after that I realized where it was. I know its on the README however its just a small paragraph and I somehow missed it, guess someone else might miss it too.

vasspilka avatar Sep 16 '16 16:09 vasspilka

Hi

Also @tonini I would suggest putting a documentation link in the alchemist website http://www.alchemist-elixir.org/ (preferably somewhere noticeable).

That's a good point, I'll add the link to the docs to the website later. Thanks 😄

tonini avatar Sep 21 '16 06:09 tonini

No example or recommended workflow?

4ZM avatar Sep 21 '16 09:09 4ZM

To be fair, I asked if you wanted to see something written by me and you never replied.

vasspilka avatar Sep 21 '16 09:09 vasspilka

@vasspilka I'm sorry I was slow reacting to your post. I would love to see something like that! Apologies if my comment came across as rude, it was not my intention. I was just surprised the ticket was closed without a comment as to why.

I'm not new to emacs, but to Elixir and it's ecosystem of tools, emacs modes etc. Any hints on a smooth and productive workflow would be much appreciated.

4ZM avatar Sep 21 '16 09:09 4ZM

@4ZM Ok, I'll fix something up in a blog post or something and share it here. Probably will be ready by the end of the week. I'd recommend to give the refcard https://github.com/tonini/alchemist.el/blob/master/doc/alchemist-refcard.pdf a look if you have not already, basically everything I'm going to say will involve commands from there, as well as some stuff inside iex.

vasspilka avatar Sep 21 '16 10:09 vasspilka

Looking forward to it!

4ZM avatar Sep 21 '16 10:09 4ZM

About working with Documentation Lookup

Refcard

  • https://github.com/tonini/alchemist.el/blob/master/doc/alchemist-refcard.pdf

tonini avatar Sep 22 '16 07:09 tonini

@4ZM I found myself in a busy weekend, so I most likely won't have time for article until sometime during the week, sorry for taking me long.

vasspilka avatar Sep 24 '16 22:09 vasspilka

@4ZM Here is the first half of the article https://medium.com/@vasspilka/c35f460e04e1 sorry for taking me more that I said but lot of stuff happening, hopefully I'll have the whole article ready soon. Any feedback is more than wellcome

vasspilka avatar Sep 28 '16 19:09 vasspilka

Great stuff! Exactly what I was looking for. Looking forward to the rest of the blog.

Something that I would particularly like to get some info on in the next part is reloading in iex and how it fits together with mix compile in the workflow.

Say you're writing a phoenix app and you make a change to a controller. What then? I guess; compile it, run the tests, reload it in iex (if running the server there)? Or would you recommend running the phoenix app outside of iex in a shell? If changing multiple files you can compile them in one swoop with mix compile, Is there any way of reloading all of the changed modules in iex?

4ZM avatar Sep 29 '16 06:09 4ZM

@4ZM Article finally finished. (Most likely will edit it a bit aswell) https://medium.com/@vasspilka/basic-workflow-for-alchemist-el-c35f460e04e1#.cytatqvhe

Sorry to not have responded here earlier.

I find using an external shell inside emacs with term is better than using iex -S mix phoenix.server with alchemist-iex-project-run, because with the latter IEx.pry complains some time. If you do iex -S mix phoenix.server phoenix should autocompile your files so you would only have to restart the server on very specific occasions e.g. new dependencies and other stuff. Phoenix has put a lot of work to automate all the compile stuff for both Elixir and Javascipt. In spacemacs we have this tab like thing called layouts (not sure if they are in vanilla emacs), you can have the phoenix server running in different layout for convienience. Or use an external shell, I do both depending on occasion and other stuff I'm working

Compiling to iex should be easy with alchemist-iex-compile-this-buffer, its not the whole project but I guess while you are working, you will only work on 1 file/buffer at a time, so It should suit your needs

vasspilka avatar Oct 05 '16 12:10 vasspilka

Great article! Thank you

4ZM avatar Oct 05 '16 18:10 4ZM