Elixir Working !

78 views
Skip to first unread message

Graeme Defty

unread,
Dec 25, 2015, 11:32:06 PM12/25/15
to chica...@googlegroups.com
Hi,

I finally got round to trying Elixir again - the language is just such a joy to use - and it is working fine (for 'lib' modules, anyway - I have not yet tried controllers).

I did find one small issue though. There is an omission in src/boss/boss_load.erl, around line 236 where a test is made for file suffices to select only erlang files:

    string:right(String, 4) == ".erl"


This should be amended to also allow for elixir files


    string:right(String, 4) == ".erl" orelse string:right(String, 3) == ".ex"



Cloning the repo and generating a pull request seems like a bit of a heavyweight solution for a one line change, but I am happy to do it if that is the preferred way to get this change in.

Please let me know how you prefer to proceed.

Thanks

Graeme





On 23 March 2015 at 19:15, kotedo <kot...@gmail.com> wrote:
I started (trying) to use Elixir in CB back when it was first implemented, but the lack of further development left me no choice and I abandoned it for ChicagoBoss.
I still love ChicagoBoss and Erlang even though there is Elixir and PhoenixFramework.  The right tool for the problem as we say.

Regards,
—Kai



On Mar 22, 2015, at 08:09, Graeme Defty <graeme...@gmail.com> wrote:

So I decided to start again with a clean install of CB.

The first things was just to get Elixir working for normal stuff - controllers, etc.

I proceeded as follows:

- duplicated the latest repository (0.8.14)
- got deps
- compiled
- created new project to make sure everything was OK
- followed the instructions at https://github.com/ChicagoBoss/ChicagoBoss/blob/master/README_ELIXIR.md
  i.e. - Uncommented {elixir …} in rebar.config
        - Copied priv/elixir to src/
        - ./rebar get-deps
        - ./rebar compile
            and all went OK until...
        - PATH=./deps/elixir/bin:.:$PATH mix deps.get
            which rewarded me with:
          Could not start Hex. Try fetching a new version with `mix local.hex` or uninstalling it with `mix local.uninstall hex`

I tried both of those options but neither led me down a path to success.

Any ideas anyone?

Is anyone using Elixir for anything in CB?

g






On 22 March 2015 at 07:55, Tim McNamara <mcnama...@gmail.com> wrote:

Great work!

On 22 Mar 2015 02:53, "Graeme Defty" <graeme...@gmail.com> wrote:
As a means of learning Elixir I decided to 'port' the Jade compiler I wrote to the new beam VM language.

I was never really thrilled with the Jaderl compiler I created, partly I think because it generated Erlang source which then had to be compiled. I always intended to cut out that intermediate form, but it looked to me that Elixir had much cleaner internals and it would therefore be easier to generate beam bytecode directly.

This turned out to be exactly the case and the new compiler works beautifully. I have not yet extended it to add any new capabilities, but it works fine as a stand-alone Elixir application and working with Elixir is a joy, so I do intend to enhance this version and support it as a production-ready component of CB (which it never really was before - nor claimed to be).

Now the tricky part . . . integrating it into the CB environment.

My first step was to change boss_template_adapter_jade.erl to call 'Elixir.Jadelix':compile, rather than jaderl:compile.

However, on performing 'make' there is some problem (though no message) compiling Jadelix itself, because no .beam file is produced and as a result, compiling a jade template gives:

<pre>
ERROR: pre_compile failed while processing /home/graeme/projects/egolf/dev/jadelix: {'EXIT',
    {undef,
        [{'Elixir.Jadelix',compile,
             ["src/view/hello/about.jade",jadelix_view_hello_about_jade,
              [{out_dir,"ebin"}]],
             []},
         {boss_template_adapter_jade,compile_file,3,
             [{file,
                  "src/boss/template_adapters/boss_template_adapter_jade.erl"},
              {line,19}]},
         {boss_load,'-load_views_inner/3-fun-1-',5,
             [{file,"src/boss/boss_load.erl"},{line,404}]},
         {boss_load,load_views,3,[{file,"src/boss/boss_load.erl"},{line,395}]},
         {boss_load,'-make_all_modules/3-fun-1-',3,
             [{file,"src/boss/boss_load.erl"},{line,84}]},
         {lists,map,2,[{file,"lists.erl"},{line,1237}]},
         {lists,map,2,[{file,"lists.erl"},{line,1237}]},
         {boss_load,load_all_modules,3,
             [{file,"src/boss/boss_load.erl"},{line,62}]}]}}
</pre>


I compiled Jadelix elsewhere and copied in the .beam file by hand, but when it is used to compile a jade template it raises an error trying to access the Elixir IO module.

<pre>
ERROR: pre_compile failed while processing /home/graeme/projects/egolf/dev/jadelix:
{'EXIT',
    {undef,
        [{'Elixir.IO',puts,[<<"Opening file ${filename}">>],[]},
         {'Elixir.Jadelix',add_file,3,[{file,"lib/jadelix.ex"},{line,187}]},
         {'Elixir.Jadelix',compile,3,[{file,"lib/jadelix.ex"},{line,88}]},
         {boss_template_adapter_jade,compile_file,3,
             [{file,
                  "src/boss/template_adapters/boss_template_adapter_jade.erl"},
              {line,19}]},
         {boss_load,'-load_views_inner/3-fun-1-',5,
             [{file,"src/boss/boss_load.erl"},{line,404}]},
         {boss_load,load_views,3,[{file,"src/boss/boss_load.erl"},{line,395}]},
         {boss_load,'-make_all_modules/3-fun-1-',3,
             [{file,"src/boss/boss_load.erl"},{line,84}]},
         {lists,map,2,[{file,"lists.erl"},{line,1237}]}]}}
make: *** [compile] Error 1
</pre>

I assume that the Elixir modules are not loaded. I have followed the steps for allowing Elixir use in my application and not sure what to try next.

Any thoughts?

g



--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/CAKF5fiAXrGU8DRi5PCp0tdnU_KNmn2e%2BcEkJU_E1tDLOrTMr_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/CAMUs9-MutiL-GLEupvg4bBidecs2V4a0Rgxw%2BaggRiASi3TT6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/CAKF5fiC4KxrFyUQ_qsd5z6c1mze_pyZS4-BExrAUwvrttBmvvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/BA400B47-F394-4CF1-AD5C-0B6B33E19E43%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry Polyanovsky

unread,
Dec 28, 2015, 1:41:32 AM12/28/15
to ChicagoBoss
Hello,

Latest version of elixir working fine (at least compiles without any issue) and I successfully wrote part of examples as described here https://github.com/ChicagoBoss/ChicagoBoss/blob/master/READMEs/README_ELIXIR.md
But not all things working and we need someone with good knowledge of Elixir to help with it.

If all issues will  be solved, we can have Elixir to be enabled by default.

Graeme Defty

unread,
Dec 28, 2015, 5:06:49 AM12/28/15
to chica...@googlegroups.com
Hi Dimitry,

If you can let me know what you think is not working, I will take a look at it.

If it really does not work, then we should not be saying in our web site that it does!

g



--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.

Dmitry Polyanovsky

unread,
Dec 28, 2015, 9:57:30 AM12/28/15
to ChicagoBoss
just try  to follow example in readme and see if everything works for you


Graeme Defty

unread,
Dec 31, 2015, 9:47:47 PM12/31/15
to chica...@googlegroups.com
Yes, Dmitry, that is exactly what I have done ... and it works fine - PROVIDED I make the change I mentioned.

Without it Elixir modules are not compiled.  :-)

g




On 28 December 2015 at 21:57, Dmitry Polyanovsky <dmitry.po...@gmail.com> wrote:
just try  to follow example in readme and see if everything works for you


--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.

Graeme Defty

unread,
Jan 4, 2016, 9:23:52 PM1/4/16
to chica...@googlegroups.com
As I had a clone of CB for my other change I included a PR for this (one-line) mod.

Unfortunately, it looks like I may have bundled the two changes together into the old PR, rather than create a new PR.

My apologies - let me know if you need me to do anything else with it.

Cheers,

g



Reply all
Reply to author
Forward
0 new messages